org.teiid.query.sql.lang.Query.getCriteria()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(423)

本文整理了Java中org.teiid.query.sql.lang.Query.getCriteria方法的一些代码示例,展示了Query.getCriteria的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getCriteria方法的具体详情如下:
包路径:org.teiid.query.sql.lang.Query
类名称:Query
方法名:getCriteria

Query.getCriteria介绍

[英]Get the criteria clause for the query.
[中]获取查询的criteria子句。

代码示例

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. public TupleSource processQuery(Query query, final VDBMetaData vdb, final TransformationMetadata metadata, final CommandContext cc) throws QueryMetadataException, TeiidComponentException {
  2. return new ExtractionTupleSource(query.getCriteria(), createIterator(vdb, metadata, cc), cc, vdb, metadata, this);
  3. }

代码示例来源:origin: org.teiid/teiid-engine

  1. public TupleSource processQuery(Query query, final VDBMetaData vdb, final TransformationMetadata metadata, final CommandContext cc) throws QueryMetadataException, TeiidComponentException {
  2. return new ExtractionTupleSource(query.getCriteria(), createIterator(vdb, metadata, cc), cc, vdb, metadata, this);
  3. }

代码示例来源:origin: teiid/teiid

  1. public TupleSource processQuery(Query query, final VDBMetaData vdb, final TransformationMetadata metadata, final CommandContext cc) throws QueryMetadataException, TeiidComponentException {
  2. return new ExtractionTupleSource(query.getCriteria(), createIterator(vdb, metadata, cc), cc, vdb, metadata, this);
  3. }

代码示例来源:origin: org.teiid/teiid-engine

  1. @Override
  2. public BaseIndexInfo<RecordTable<?>> planQuery(Query query,
  3. Criteria condition, CommandContext context) {
  4. BaseIndexInfo<RecordTable<?>> ii = schemaTable.planQuery(query, query.getCriteria(), context);
  5. ii.next = super.planQuery(query, ii.getNonCoveredCriteria(), context);
  6. return ii;
  7. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. @Override
  2. public BaseIndexInfo<RecordTable<?>> planQuery(Query query,
  3. Criteria condition, CommandContext context) {
  4. BaseIndexInfo<RecordTable<?>> ii = schemaTable.planQuery(query, query.getCriteria(), context);
  5. ii.next = super.planQuery(query, ii.getNonCoveredCriteria(), context);
  6. return ii;
  7. }

代码示例来源:origin: teiid/teiid

  1. @Override
  2. public BaseIndexInfo<RecordTable<?>> planQuery(Query query,
  3. Criteria condition, CommandContext context) {
  4. BaseIndexInfo<RecordTable<?>> ii = schemaTable.planQuery(query, query.getCriteria(), context);
  5. ii.next = super.planQuery(query, ii.getNonCoveredCriteria(), context);
  6. return ii;
  7. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. @Override
  2. public TupleSource processQuery(Query query, VDBMetaData vdb,
  3. TransformationMetadata metadata, CommandContext cc) {
  4. BaseIndexInfo<?> ii = baseTable.planQuery(query, query.getCriteria(), cc);
  5. final SimpleIterator<T> iter = baseTable.processQuery(vdb, metadata.getMetadataStore(), ii, metadata, cc);
  6. return new ExtractionTupleSource<T>(ii.getNonCoveredCriteria(), iter, cc, vdb, metadata, this);
  7. }

代码示例来源:origin: org.teiid/teiid-engine

  1. @Override
  2. public TupleSource processQuery(Query query, VDBMetaData vdb,
  3. TransformationMetadata metadata, CommandContext cc) {
  4. BaseIndexInfo<?> ii = baseTable.planQuery(query, query.getCriteria(), cc);
  5. final SimpleIterator<T> iter = baseTable.processQuery(vdb, metadata.getMetadataStore(), ii, metadata, cc);
  6. return new ExtractionTupleSource<T>(ii.getNonCoveredCriteria(), iter, cc, vdb, metadata, this);
  7. }

代码示例来源:origin: teiid/teiid

  1. @Override
  2. public TupleSource processQuery(Query query, VDBMetaData vdb,
  3. TransformationMetadata metadata, CommandContext cc) {
  4. BaseIndexInfo<?> ii = baseTable.planQuery(query, query.getCriteria(), cc);
  5. final SimpleIterator<T> iter = baseTable.processQuery(vdb, metadata.getMetadataStore(), ii, metadata, cc);
  6. return new ExtractionTupleSource<T>(ii.getNonCoveredCriteria(), iter, cc, vdb, metadata, this);
  7. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testUnlimitedIn() throws Exception {
  2. HardcodedDataManager dataManager = helpTestDependentJoin(true);
  3. Command c = dataManager.getCommandHistory().get(dataManager.getCommandHistory().size()-1);
  4. //it's expected that the pushed predicate will be marked as all constants
  5. assertTrue(((SetCriteria)((Query)c).getCriteria()).isAllConstants());
  6. }

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. @Override
  2. protected TupleSource createTupleSource()
  3. throws TeiidComponentException, TeiidProcessingException {
  4. TempTableStore tts = contextStore;
  5. TempTable tt = tts.getOrCreateTempTable(tableName, query, bufferManager, true, false, context, group);
  6. if (context.getDataObjects() != null) {
  7. Object id = RelationalPlanner.getTrackableGroup(group, context.getMetadata());
  8. if (id != null) {
  9. context.accessedDataObject(id);
  10. }
  11. }
  12. return tt.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
  13. }
  14. };

代码示例来源:origin: teiid/teiid

  1. @Test public void testDeepNesting() throws Exception {
  2. String sql = "select * from bqt1.smalla where exists (select intnum from bqt1.smalla x where smalla.intnum = x.intnum and exists (select intnum from bqt1.smalla where exists (select intnum from bqt1.smalla x where smalla.intnum = x.intnum)))";
  3. Command command = TestResolver.helpResolve(sql, RealMetadataFactory.exampleBQTCached());
  4. command = QueryRewriter.rewrite(command, RealMetadataFactory.exampleBQTCached(), null);
  5. command = ((ExistsCriteria)((Query)command).getCriteria()).getCommand();
  6. LinkedList<Reference> correlatedReferences = new LinkedList<Reference>();
  7. GroupSymbol gs = new GroupSymbol("bqt1.smalla");
  8. ResolverUtil.resolveGroup(gs, RealMetadataFactory.exampleBQTCached());
  9. CorrelatedReferenceCollectorVisitor.collectReferences(command, Arrays.asList(gs), correlatedReferences, RealMetadataFactory.exampleBQTCached());
  10. assertEquals(1, correlatedReferences.size());
  11. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testNationCharString2() throws Exception {
  2. Query query = (Query) QueryParser.getQueryParser().parseCommand("SELECT DISTINCT TABLE_QUALIFIER, NULL AS TABLE_OWNER, NULL AS TABLE_NAME, NULL AS TABLE_TYPE, NULL AS REMARKS FROM ATIODBCSYSTEM.OA_TABLES WHERE TABLE_QUALIFIER LIKE N'%' ESCAPE '\\' ORDER BY TABLE_QUALIFIER "); //$NON-NLS-1$
  3. MatchCriteria matchCrit = (MatchCriteria) query.getCriteria();
  4. Constant c = (Constant) matchCrit.getRightExpression();
  5. assertEquals(c, new Constant("%")); //$NON-NLS-1$
  6. }

代码示例来源:origin: teiid/teiid

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

代码示例来源:origin: teiid/teiid

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

代码示例来源:origin: teiid/teiid

  1. @Test public void testCharCompareString() {
  2. TransformationMetadata tm = RealMetadataFactory.exampleBQTCached().getDesignTimeMetadata();
  3. tm.setWidenComparisonToString(false);
  4. Command c = helpResolve("select * from bqt1.smalla where bqt1.smalla.charValue = 'a'", tm);
  5. Query q = (Query)c;
  6. assertTrue(((CompareCriteria)q.getCriteria()).getLeftExpression() instanceof ElementSymbol);
  7. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testNonAutoConversionOfLiteralIntegerToShort2() throws Exception {
  2. // parse
  3. Query command = (Query) QueryParser.getQueryParser().parseCommand("SELECT intkey FROM bqt1.smalla WHERE 5 = shortvalue"); //$NON-NLS-1$
  4. // resolve
  5. QueryResolver.resolveCommand(command, RealMetadataFactory.exampleBQTCached());
  6. // Check whether an implicit conversion was added on the correct side
  7. CompareCriteria crit = (CompareCriteria) command.getCriteria();
  8. assertEquals(DataTypeManager.DefaultDataClasses.SHORT, crit.getLeftExpression().getType());
  9. assertEquals("Sql is incorrect after resolving", "SELECT intkey FROM bqt1.smalla WHERE 5 = shortvalue", command.toString()); //$NON-NLS-1$ //$NON-NLS-2$
  10. }

代码示例来源:origin: teiid/teiid

  1. @Test public void testNonAutoConversionOfLiteralIntegerToShort() throws Exception {
  2. // parse
  3. Query command = (Query) QueryParser.getQueryParser().parseCommand("SELECT intkey FROM bqt1.smalla WHERE shortvalue = 5"); //$NON-NLS-1$
  4. // resolve
  5. QueryResolver.resolveCommand(command, RealMetadataFactory.exampleBQTCached());
  6. // Check whether an implicit conversion was added on the correct side
  7. CompareCriteria crit = (CompareCriteria) command.getCriteria();
  8. assertEquals(DataTypeManager.DefaultDataClasses.SHORT, crit.getRightExpression().getType());
  9. assertEquals("Sql is incorrect after resolving", "SELECT intkey FROM bqt1.smalla WHERE shortvalue = 5", command.toString()); //$NON-NLS-1$ //$NON-NLS-2$
  10. }

代码示例来源:origin: org.teiid/teiid-engine

  1. public void visit(Query obj) {
  2. preVisitVisitor(obj);
  3. visitNodes(obj.getWith());
  4. visitNode(obj.getSelect());
  5. visitNode(obj.getInto());
  6. visitNode(obj.getFrom());
  7. visitNode(obj.getCriteria());
  8. visitNode(obj.getGroupBy());
  9. visitNode(obj.getHaving());
  10. visitNode(obj.getOrderBy());
  11. visitNode(obj.getLimit());
  12. visitNode(obj.getOption());
  13. postVisitVisitor(obj);
  14. }
  15. public void visit(RaiseStatement obj) {

代码示例来源:origin: org.jboss.teiid/teiid-engine

  1. public void visit(Query obj) {
  2. preVisitVisitor(obj);
  3. visitNodes(obj.getWith());
  4. visitNode(obj.getSelect());
  5. visitNode(obj.getInto());
  6. visitNode(obj.getFrom());
  7. visitNode(obj.getCriteria());
  8. visitNode(obj.getGroupBy());
  9. visitNode(obj.getHaving());
  10. visitNode(obj.getOrderBy());
  11. visitNode(obj.getLimit());
  12. visitNode(obj.getOption());
  13. postVisitVisitor(obj);
  14. }
  15. public void visit(RaiseStatement obj) {

相关文章