/** * @see org.teiid.query.processor.relational.AccessNode#hasNextCommand() */ protected boolean hasNextCommand() { return criteriaProcessor.hasNextCommand(); }
/** * @see org.teiid.query.processor.relational.AccessNode#close() */ public void closeDirect() { super.closeDirect(); if (criteriaProcessor != null) { criteriaProcessor.close(); } }
this.criteriaProcessor = new DependentCriteriaProcessor(this.maxSetSize, this.maxPredicates, this, query.getCriteria()); this.criteriaProcessor.setPushdown(pushdown); this.criteriaProcessor.setUseBindings(useBindings); this.criteriaProcessor.setComplexQuery(complexQuery); dependentCrit = criteriaProcessor.prepareCriteria(); if (sort && query.getOrderBy() != null && criteriaProcessor.hasNextCommand()) { declineSort(); criteriaProcessor.consumedCriteria();
@Test public void testNegatedSetCriteria() throws Exception { DependentAccessNode dan = new DependentAccessNode(0); SetCriteria sc = new SetCriteria(new ElementSymbol("e1"), Arrays.asList(new Constant(1), new Constant(2))); //$NON-NLS-1$ sc.setAllConstants(true); sc.negate(); DependentCriteriaProcessor dcp = new DependentCriteriaProcessor(1, -1, dan, sc); Criteria result = dcp.prepareCriteria(); assertEquals(sc, result); assertFalse(dcp.hasNextCommand()); }
replaceDependentValueIterators(); crits.add((Criteria)queryCriteria.get(i).clone()); } else { Criteria crit = replaceDependentCriteria((AbstractSetCriteria)queryCriteria.get(i), state); if (crit == QueryRewriter.FALSE_CRITERIA) { return QueryRewriter.FALSE_CRITERIA;
orCrits.add(new CompareCriteria(crit.getExpression(), CompareCriteria.EQ, newConstant(iter.next()))); } else { List<Constant> vals = new ArrayList<Constant>(Math.min(state.replacement.size(), setSize)); vals.add(newConstant(val));
this.criteriaProcessor = new DependentCriteriaProcessor(this.maxSetSize, this.maxPredicates, this, query.getCriteria()); this.criteriaProcessor.setPushdown(pushdown); this.criteriaProcessor.setUseBindings(useBindings); this.criteriaProcessor.setComplexQuery(complexQuery); dependentCrit = criteriaProcessor.prepareCriteria(); if (sort && query.getOrderBy() != null && criteriaProcessor.hasNextCommand()) { declineSort(); criteriaProcessor.consumedCriteria();
@Test public void testSetCriteria() throws Exception { DependentAccessNode dan = new DependentAccessNode(0); SetCriteria sc = new SetCriteria(new ElementSymbol("e1"), Arrays.asList(new Constant(1), new Constant(2))); //$NON-NLS-1$ sc.setAllConstants(true); DependentCriteriaProcessor dcp = new DependentCriteriaProcessor(1, -1, dan, sc); Criteria result = dcp.prepareCriteria(); assertEquals(new CompareCriteria(new ElementSymbol("e1"), CompareCriteria.EQ, new Constant(1)), result); //$NON-NLS-1$ assertTrue(dcp.hasNextCommand()); }
replaceDependentValueIterators(); Criteria crit = replaceDependentCriteria((AbstractSetCriteria)criteria, state); if (crit == QueryRewriter.FALSE_CRITERIA) { return QueryRewriter.FALSE_CRITERIA;
for (SetState state : source) { if (!isNull) { Constant constant = newConstant(state.nextValue, state.valueExpression); if (state.existingSet == null || state.existingSet.getValues().contains(constant)) { state.replacement.add(constant);
this.criteriaProcessor = new DependentCriteriaProcessor(this.maxSetSize, this.maxPredicates, this, query.getCriteria()); this.criteriaProcessor.setPushdown(pushdown); this.criteriaProcessor.setUseBindings(useBindings); this.criteriaProcessor.setComplexQuery(complexQuery); dependentCrit = criteriaProcessor.prepareCriteria(); if (sort && query.getOrderBy() != null && criteriaProcessor.hasNextCommand()) { declineSort(); criteriaProcessor.consumedCriteria();
@Test public void testEvaluatedSetCriteria() throws Exception { DependentAccessNode dan = new DependentAccessNode(0); CommandContext cc = new CommandContext(); dan.setContext(cc); List<Reference> references = Arrays.asList(new Reference(1), new Reference(2)); for (Reference reference : references) { cc.getVariableContext().setGlobalValue(reference.getContextSymbol(), 1); } SetCriteria sc = new SetCriteria(new ElementSymbol("e1"), references); //$NON-NLS-1$ sc.setAllConstants(true); DependentCriteriaProcessor dcp = new DependentCriteriaProcessor(1, -1, dan, sc); Criteria result = dcp.prepareCriteria(); assertEquals(new CompareCriteria(new ElementSymbol("e1"), CompareCriteria.EQ, new Constant(1)), result); //$NON-NLS-1$ assertFalse(dcp.hasNextCommand()); }
replaceDependentValueIterators(); Criteria crit = replaceDependentCriteria((AbstractSetCriteria)criteria, state); if (crit == QueryRewriter.FALSE_CRITERIA) { return QueryRewriter.FALSE_CRITERIA;
/** * @see org.teiid.query.processor.relational.AccessNode#hasNextCommand() */ protected boolean hasNextCommand() { return criteriaProcessor.hasNextCommand(); }
/** * @see org.teiid.query.processor.relational.AccessNode#close() */ public void closeDirect() { super.closeDirect(); if (criteriaProcessor != null) { criteriaProcessor.close(); } }
for (SetState state : source) { if (!isNull) { Constant constant = newConstant(state.nextValue, state.valueExpression); if (state.existingSet == null || state.existingSet.getValues().contains(constant)) { state.replacement.add(constant);
/** * @see org.teiid.query.processor.relational.AccessNode#hasNextCommand() */ protected boolean hasNextCommand() { return criteriaProcessor.hasNextCommand(); }
/** * @see org.teiid.query.processor.relational.AccessNode#close() */ public void closeDirect() { super.closeDirect(); if (criteriaProcessor != null) { criteriaProcessor.close(); } }