use of org.apache.calcite.sql.SqlOperatorBinding in project calcite by apache.
the class CalciteCatalogReader method infer.
private static SqlReturnTypeInference infer(final ScalarFunction function) {
return new SqlReturnTypeInference() {
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
final RelDataType type;
if (function instanceof ScalarFunctionImpl) {
type = ((ScalarFunctionImpl) function).getReturnType(typeFactory, opBinding);
} else {
type = function.getReturnType(typeFactory);
}
return toSql(typeFactory, type);
}
};
}
use of org.apache.calcite.sql.SqlOperatorBinding in project calcite by apache.
the class CalciteCatalogReader method infer.
private static SqlReturnTypeInference infer(final AggregateFunction function) {
return new SqlReturnTypeInference() {
public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
final RelDataType type = function.getReturnType(typeFactory);
return toSql(typeFactory, type);
}
};
}
Aggregations