Package org.teiid.query.sql.lang

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


        }
    }
   
    @Test public void testOpen_Defect16059() throws Exception {
      Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NULL", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
        IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
        nullCrit.setExpression(new Constant(null));
       
        helpTestOpen(query, "SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5", true); //$NON-NLS-1$
    }
View Full Code Here


        helpTestOpen(query, "SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5", true); //$NON-NLS-1$
    }
   
    @Test public void testOpen_Defect16059_2() throws Exception {
      Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NOT NULL", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
        IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
        nullCrit.setExpression(new Constant(null));
       
        helpTestOpen(query, null, false);
    }
View Full Code Here

     */
    Map<Expression, Expression> buildElementMap(Collection<Criteria> crits) {
        Map<Expression, Expression> srcToTgt = null;
        for (Criteria theCrit : crits) {
            if (theCrit instanceof IsNullCriteria) {
              IsNullCriteria isNull = (IsNullCriteria)theCrit;
              if (!isNull.isNegated() && isNull.getExpression() instanceof ElementSymbol) {
                if (srcToTgt == null) {
                  srcToTgt = new HashMap<Expression, Expression>();
                }
                srcToTgt.put(isNull.getExpression(), new Constant(null, isNull.getExpression().getType()));
              }
              continue;
            }
            if(!(theCrit instanceof CompareCriteria)) {
                continue;
View Full Code Here

      e1.setGroupSymbol(new GroupSymbol("g1"));
        Criteria crit = new SetCriteria(e1, Collections.EMPTY_LIST); //$NON-NLS-1$
       
        Criteria actual = QueryRewriter.rewriteCriteria(crit, null, null, null);
       
        IsNullCriteria inc = new IsNullCriteria(e1);
        inc.setNegated(true);
        assertEquals(inc, actual);
    }
View Full Code Here

          } else {
            if (agg.getAggregateFunction() == Type.COUNT) {
              if (agg.getExpression() == null) {
              projectedViewSymbols.add(new ExpressionSymbol("stagedAgg", new Constant(1))); //$NON-NLS-1$
              } else {
                SearchedCaseExpression count = new SearchedCaseExpression(Arrays.asList(new IsNullCriteria(agg.getExpression())), Arrays.asList(new Constant(Integer.valueOf(0))));
                count.setElseExpression(new Constant(Integer.valueOf(1)));
                count.setType(DataTypeManager.DefaultDataClasses.INTEGER);
              projectedViewSymbols.add(new ExpressionSymbol("stagedAgg", count)); //$NON-NLS-1$
              }
            } else { //min, max, sum
View Full Code Here

        Select select = new Select();
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Criteria crit = new IsNullCriteria(a);

        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(crit);
View Full Code Here

        Select select = new Select();
        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        IsNullCriteria crit = new IsNullCriteria(a);
        crit.setNegated(true);

        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(crit);
View Full Code Here

    Select select = new Select();
    ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
    select.addSymbol(a);

    Criteria crit = new NotCriteria(new IsNullCriteria(a));

    Query query = new Query();
    query.setSelect(select);
    query.setFrom(from);
    query.setCriteria(crit);
View Full Code Here

        CompareCriteria c2 = new CompareCriteria(new ElementSymbol("e2"), CompareCriteria.EQ, new Constant(new Integer(1))); //$NON-NLS-1$
        helpTestCompoundNonJoinCriteria("e2 = 1", c2);     //$NON-NLS-1$
    }
   
    @Test public void testCompoundNonJoinCriteriaInFromWithIsNull() {       
        helpTestCompoundNonJoinCriteria("e2 IS NULL", new IsNullCriteria(new ElementSymbol("e2")));     //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

    public TestIsNullCriteriaImpl(String name) {
        super(name);
    }

    public static IsNullCriteria helpExample(boolean negated) {
      IsNullCriteria crit = new IsNullCriteria(TestElementImpl.helpExample("vm1.g1", "e1")); //$NON-NLS-1$ //$NON-NLS-2$
        crit.setNegated(negated);
        return crit;
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.lang.IsNullCriteria

Copyright © 2018 www.massapicom. 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.