Examples of IsNullCriteria


Examples of org.teiid.query.sql.lang.IsNullCriteria

            AbstractSetCriteria setCriteria = (AbstractSetCriteria)criteria;
            if (!setCriteria.isNegated()) {
                ElementCollectorVisitor.getElements(setCriteria.getExpression(), elements);
            }
        } else if(criteria instanceof IsNullCriteria) {
            IsNullCriteria isNullCriteria = (IsNullCriteria)criteria;
            if (!isNullCriteria.isNegated()) {
                ElementCollectorVisitor.getElements(isNullCriteria.getExpression(), elements);
            }
        }       
    }
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

            cost = childCost / 3;
           
            isNegatedPredicateCriteria = setCriteria.isNegated();

        } else if(predicateCriteria instanceof IsNullCriteria) {
            IsNullCriteria isNullCriteria = (IsNullCriteria)predicateCriteria;

            float nnv = getStat(Stat.NNV, elements, currentNode, childCost, metadata);
            if (nnv == UNKNOWN_VALUE) {
              if (unknownChildCost) {
                return UNKNOWN_VALUE;
              }
                cost = childCost / ndv;
            } else {
                cost = nnv;
            }
           
            isNegatedPredicateCriteria = isNullCriteria.isNegated();
        } else if (predicateCriteria instanceof DependentSetCriteria) {
          DependentSetCriteria dsc = (DependentSetCriteria)predicateCriteria;
         
          if (unknownChildCost) {
                return UNKNOWN_VALUE;
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

     * Rewrite the given conjunct
     * @return null if the conjunct was internally handled
     */
    private Criteria rewriteAndConjunct(Criteria converted, Map<Expression, Criteria> exprMap, LinkedHashSet<Criteria> newCrits) throws ExpressionEvaluationException {
      if (converted instanceof IsNullCriteria) {
          IsNullCriteria inc = (IsNullCriteria)converted;
          if (!inc.isNegated()) {
              Criteria crit = exprMap.get(inc.getExpression());
              if (crit == null) {
                exprMap.put(inc.getExpression(), converted);
              } else if (!(crit instanceof IsNullCriteria)) {
                return FALSE_CRITERIA;
              }
          }
        } else if (converted instanceof SetCriteria) {
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

    if (nullPossible) {
      if (outcome) {
        if (processing) {
          return crit;
        }
        IsNullCriteria inc = new IsNullCriteria(a);
        inc.setNegated(true);
        return inc;
      }
    } else if (outcome) {
      return TRUE_CRITERIA;
    }
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

        concat.setType(DataTypeManager.DefaultDataClasses.STRING);
        FunctionDescriptor descriptor =
          funcLibrary.findFunction(SourceSystemFunctions.CONCAT, new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING });
        concat.setFunctionDescriptor(descriptor);
       
        List when = Arrays.asList(new Criteria[] {new CompoundCriteria(CompoundCriteria.AND, new IsNullCriteria(args[0]), new IsNullCriteria(args[1]))});
        Constant nullConstant = new Constant(null, DataTypeManager.DefaultDataClasses.STRING);
        List then = Arrays.asList(new Expression[] {nullConstant});
        SearchedCaseExpression caseExpr = new SearchedCaseExpression(when, then);
        caseExpr.setElseExpression(concat);
        caseExpr.setType(DataTypeManager.DefaultDataClasses.STRING);
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

              convertString(tokenizer.nextToken().trim());
            if (tokenizer.hasMoreTokens()) {
                resultString = convertString(tokenizer.nextToken().trim());
                Criteria crit;
                if (compareString == null) {
                  crit = new IsNullCriteria((Expression) exprs[0].clone());
                } else {
                  crit = new CompareCriteria((Expression) exprs[0].clone(), CompareCriteria.EQ, new Constant(compareString));
                }
                newWhens.add(crit);
                newThens.add(new Constant(resultString));
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

    private void helpTestMatch(String value, String pattern, char escape, boolean expectedMatch) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
        helpTestMatch(value, pattern, escape, false, expectedMatch);
    }
 
    private void helpTestIsNull(String value, boolean negated, boolean expectedMatch) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
        IsNullCriteria criteria = new IsNullCriteria(new Constant(value));
        criteria.setNegated(negated);
       
        boolean result = Evaluator.evaluate(criteria);
        assertEquals("Result did not match expected value", expectedMatch, result); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

            continue;
          }
          this.addCondition(i, (Constant)cc.getRightExpression(), cc.getOperator());
          critIter.remove();
        } else if (criteria instanceof IsNullCriteria) {
          IsNullCriteria inc = (IsNullCriteria)criteria;
          if (inc.isNegated() || !inc.getExpression().equals(keyColumn)) {
            continue;
          }
          this.addCondition(i, new Constant(null), CompareCriteria.EQ);
          critIter.remove();
        } else {
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

       
        nullNode.addGroup(getGroup(1));
        joinNode.addFirstChild(nullNode);
       
        PlanNode childCriteria = NodeFactory.getNewNode(NodeConstants.Types.SELECT);
        childCriteria.setProperty(Info.SELECT_CRITERIA, new IsNullCriteria(new Constant(1)));
        childCriteria.addGroup(getGroup(2));
        joinNode.addLastChild(childCriteria);
       
        PlanNode childJoinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
        childJoinNode.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_CROSS);
View Full Code Here

Examples of org.teiid.query.sql.lang.IsNullCriteria

      Expression ex = TestFunctionResolving.getExpression("1/convert('3.0', bigdecimal)");
      assertEquals(new BigDecimal("0.3333333333333333"), Evaluator.evaluate(ex));
    }
   
    @Test public void testIsNull() throws Exception {
      assertEquals(Boolean.TRUE, Evaluator.evaluate(new IsNullCriteria(new Constant(null, DataTypeManager.DefaultDataClasses.BOOLEAN))));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.