Package org.teiid.query.sql.lang

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


     * TODO: it would be good to have a hint to force
     */
  private PlanNode planMergeJoin(PlanNode current, PlanNode root, AnalysisRecord analysisRecord) throws QueryMetadataException,
      TeiidComponentException {
    float sourceCost = NewCalculateCostUtil.computeCostForTree(current.getFirstChild(), metadata);
    Criteria crit = (Criteria)current.getProperty(NodeConstants.Info.SELECT_CRITERIA);
   
    PlannedResult plannedResult = findSubquery(crit);
    if (plannedResult.query == null) {
      return current;
    }
View Full Code Here


    Set<SingleElementSymbol> requiredExpressions = new LinkedHashSet<SingleElementSymbol>();
    final SymbolMap refs = plannedResult.query.getCorrelatedReferences();
    boolean addGroupBy = false;
    if (refs != null) {
      boolean hasAggregates = plannedResult.query.hasAggregates();
      Criteria where = plannedResult.query.getCriteria();
      if (plannedResult.query.getGroupBy() == null) {
        plannedResult.query.setCriteria(null);
      }
      Criteria having = plannedResult.query.getHaving();
      plannedResult.query.setHaving(null);
      if (hasCorrelatedReferences(plannedResult.query, refs)) {
        return false;
      }
      if (plannedResult.query.getGroupBy() == null) {
View Full Code Here

      return;
    }
    List<Criteria> crits = Criteria.separateCriteriaByAnd((Criteria)joinCriteria.clone());

    for (Iterator<Criteria> critIter = crits.iterator(); critIter.hasNext();) {
      Criteria conjunct = critIter.next();
      List<SingleElementSymbol> aggregates = new LinkedList<SingleElementSymbol>();
      List<SingleElementSymbol> elements = new LinkedList<SingleElementSymbol>();
      AggregateSymbolCollectorVisitor.getAggregates(conjunct, aggregates, elements);
      ReferenceReplacementVisitor emv = new ReferenceReplacementVisitor(refs);
      DeepPostOrderNavigator.doVisit(conjunct, emv);
View Full Code Here

     */
    private void validateAccessPatterns(PlanNode node) throws QueryPlannerException {
        if (!node.hasCollectionProperty(NodeConstants.Info.ACCESS_PATTERNS)) {
            return;
        }
        Criteria criteria = null;
        if(node.hasProperty(NodeConstants.Info.ATOMIC_REQUEST) ) {
            Object req = node.getProperty(NodeConstants.Info.ATOMIC_REQUEST);
            if(req instanceof Insert) {
                return;
            }
View Full Code Here

        if ((joinType == JoinType.JOIN_LEFT_OUTER || joinType == JoinType.JOIN_RIGHT_OUTER)
                        && outerGroups.containsAll(critNode.getGroups())) {
            return null;
        }
       
        Criteria crit = (Criteria)critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);

        boolean isNullDepdendent = isNullDependent(metadata, innerGroups, crit);
       
        JoinType result = JoinType.JOIN_INNER;
       
View Full Code Here

     *  given all null values for elements in the inner groups
     */
    public static boolean isNullDependent(QueryMetadataInterface metadata,
                                            final Collection<GroupSymbol> innerGroups,
                                            Criteria crit) {
        Criteria simplifiedCrit = (Criteria)replaceWithNullValues(innerGroups, crit);
        try {
            simplifiedCrit = QueryRewriter.rewriteCriteria(simplifiedCrit, null, null, metadata);
        } catch (TeiidException err) {
            //log the exception
            return true;
        }
        return !(simplifiedCrit.equals(QueryRewriter.FALSE_CRITERIA) || simplifiedCrit.equals(QueryRewriter.UNKNOWN_CRITERIA));
    }
View Full Code Here

        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("CriteriaSelector does not match: ", expectedSelector, actualSelector);              //$NON-NLS-1$
    }
 
    private void helpCriteriaTest(String crit, String expectedString, Criteria expectedCrit) throws QueryParserException {
        Criteria actualCrit = QueryParser.getQueryParser().parseCriteria(crit);
        String actualString = actualCrit.toString();
        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("Criteria does not match: ", expectedCrit, actualCrit);              //$NON-NLS-1$
    }
View Full Code Here

    select.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
   
    GroupBy groupBy = new GroupBy();
    groupBy.addSymbol(new ElementSymbol("a")); //$NON-NLS-1$
   
    Criteria having = new CompareCriteria(
      new AggregateSymbol("count", "COUNT", false, new ElementSymbol("b", false)), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      CompareCriteria.GT,
      new Constant(new Integer(0)) );
       
    Query query = new Query();
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);

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

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

TOP

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

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.