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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@Override
  protected TupleSource createTupleSource()
      throws TeiidComponentException, TeiidProcessingException {
    TempTableStore tts = contextStore;
    
    TempTable tt = tts.getOrCreateTempTable(tableName, query, bufferManager, true, false, context, group);
    if (context.getDataObjects() != null) {
      Object id = RelationalPlanner.getTrackableGroup(group, context.getMetadata());
      if (id != null) {
        context.accessedDataObject(id);
      }
    }
    return tt.createTupleSource(query.getProjectedSymbols(), query.getCriteria(), query.getOrderBy());
  }
};

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

@Test public void testDeepNesting() throws Exception {
  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)))";
  Command command = TestResolver.helpResolve(sql, RealMetadataFactory.exampleBQTCached());
  command = QueryRewriter.rewrite(command, RealMetadataFactory.exampleBQTCached(), null);
  command = ((ExistsCriteria)((Query)command).getCriteria()).getCommand();
  LinkedList<Reference> correlatedReferences = new LinkedList<Reference>();
  GroupSymbol gs = new GroupSymbol("bqt1.smalla");
  ResolverUtil.resolveGroup(gs, RealMetadataFactory.exampleBQTCached());
  CorrelatedReferenceCollectorVisitor.collectReferences(command, Arrays.asList(gs), correlatedReferences, RealMetadataFactory.exampleBQTCached());
  assertEquals(1, correlatedReferences.size());
}

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

@Test public void testNationCharString2() throws Exception {
  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$
  MatchCriteria matchCrit = (MatchCriteria) query.getCriteria();
  Constant c = (Constant) matchCrit.getRightExpression();
  assertEquals(c, new Constant("%")); //$NON-NLS-1$
}

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

@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", RealMetadataFactory.example1Cached()); //$NON-NLS-1$
  IsNullCriteria nullCrit = (IsNullCriteria)((CompoundCriteria)query.getCriteria()).getCriteria(1);
  nullCrit.setExpression(new Constant(null));
  
  helpTestOpen(query, null, false);
}

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

@Test public void testOpen_Defect16059() throws Exception {
  Query query = (Query)TestResolver.helpResolve("SELECT e1, e2 FROM pm1.g1 WHERE e2 = 5 AND ? IS NULL", RealMetadataFactory.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$
}

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

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

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

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

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

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

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

public void visit(Query obj) {
  preVisitVisitor(obj);
  visitNodes(obj.getWith());
  visitNode(obj.getSelect());
  visitNode(obj.getInto());
  visitNode(obj.getFrom());
  visitNode(obj.getCriteria());
  visitNode(obj.getGroupBy());
  visitNode(obj.getHaving());
  visitNode(obj.getOrderBy());
  visitNode(obj.getLimit());
  visitNode(obj.getOption());
  postVisitVisitor(obj);
}
public void visit(RaiseStatement obj) {

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

public void visit(Query obj) {
  preVisitVisitor(obj);
  visitNodes(obj.getWith());
  visitNode(obj.getSelect());
  visitNode(obj.getInto());
  visitNode(obj.getFrom());
  visitNode(obj.getCriteria());
  visitNode(obj.getGroupBy());
  visitNode(obj.getHaving());
  visitNode(obj.getOrderBy());
  visitNode(obj.getLimit());
  visitNode(obj.getOption());
  postVisitVisitor(obj);
}
public void visit(RaiseStatement obj) {

相关文章