org.apache.calcite.sql.SqlIdentifier Java Examples

The following examples show how to use org.apache.calcite.sql.SqlIdentifier. 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 File: CalciteCatalogReader.java    From Bats with Apache License 2.0 6 votes vote down vote up
public void lookupOperatorOverloads(final SqlIdentifier opName,
    SqlFunctionCategory category,
    SqlSyntax syntax,
    List<SqlOperator> operatorList) {
  if (syntax != SqlSyntax.FUNCTION) {
    return;
  }

  final Predicate<Function> predicate;
  if (category == null) {
    predicate = function -> true;
  } else if (category.isTableFunction()) {
    predicate = function ->
        function instanceof TableMacro
            || function instanceof TableFunction;
  } else {
    predicate = function ->
        !(function instanceof TableMacro
            || function instanceof TableFunction);
  }
  getFunctionsFrom(opName.names)
      .stream()
      .filter(predicate)
      .map(function -> toOp(opName, function))
      .forEachOrdered(operatorList::add);
}
 
Example #2
Source File: DrillOperatorTable.java    From Bats with Apache License 2.0 6 votes vote down vote up
private void populateFromTypeInference(SqlIdentifier opName, SqlFunctionCategory category,
                                       SqlSyntax syntax, List<SqlOperator> operatorList) {
  final List<SqlOperator> calciteOperatorList = Lists.newArrayList();
  inner.lookupOperatorOverloads(opName, category, syntax, calciteOperatorList);
  if (!calciteOperatorList.isEmpty()) {
    for (SqlOperator calciteOperator : calciteOperatorList) {
      if (calciteToWrapper.containsKey(calciteOperator)) {
        operatorList.add(calciteToWrapper.get(calciteOperator));
      } else {
        operatorList.add(calciteOperator);
      }
    }
  } else {
    // if no function is found, check in Drill UDFs
    if (operatorList.isEmpty() && (syntax == SqlSyntax.FUNCTION || syntax == SqlSyntax.FUNCTION_ID) && opName.isSimple()) {
      List<SqlOperator> drillOps = drillOperatorsWithInferenceMap.get(opName.getSimple().toLowerCase());
      if (drillOps != null && !drillOps.isEmpty()) {
        operatorList.addAll(drillOps);
      }
    }
  }
}
 
Example #3
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) {
	// Resolve identifier as a table.
	final SqlValidatorScope.ResolvedImpl resolved =
		new SqlValidatorScope.ResolvedImpl();
	scope.resolveTable(id.names, catalogReader.nameMatcher(),
		SqlValidatorScope.Path.EMPTY, resolved);
	if (resolved.count() != 1) {
		throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString()));
	}
	// We've found a table. But is it a sequence?
	final SqlValidatorNamespace ns = resolved.only().namespace;
	if (ns instanceof TableNamespace) {
		final Table table = ns.getTable().unwrap(Table.class);
		switch (table.getJdbcTableType()) {
			case SEQUENCE:
			case TEMPORARY_SEQUENCE:
				return;
		}
	}
	throw newValidationError(id, RESOURCE.notASequence(id.toString()));
}
 
Example #4
Source File: StandardConvertletTable.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Converts a ROW.
 *
 * <p>Called automatically via reflection.
 */
public RexNode convertRow(
    SqlRexContext cx,
    SqlRowOperator op,
    SqlCall call) {
  if (cx.getValidator().getValidatedNodeType(call).getSqlTypeName()
      != SqlTypeName.COLUMN_LIST) {
    return convertCall(cx, call);
  }
  final RexBuilder rexBuilder = cx.getRexBuilder();
  final List<RexNode> columns = new ArrayList<>();
  for (SqlNode operand : call.getOperandList()) {
    columns.add(
        rexBuilder.makeLiteral(
            ((SqlIdentifier) operand).getSimple()));
  }
  final RelDataType type =
      rexBuilder.deriveReturnType(SqlStdOperatorTable.COLUMN_LIST, columns);
  return rexBuilder.makeCall(type, SqlStdOperatorTable.COLUMN_LIST, columns);
}
 
Example #5
Source File: MergeTableLikeUtil.java    From flink with Apache License 2.0 6 votes vote down vote up
private void appendDerivedWatermarks(
		Map<FeatureOption, MergingStrategy> mergingStrategies,
		List<SqlWatermark> derivedWatermarkSpecs) {
	for (SqlWatermark derivedWatermarkSpec : derivedWatermarkSpecs) {
		SqlIdentifier eventTimeColumnName = derivedWatermarkSpec.getEventTimeColumnName();

		HashMap<String, RelDataType> nameToTypeMap = new LinkedHashMap<>(physicalFieldNamesToTypes);
		nameToTypeMap.putAll(computedFieldNamesToTypes);
		verifyRowtimeAttribute(mergingStrategies, eventTimeColumnName, nameToTypeMap);
		String rowtimeAttribute = eventTimeColumnName.toString();

		SqlNode expression = derivedWatermarkSpec.getWatermarkStrategy();

		// this will validate and expand function identifiers.
		SqlNode validated = sqlValidator.validateParameterizedExpression(expression, nameToTypeMap);
		RelDataType validatedType = sqlValidator.getValidatedNodeType(validated);
		DataType exprDataType = fromLogicalToDataType(toLogicalType(validatedType));

		watermarkSpecs.put(rowtimeAttribute, new WatermarkSpec(
			rowtimeAttribute,
			escapeExpressions.apply(validated),
			exprDataType));
	}
}
 
Example #6
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override public SqlNode visit(SqlCall call) {
	SqlKind kind = call.getKind();
	if (isLogicalNavigation(kind)
		|| isAggregation(kind)
		|| isRunningOrFinal(kind)) {
		return call;
	}

	switch (kind) {
		case PREV:
			final List<SqlNode> operands = call.getOperandList();
			if (operands.get(0) instanceof SqlIdentifier) {
				String name = ((SqlIdentifier) operands.get(0)).names.get(0);
				return name.equals(alpha) ? call
					: SqlStdOperatorTable.LAST.createCall(SqlParserPos.ZERO, operands);
			}
	}
	return super.visit(call);
}
 
Example #7
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 6 votes vote down vote up
public void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) {
	// Resolve identifier as a table.
	final SqlValidatorScope.ResolvedImpl resolved =
		new SqlValidatorScope.ResolvedImpl();
	scope.resolveTable(id.names, catalogReader.nameMatcher(),
		SqlValidatorScope.Path.EMPTY, resolved);
	if (resolved.count() != 1) {
		throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString()));
	}
	// We've found a table. But is it a sequence?
	final SqlValidatorNamespace ns = resolved.only().namespace;
	if (ns instanceof TableNamespace) {
		final Table table = ns.getTable().unwrap(Table.class);
		switch (table.getJdbcTableType()) {
			case SEQUENCE:
			case TEMPORARY_SEQUENCE:
				return;
		}
	}
	throw newValidationError(id, RESOURCE.notASequence(id.toString()));
}
 
Example #8
Source File: SqlCreateView.java    From flink with Apache License 2.0 6 votes vote down vote up
public SqlCreateView(
		SqlParserPos pos,
		SqlIdentifier viewName,
		SqlNodeList fieldList,
		SqlNode query,
		boolean replace,
		boolean isTemporary,
		boolean ifNotExists,
		SqlCharStringLiteral comment,
		SqlNodeList properties) {
	super(OPERATOR, pos, replace, ifNotExists);
	this.viewName = requireNonNull(viewName, "viewName should not be null");
	this.fieldList = requireNonNull(fieldList, "fieldList should not be null");
	this.query = requireNonNull(query, "query should not be null");
	this.isTemporary = requireNonNull(isTemporary, "isTemporary should not be null");
	this.comment = comment;
	this.properties = properties;
}
 
Example #9
Source File: FlinkSqlParser.java    From sylph with Apache License 2.0 6 votes vote down vote up
/**
 * update having
 */
private static SqlNode updateOnlyOneFilter(SqlNode filterNode, String joinOutTableName)
{
    if (filterNode.getKind() == IDENTIFIER) {
        SqlIdentifier field = ((SqlIdentifier) filterNode);
        checkState(!field.isStar(), "filter field must not Star(*)");
        if (field.names.size() > 1) {
            field.setName(0, field.getComponent(0).getSimple());
            field.setName(1, joinOutTableName);
        }
        return field;
    }
    else if (filterNode instanceof SqlBasicCall) {  //demo: `user_id` = 'uid_1'
        SqlBasicCall sqlBasicCall = (SqlBasicCall) filterNode;
        for (int i = 0; i < sqlBasicCall.getOperandList().size(); i++) {
            SqlNode sqlNode = sqlBasicCall.getOperandList().get(i);
            SqlNode upNode = updateOnlyOneFilter(sqlNode, joinOutTableName);
            sqlBasicCall.getOperands()[i] = upNode;
        }
        return sqlBasicCall;
    }
    else {
        return filterNode;
    }
}
 
Example #10
Source File: CalciteParser.java    From kylin with Apache License 2.0 6 votes vote down vote up
public static void ensureNoAliasInExpr(String expr) {
    SqlNode sqlNode = getExpNode(expr);

    SqlVisitor sqlVisitor = new SqlBasicVisitor() {
        @Override
        public Object visit(SqlIdentifier id) {
            if (id.names.size() > 1) {
                throw new IllegalArgumentException(
                        "Column Identifier in the computed column expression should only contain COLUMN");
            }
            return null;
        }
    };

    sqlNode.accept(sqlVisitor);
}
 
Example #11
Source File: SqlQueryParser.java    From quark with Apache License 2.0 6 votes vote down vote up
/**
 * Strips namespace from identifiers of sql
 *
 * @param node
 * @param namespace
 * @param dialect
 * @return
 */
private String stripNamespace(final SqlNode node,
                              final String namespace,
                              final SqlDialect dialect) {
  final SqlNode transformedNode = node.accept(
      new SqlShuttle() {
        @Override
        public SqlNode visit(SqlIdentifier id) {
          if (id.names.size() > 1
              && id.names.get(0).toUpperCase().equals(namespace.toUpperCase())) {
            return id.getComponent(1, id.names.size());
          } else {
            return id;
          }
        }
      });
  String result = transformedNode.toSqlString(dialect).toString();
  return result.replace("\n", " ");
}
 
Example #12
Source File: SqlRefreshTable.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override public void setOperand(int i, SqlNode operand) {
  switch (i) {
    case 0:
      table = (SqlIdentifier) operand;
      break;
    case 1:
      deleteUnavail = (SqlLiteral) operand;
      break;
    case 2:
      forceUp = (SqlLiteral) operand;
      break;
    case 3:
      promotion = (SqlLiteral) operand;
      break;
    default:
      throw new AssertionError(i);
  }
}
 
Example #13
Source File: SqlCreateHiveView.java    From flink with Apache License 2.0 6 votes vote down vote up
public SqlCreateHiveView(SqlParserPos pos, SqlIdentifier viewName, SqlNodeList fieldList, SqlNode query,
		boolean ifNotExists, SqlCharStringLiteral comment, SqlNodeList properties) {
	super(
			pos,
			viewName,
			fieldList,
			query,
			false,
			false,
			ifNotExists,
			HiveDDLUtils.unescapeStringLiteral(comment),
			properties
	);
	HiveDDLUtils.unescapeProperties(properties);
	originPropList = new SqlNodeList(properties.getList(), properties.getParserPosition());
	// mark it as a hive view
	properties.add(HiveDDLUtils.toTableOption(CatalogConfig.IS_GENERIC, "false", pos));
}
 
Example #14
Source File: QuerySemantics.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
private static ASNode extractAS(SqlCall call) {
  if (call.getOperator().getKind() == SqlKind.AS) {
    List<SqlNode> operandList = call.getOperandList();
    if (operandList.size() == 2) {
      SqlNode exp = operandList.get(0);
      SqlNode colID = operandList.get(1);
      if (isSimpleID(colID)) {
        return new ASNode((SqlIdentifier)colID, exp);
      } else {
        throw new UnsupportedOperationException("Unexpected AS " + colID + "\n" + SqlNodes.toTreeString(call));
      }
    } else {
      throw new UnsupportedOperationException("Unexpected AS operands in field: \n" + SqlNodes.toTreeString(call));
    }
  }
  throw new UnsupportedOperationException("AS not understood: " + SqlNodes.toSQLString(call));
}
 
Example #15
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the <code>ordinal</code>th item in the select list.
 */
private SqlNode nthSelectItem(int ordinal, final SqlParserPos pos) {
	// TODO: Don't expand the list every time. Maybe keep an expanded
	// version of each expression -- select lists and identifiers -- in
	// the validator.

	SqlNodeList expandedSelectList =
		expandStar(
			select.getSelectList(),
			select,
			false);
	SqlNode expr = expandedSelectList.get(ordinal);
	expr = stripAs(expr);
	if (expr instanceof SqlIdentifier) {
		expr = getScope().fullyQualify((SqlIdentifier) expr).identifier;
	}

	// Create a copy of the expression with the position of the order
	// item.
	return expr.clone(pos);
}
 
Example #16
Source File: SqlAlterTableChangeColumn.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) {
  Preconditions.checkArgument(operands.length == 3, "SqlAlterTableChangeColumn.createCall() " +
      "has to get 3 operands!");

  return new SqlAlterTableChangeColumn(
      pos,
      (SqlIdentifier) operands[0],
      (SqlIdentifier) operands[1],
      (SqlColumnDeclaration) operands[2]);
}
 
Example #17
Source File: SqlTruncateTable.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public SqlTruncateTable(SqlParserPos pos, SqlIdentifier tableName, boolean tableExistenceCheck,
                        boolean tableKeywordPresent) {
  super(pos);
  this.tableName = tableName;
  this.tableExistenceCheck = tableExistenceCheck;
  this.tableKeywordPresent = tableKeywordPresent;
}
 
Example #18
Source File: CalciteCatalogReader.java    From Bats with Apache License 2.0 5 votes vote down vote up
/** Converts a function to a {@link org.apache.calcite.sql.SqlOperator}.
 *
 * <p>The {@code typeFactory} argument is technical debt; see [CALCITE-2082]
 * Remove RelDataTypeFactory argument from SqlUserDefinedAggFunction
 * constructor. */
private static SqlOperator toOp(RelDataTypeFactory typeFactory,
    SqlIdentifier name, final Function function) {
  List<RelDataType> argTypes = new ArrayList<>();
  List<SqlTypeFamily> typeFamilies = new ArrayList<>();
  for (FunctionParameter o : function.getParameters()) {
    final RelDataType type = o.getType(typeFactory);
    argTypes.add(type);
    typeFamilies.add(
        Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
  }
  final FamilyOperandTypeChecker typeChecker =
      OperandTypes.family(typeFamilies, i ->
          function.getParameters().get(i).isOptional());
  final List<RelDataType> paramTypes = toSql(typeFactory, argTypes);
  if (function instanceof ScalarFunction) {
    return new SqlUserDefinedFunction(name, infer((ScalarFunction) function),
        InferTypes.explicit(argTypes), typeChecker, paramTypes, function);
  } else if (function instanceof AggregateFunction) {
    return new SqlUserDefinedAggFunction(name,
        infer((AggregateFunction) function), InferTypes.explicit(argTypes),
        typeChecker, (AggregateFunction) function, false, false,
        Optionality.FORBIDDEN, typeFactory);
  } else if (function instanceof TableMacro) {
    return new SqlUserDefinedTableMacro(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableMacro) function);
  } else if (function instanceof TableFunction) {
    return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableFunction) function);
  } else {
    throw new AssertionError("unknown function type " + function);
  }
}
 
Example #19
Source File: SqlDdlNodes.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a PRIMARY KEY constraint. */
public static SqlKeyConstraint primary(SqlParserPos pos, SqlIdentifier name,
    SqlNodeList columnList) {
  return new SqlKeyConstraint(pos, name, columnList) {
    @Override public SqlOperator getOperator() {
      return PRIMARY;
    }
  };
}
 
Example #20
Source File: SqlForgetTable.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override public void setOperand(int i, SqlNode operand) {
  switch (i) {
    case 0:
      table = (SqlIdentifier) operand;
      break;
    default:
      throw new AssertionError(i);
  }
}
 
Example #21
Source File: SqlCreateFunction.java    From flink with Apache License 2.0 5 votes vote down vote up
public SqlCreateFunction(
		SqlParserPos pos,
		SqlIdentifier functionIdentifier,
		SqlCharStringLiteral functionClassName,
		String functionLanguage,
		boolean ifNotExists,
		boolean isTemporary,
		boolean isSystemFunction) {
	super(OPERATOR, pos, false, ifNotExists);
	this.functionIdentifier = requireNonNull(functionIdentifier);
	this.functionClassName = requireNonNull(functionClassName);
	this.isSystemFunction = isSystemFunction;
	this.isTemporary = isTemporary;
	this.functionLanguage = functionLanguage;
}
 
Example #22
Source File: SqlUserDefinedTableMacro.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlUserDefinedTableMacro(SqlIdentifier opName,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker, List<RelDataType> paramTypes,
    TableMacro tableMacro) {
  super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
      returnTypeInference, operandTypeInference, operandTypeChecker,
      Objects.requireNonNull(paramTypes),
      SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION);
  this.tableMacro = tableMacro;
}
 
Example #23
Source File: DrillCompoundIdentifier.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlNode getAsCompoundIdentifier() {
  List<String> names = Lists.newArrayListWithCapacity(ids.size());
  List<SqlParserPos> pos = Lists.newArrayListWithCapacity(ids.size());
  for (IdentifierHolder holder : ids) {
    names.add(holder.value);
    pos.add(holder.parserPos);
  }
  return new SqlIdentifier(names, null, pos.get(0), pos);
}
 
Example #24
Source File: SqlCreateTableConverter.java    From flink with Apache License 2.0 5 votes vote down vote up
private List<String> mergePartitions(
	List<String> sourcePartitionKeys,
	SqlNodeList derivedPartitionKeys,
	Map<SqlTableLike.FeatureOption, SqlTableLike.MergingStrategy> mergingStrategies) {
	// set partition key
	return mergeTableLikeUtil.mergePartitions(
		mergingStrategies.get(SqlTableLike.FeatureOption.PARTITIONS),
		sourcePartitionKeys,
		derivedPartitionKeys
			.getList()
			.stream()
			.map(p -> ((SqlIdentifier) p).getSimple())
			.collect(Collectors.toList()));
}
 
Example #25
Source File: DremioCatalogReader.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Rest of class is utility functions taken directly from CalciteCatalogReader. This is because that class consider these utilities to be private concerns.
 */
private SqlOperator toOp(SqlIdentifier name, final Function function) {
  List<RelDataType> argTypes = new ArrayList<>();
  List<SqlTypeFamily> typeFamilies = new ArrayList<>();
  for (FunctionParameter o : function.getParameters()) {
    final RelDataType type = o.getType(typeFactory);
    argTypes.add(type);
    typeFamilies.add(
        Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
  }
  final Predicate<Integer> optional =
      new Predicate<Integer>() {
        @Override
        public boolean apply(Integer input) {
          return function.getParameters().get(input).isOptional();
        }
      };
  final FamilyOperandTypeChecker typeChecker =
      OperandTypes.family(typeFamilies, optional);
  final List<RelDataType> paramTypes = toSql(argTypes);
  if (function instanceof ScalarFunction) {
    return new SqlUserDefinedFunction(name, infer((ScalarFunction) function),
        InferTypes.explicit(argTypes), typeChecker, paramTypes, function);
  } else if (function instanceof AggregateFunction) {
    return new SqlUserDefinedAggFunction(name,
        infer((AggregateFunction) function), InferTypes.explicit(argTypes),
        typeChecker, (AggregateFunction) function, false, false, typeFactory);
  } else if (function instanceof TableMacro) {
    return new SqlUserDefinedTableMacro(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableMacro) function);
  } else if (function instanceof TableFunction) {
    return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableFunction) function);
  } else {
    throw new AssertionError("unknown function type " + function);
  }
}
 
Example #26
Source File: QuerySemantics.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private static FromNode extractFrom(final SqlNode from) {
  return from.accept(new BaseSqlVisitor<FromNode>() {
    @Override
    public FromNode visit(SqlIdentifier id) {
      return new FromNode(null, id);
    }
    @Override
    public FromNode visit(SqlCall call) {
      SqlOperator operator = call.getOperator();
      switch (operator.getKind()) {
        case AS:
          ASNode as = extractAS(call);
          if (as.exp.getKind() == IDENTIFIER) {
            SqlIdentifier ref = (SqlIdentifier)as.exp;
            if (!as.alias.isSimple()) {
              throw new UnsupportedOperationException("Table aliasing not supported:\n" + SqlNodes.toTreeString(call));
            }
            return new FromNode(as.alias, ref);
          } else {
            throw new UnsupportedOperationException("Unexpected AS:\n" + SqlNodes.toTreeString(call));
          }
        default:
          throw new UnsupportedOperationException("Unexpected operator in call: " + operator.getKind() + "\n" + SqlNodes.toTreeString(call));
      }
    }
  });
}
 
Example #27
Source File: SqlCreateTable.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a SqlCreateTable. */
public SqlCreateTable(SqlParserPos pos, SqlIdentifier name,
    SqlNodeList columnList, SqlNode query) {
  super(OPERATOR, pos, false, false);
  this.name = Objects.requireNonNull(name);
  this.columnList = columnList; // may be null
  this.query = query; // for "CREATE TABLE ... AS query"; may be null
}
 
Example #28
Source File: SqlValidatorUtil.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlNode visit(SqlIdentifier id) {
  // First check for builtin functions which don't have parentheses,
  // like "LOCALTIME".
  final SqlCall call = SqlUtil.makeCall(getScope().getValidator().getOperatorTable(), id);
  if (call != null) {
    return call;
  }

  return getScope().fullyQualify(id).identifier;
}
 
Example #29
Source File: SqlCreateTable.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public SqlCall createCall(SqlLiteral functionQualifier, SqlParserPos pos, SqlNode... operands) {
  Preconditions.checkArgument(operands.length == 9, "SqlCreateTable.createCall() has to get 9 operands!");
  return new SqlCreateTable(
    pos,
    (SqlIdentifier) operands[0],
    (SqlNodeList) operands[1],
    ((SqlLiteral) operands[2]).symbolValue(PartitionDistributionStrategy.class),
    (SqlNodeList) operands[3],
    (SqlNodeList) operands[4],
    (SqlLiteral) operands[5],
    (SqlNodeList) operands[6],
    (SqlNodeList) operands[7],
    operands[8]);
}
 
Example #30
Source File: ChainedSqlOperatorTable.java    From calcite with Apache License 2.0 5 votes vote down vote up
public void lookupOperatorOverloads(SqlIdentifier opName,
    SqlFunctionCategory category, SqlSyntax syntax,
    List<SqlOperator> operatorList, SqlNameMatcher nameMatcher) {
  for (SqlOperatorTable table : tableList) {
    table.lookupOperatorOverloads(opName, category, syntax, operatorList,
        nameMatcher);
  }
}