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

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

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

Query.getProjectedSymbols介绍

[英]Get the ordered list of all elements returned by this query. These elements may be ElementSymbols or ExpressionSymbols but in all cases each represents a single column.
[中]获取此查询返回的所有元素的有序列表。这些元素可能是元素符号或表达式符号,但在所有情况下,每个元素都代表一列。

代码示例

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

/**
 * @see org.teiid.query.sql.lang.Command#areResultsCachable()
 */
public boolean areResultsCachable() {
  if(this.getInto() != null){
    return false;
  }
  List<Expression> projectedSymbols = getProjectedSymbols();
  return areColumnsCachable(projectedSymbols);
}

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

/**
 * @see org.teiid.query.sql.lang.Command#areResultsCachable()
 */
public boolean areResultsCachable() {
  if(this.getInto() != null){
    return false;
  }
  List<Expression> projectedSymbols = getProjectedSymbols();
  return areColumnsCachable(projectedSymbols);
}

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

/**
 * @see org.teiid.query.sql.lang.Command#areResultsCachable()
 */
public boolean areResultsCachable() {
  if(this.getInto() != null){
    return false;
  }
  if (isXML) {
    return true;
  }
  List<Expression> projectedSymbols = getProjectedSymbols();
  return areColumnsCachable(projectedSymbols);
}

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

/**
 * Get the ordered list of all elements returned by this query.  These elements
 * may be ElementSymbols or ExpressionSymbols but in all cases each represents a 
 * single column.
 * @return Ordered list of SingleElementSymbol
 */
public List getProjectedSymbols() {
  Query query = getProjectedQuery();
  List projectedSymbols = query.getProjectedSymbols();
  if (projectedTypes != null) {
    return getTypedProjectedSymbols(projectedSymbols, projectedTypes, metadata);
  } 
  return projectedSymbols;
}

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

/**
 * Get the ordered list of all elements returned by this query.  These elements
 * may be ElementSymbols or ExpressionSymbols but in all cases each represents a 
 * single column.
 * @return Ordered list of SingleElementSymbol
 */
public List getProjectedSymbols() {
  Query query = getProjectedQuery();
  List projectedSymbols = query.getProjectedSymbols();
  if (projectedTypes != null) {
    return getTypedProjectedSymbols(projectedSymbols, projectedTypes, metadata);
  } 
  return projectedSymbols;
}

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

/**
 * Get the ordered list of all elements returned by this query.  These elements
 * may be ElementSymbols or ExpressionSymbols but in all cases each represents a 
 * single column.
 * @return Ordered list of SingleElementSymbol
 */
public List getProjectedSymbols() {
  Query query = getProjectedQuery();
  List projectedSymbols = query.getProjectedSymbols();
  if (projectedTypes != null) {
    return getTypedProjectedSymbols(projectedSymbols, projectedTypes, metadata);
  } 
  return projectedSymbols;
}

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

public void testQuery() {    
    Query q = sample3();
    
    List projList = new ArrayList();
    projList.add(new ElementSymbol("xml")); //$NON-NLS-1$
    
    assertEquals("result is not as expected.", //$NON-NLS-1$
      projList, 
      q.getProjectedSymbols());
  }
}

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

@Test public void testSelectAllOrder() {
  Query q = (Query)helpResolve("select * from pm1.g1, pm1.g2");
  assertEquals("[pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4]", q.getProjectedSymbols().toString());
  
  q = (Query)helpResolve("select * from pm1.g1 cross join pm1.g2");
  assertEquals("[pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4]", q.getProjectedSymbols().toString());
  
  q = (Query)helpResolve("select * from pm1.g1, pm1.g2 inner join pm1.g3 on (pm1.g2.e1 = pm1.g3.e1)");
  assertEquals("[pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4, pm1.g3.e1, pm1.g3.e2, pm1.g3.e3, pm1.g3.e4]", q.getProjectedSymbols().toString());
}

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

@Test public void testSelectAllOrderCommonTable() {
  Query q = (Query)helpResolve("with x as (select 1 y) select * from pm1.g1, pm1.g2");
  assertEquals("[pm1.g1.e1, pm1.g1.e2, pm1.g1.e3, pm1.g1.e4, pm1.g2.e1, pm1.g2.e2, pm1.g2.e3, pm1.g2.e4]", q.getProjectedSymbols().toString());
}

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

@Test public void testParamOrder() {
  Query resolvedQuery = (Query)helpResolve("SELECT * FROM (exec pm4.spRetOut()) as a", RealMetadataFactory.exampleBQTCached()); //$NON-NLS-1$
  
  assertEquals("a.ret", resolvedQuery.getProjectedSymbols().get(0).toString());
}

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

public static org.teiid.query.sql.symbol.ScalarSubquery helpExample() {
  Query query = TestQueryImpl.helpExample(true);
  org.teiid.query.sql.symbol.ScalarSubquery ss = new org.teiid.query.sql.symbol.ScalarSubquery(query);
  ss.setType(((Expression)query.getProjectedSymbols().get(0)).getType());
  return ss;
}

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

@Test public void testProcRelationalWithOutParam() {
  Query proc = (Query)helpResolve("select * from pm2.spTest8 where inkey = 1", RealMetadataFactory.exampleBQTCached());
  assertEquals(3, proc.getProjectedSymbols().size());
}

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

@Test public void testTrim() {
  Query query = (Query)helpResolve("select trim(e1) from pm1.g1");
  assertEquals(DataTypeManager.DefaultDataClasses.STRING, query.getProjectedSymbols().get(0).getType());
}

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

@Test public void testReferenceInSelect1() {
  String sql = "select convert(?, integer), e1 from pm1.g1"; //$NON-NLS-1$
  
  Query command = (Query)helpResolve(sql, RealMetadataFactory.example1Cached());
  assertEquals(DataTypeManager.DefaultDataClasses.INTEGER, command.getProjectedSymbols().get(0).getType());
}

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

@Test public void testReferenceInSelect() {
  String sql = "select ?, e1 from pm1.g1"; //$NON-NLS-1$
  Query command = (Query)helpResolve(sql, RealMetadataFactory.example1Cached());
  assertEquals(DataTypeManager.DefaultDataClasses.STRING, command.getProjectedSymbols().get(0).getType());
}

代码示例来源: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 testOrderBySymbolName() throws Exception {
  String sql = "select e1 from pm1.g1 order by e1"; //$NON-NLS-1$
  String expected = "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0"; //$NON-NLS-1$
  Query command = (Query)helpTest(sql, expected, true, false, RealMetadataFactory.example1Cached());
  assertEquals(((Symbol)command.getOrderBy().getSortKeys().get(0)).getName(), "c_0"); //$NON-NLS-1$
  assertEquals(((Symbol)command.getProjectedSymbols().get(0)).getShortName(), "c_0"); //$NON-NLS-1$
}

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

@Test public void testSubqueryAliasWithPeriod() throws Exception {
  String sql = "select \"pm1.g2\".x from (select 1 as x) as \"pm1.g2\"";
  Query query = (Query)helpResolve(sql);
  SubqueryFromClause sfc = (SubqueryFromClause)query.getFrom().getClauses().get(0);
  GroupSymbol gs = sfc.getGroupSymbol();
  assertEquals("pm1.g2", gs.getName());
  assertNull(gs.getDefinition());
  assertEquals("SELECT \"pm1.g2\".x FROM (SELECT 1 AS x) AS \"pm1.g2\"", query.toString());
  assertEquals("SELECT \"pm1.g2\".x FROM (SELECT 1 AS x) AS \"pm1.g2\"", query.clone().toString());
  assertEquals("[\"pm1.g2\".x]", query.getProjectedSymbols().toString());
}

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

@Test public void testTableAliasWithMultiplePeriods() throws Exception {
  String sql = "select \"pm1..g2\".e1 from pm1.g1 as \"pm1..g2\"";
  Query query = (Query)helpResolve(sql);
  UnaryFromClause ufc = (UnaryFromClause)query.getFrom().getClauses().get(0);
  GroupSymbol gs = ufc.getGroup();
  assertEquals("pm1..g2", gs.getName());
  assertEquals("pm1.g1", gs.getDefinition());
  assertEquals("SELECT \"pm1..g2\".e1 FROM pm1.g1 AS \"pm1..g2\"", query.toString());
  assertEquals("[\"pm1..g2\".e1]", query.getProjectedSymbols().toString());
}

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

@Test public void testTableAliasWithPeriod() throws Exception {
  String sql = "select \"pm1.g2\".*, e1, \"pm1.g2\".e2, pm1.g2.e2 from pm1.g1 as \"pm1.g2\"";
  Query query = (Query)helpResolve(sql);
  UnaryFromClause ufc = (UnaryFromClause)query.getFrom().getClauses().get(0);
  GroupSymbol gs = ufc.getGroup();
  assertEquals("pm1.g2", gs.getName());
  assertEquals("pm1.g1", gs.getDefinition());
  assertFalse(gs.isTempTable());
  assertEquals("SELECT \"pm1.g2\".*, e1, \"pm1.g2\".e2, \"pm1.g2\".e2 FROM pm1.g1 AS \"pm1.g2\"", query.toString());
  assertEquals("[\"pm1.g2\".e1, \"pm1.g2\".e2, \"pm1.g2\".e3, \"pm1.g2\".e4, e1, \"pm1.g2\".e2, \"pm1.g2\".e2]", query.getProjectedSymbols().toString());
}

相关文章