Java Code Examples for org.apache.calcite.sql.SqlAsOperator

The following examples show how to use org.apache.calcite.sql.SqlAsOperator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: samza   Source File:    License: Apache License 2.0 6 votes vote down vote up
private static void getSource(SqlNode node, ArrayList<String> sourceList) {
  if (node instanceof SqlJoin) {
    SqlJoin joinNode = (SqlJoin) node;
    ArrayList<String> sourcesLeft = new ArrayList<>();
    ArrayList<String> sourcesRight = new ArrayList<>();
    getSource(joinNode.getLeft(), sourcesLeft);
    getSource(joinNode.getRight(), sourcesRight);

  } else if (node instanceof SqlIdentifier) {
  } else if (node instanceof SqlBasicCall) {
    SqlBasicCall basicCall = (SqlBasicCall) node;
    if (basicCall.getOperator() instanceof SqlAsOperator) {
      getSource(basicCall.operand(0), sourceList);
    } else if (basicCall.getOperator() instanceof SqlUnnestOperator && basicCall.operand(0) instanceof SqlSelect) {
  } else if (node instanceof SqlSelect) {
    getSource(((SqlSelect) node).getFrom(), sourceList);
Example 2
Source Project: flink   Source File:    License: Apache License 2.0 5 votes vote down vote up
private SqlNode tableColumn(String name, SqlNode expression) {
	return new SqlBasicCall(
		new SqlAsOperator(),
		new SqlNode[]{expression, identifier(name)},
Example 3
Source Project: alchemy   Source File:    License: Apache License 2.0 4 votes vote down vote up
private static SqlNode createNewFrom(String table, String alias, SqlNode from) {
    SqlIdentifier identifierFirst = new SqlIdentifier(table, from.getParserPosition());
    SqlIdentifier identifierSecond = new SqlIdentifier(alias, from.getParserPosition());
    return new SqlBasicCall(new SqlAsOperator(), new SqlNode[] {identifierFirst, identifierSecond}, from.getParserPosition());