/** * Returns the row type of the table yielded by this function when * applied to given arguments. Only literal arguments are passed, * non-literal are replaced with default values (null, 0, false, etc). * * @param operandList arguments of a function call (only literal arguments * are passed, nulls for non-literal ones) * @return element type of the table (e.g. {@code Object[].class}) */ public Type getElementType(RelDataTypeFactory typeFactory, List<SqlNode> operandList) { List<Object> arguments = SqlUserDefinedTableMacro.convertArguments(typeFactory, operandList, function, getNameAsId(), false); return getFunction().getElementType(arguments); } }
if (operator instanceof SqlUserDefinedTableFunction) { SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) operator; elementType = udtf.getElementType(typeFactory, callBinding.operands()); } else { elementType = null;
(TableMacro) function); } else if (function instanceof TableFunction) { return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR, InferTypes.explicit(argTypes), typeChecker, paramTypes, (TableFunction) function);
private boolean isQueryable() { if (!(getCall() instanceof RexCall)) { return false; } final RexCall call = (RexCall) getCall(); if (!(call.getOperator() instanceof SqlUserDefinedTableFunction)) { return false; } final SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) call.getOperator(); if (!(udtf.getFunction() instanceof TableFunctionImpl)) { return false; } final TableFunctionImpl tableFunction = (TableFunctionImpl) udtf.getFunction(); final Method method = tableFunction.method; return QueryableTable.class.isAssignableFrom(method.getReturnType()); } }
public RelDataType validateImpl(RelDataType targetRowType) { validator.inferUnknownTypes(validator.unknownType, scope, call); final RelDataType type = validator.deriveTypeImpl(scope, call); final SqlOperator operator = call.getOperator(); final SqlCallBinding callBinding = new SqlCallBinding(validator, scope, call); if (operator instanceof SqlUserDefinedTableFunction) { assert type.getSqlTypeName() == SqlTypeName.CURSOR : "User-defined table function should have CURSOR type, not " + type; final SqlUserDefinedTableFunction udf = (SqlUserDefinedTableFunction) operator; return udf.getRowType(validator.typeFactory, callBinding.operands()); } else if (operator instanceof SqlUserDefinedTableMacro) { assert type.getSqlTypeName() == SqlTypeName.CURSOR : "User-defined table macro should have CURSOR type, not " + type; final SqlUserDefinedTableMacro udf = (SqlUserDefinedTableMacro) operator; return udf.getTable(validator.typeFactory, callBinding.operands()) .getRowType(validator.typeFactory); } return type; }
if (operator instanceof SqlUserDefinedTableFunction) { SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) operator; elementType = udtf.getElementType(typeFactory, callBinding.operands()); } else { elementType = null;
(TableMacro) function); } else if (function instanceof TableFunction) { return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR, InferTypes.explicit(argTypes), typeChecker, paramTypes, (TableFunction) function);
private boolean isQueryable() { if (!(getCall() instanceof RexCall)) { return false; } final RexCall call = (RexCall) getCall(); if (!(call.getOperator() instanceof SqlUserDefinedTableFunction)) { return false; } final SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) call.getOperator(); if (!(udtf.getFunction() instanceof TableFunctionImpl)) { return false; } final TableFunctionImpl tableFunction = (TableFunctionImpl) udtf.getFunction(); final Method method = tableFunction.method; return QueryableTable.class.isAssignableFrom(method.getReturnType()); } }
public RelDataType validateImpl(RelDataType targetRowType) { validator.inferUnknownTypes(validator.unknownType, scope, call); final RelDataType type = validator.deriveTypeImpl(scope, call); final SqlOperator operator = call.getOperator(); final SqlCallBinding callBinding = new SqlCallBinding(validator, scope, call); if (operator instanceof SqlUserDefinedTableFunction) { assert type.getSqlTypeName() == SqlTypeName.CURSOR : "User-defined table function should have CURSOR type, not " + type; final SqlUserDefinedTableFunction udf = (SqlUserDefinedTableFunction) operator; return udf.getRowType(validator.typeFactory, callBinding.operands()); } else if (operator instanceof SqlUserDefinedTableMacro) { assert type.getSqlTypeName() == SqlTypeName.CURSOR : "User-defined table macro should have CURSOR type, not " + type; final SqlUserDefinedTableMacro udf = (SqlUserDefinedTableMacro) operator; return udf.getTable(validator.typeFactory, callBinding.operands()) .getRowType(validator.typeFactory); } return type; }
/** * Returns the record type of the table yielded by this function when * applied to given arguments. Only literal arguments are passed, * non-literal are replaced with default values (null, 0, false, etc). * * @param typeFactory Type factory * @param operandList arguments of a function call (only literal arguments * are passed, nulls for non-literal ones) * @return row type of the table */ public RelDataType getRowType(RelDataTypeFactory typeFactory, List<SqlNode> operandList) { List<Object> arguments = SqlUserDefinedTableMacro.convertArguments(typeFactory, operandList, function, getNameAsId(), false); return getFunction().getRowType(typeFactory, arguments); }
if (operator instanceof SqlUserDefinedTableFunction) { SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) operator; elementType = udtf.getElementType(typeFactory, callBinding.operands()); } else { elementType = null;
(TableMacro) function); } else if (function instanceof TableFunction) { return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR, InferTypes.explicit(argTypes), typeChecker, paramTypes, (TableFunction) function);
/** * Returns the record type of the table yielded by this function when * applied to given arguments. Only literal arguments are passed, * non-literal are replaced with default values (null, 0, false, etc). * * @param typeFactory Type factory * @param operandList arguments of a function call (only literal arguments * are passed, nulls for non-literal ones) * @return row type of the table */ public RelDataType getRowType(RelDataTypeFactory typeFactory, List<SqlNode> operandList) { List<Object> arguments = SqlUserDefinedTableMacro.convertArguments(typeFactory, operandList, function, getNameAsId(), false); return getFunction().getRowType(typeFactory, arguments); }
if (operator instanceof SqlUserDefinedTableFunction) { SqlUserDefinedTableFunction udtf = (SqlUserDefinedTableFunction) operator; elementType = udtf.getElementType(typeFactory, callBinding.operands()); } else { elementType = null;
/** * Returns the row type of the table yielded by this function when * applied to given arguments. Only literal arguments are passed, * non-literal are replaced with default values (null, 0, false, etc). * * @param operandList arguments of a function call (only literal arguments * are passed, nulls for non-literal ones) * @return element type of the table (e.g. {@code Object[].class}) */ public Type getElementType(RelDataTypeFactory typeFactory, List<SqlNode> operandList) { List<Object> arguments = SqlUserDefinedTableMacro.convertArguments(typeFactory, operandList, function, getNameAsId(), false); return getFunction().getElementType(arguments); } }