Java Code Examples for org.apache.calcite.util.Optionality#FORBIDDEN
The following examples show how to use
org.apache.calcite.util.Optionality#FORBIDDEN .
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: SqlMinMaxAggFunction.java From Bats with Apache License 2.0 | 6 votes |
/** Creates a SqlMinMaxAggFunction. */ public SqlMinMaxAggFunction(SqlKind kind) { super(kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.COMPARABLE_ORDERED, SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN); this.argTypes = ImmutableList.of(); this.minMaxKind = MINMAX_COMPARABLE; Preconditions.checkArgument(kind == SqlKind.MIN || kind == SqlKind.MAX); }
Example 2
Source File: SqlNtileAggFunction.java From Bats with Apache License 2.0 | 5 votes |
public SqlNtileAggFunction() { super( "NTILE", null, SqlKind.NTILE, ReturnTypes.RANK, null, OperandTypes.POSITIVE_INTEGER_LITERAL, SqlFunctionCategory.NUMERIC, false, true, Optionality.FORBIDDEN); }
Example 3
Source File: SqlSumAggFunction.java From Bats with Apache License 2.0 | 5 votes |
public SqlSumAggFunction(RelDataType type) { super( "SUM", null, SqlKind.SUM, ReturnTypes.AGG_SUM, null, OperandTypes.NUMERIC, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); this.type = type; }
Example 4
Source File: SqlAnyValueAggFunction.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a SqlAnyValueAggFunction. */ public SqlAnyValueAggFunction(SqlKind kind) { super(kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN); Preconditions.checkArgument(kind == SqlKind.ANY_VALUE); }
Example 5
Source File: SqlSingleValueAggFunction.java From calcite with Apache License 2.0 | 5 votes |
public SqlSingleValueAggFunction( RelDataType type) { super( "SINGLE_VALUE", null, SqlKind.SINGLE_VALUE, ReturnTypes.ARG0, null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN); this.type = type; }
Example 6
Source File: SqlSingleValueAggFunction.java From Bats with Apache License 2.0 | 5 votes |
public SqlSingleValueAggFunction( RelDataType type) { super( "SINGLE_VALUE", null, SqlKind.SINGLE_VALUE, ReturnTypes.ARG0, null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN); this.type = type; }
Example 7
Source File: CalciteCatalogReader.java From calcite with Apache License 2.0 | 5 votes |
/** 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 8
Source File: SqlBitOpAggFunction.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a SqlBitOpAggFunction. */ public SqlBitOpAggFunction(SqlKind kind) { super(kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.INTEGER, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); Preconditions.checkArgument(kind == SqlKind.BIT_AND || kind == SqlKind.BIT_OR); }
Example 9
Source File: SqlHistogramAggFunction.java From calcite with Apache License 2.0 | 5 votes |
public SqlHistogramAggFunction(RelDataType type) { super( "$HISTOGRAM", null, SqlKind.OTHER_FUNCTION, ReturnTypes.HISTOGRAM, null, OperandTypes.NUMERIC_OR_STRING, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); this.type = type; }
Example 10
Source File: SqlJsonObjectAggAggFunction.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a SqlJsonObjectAggAggFunction. */ public SqlJsonObjectAggAggFunction(SqlKind kind, SqlJsonConstructorNullClause nullClause) { super(kind + "_" + nullClause.name(), null, kind, ReturnTypes.VARCHAR_2000, null, OperandTypes.family(SqlTypeFamily.CHARACTER, SqlTypeFamily.ANY), SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN); this.nullClause = Objects.requireNonNull(nullClause); }
Example 11
Source File: SqlCovarAggFunction.java From calcite with Apache License 2.0 | 5 votes |
/** * Creates a SqlCovarAggFunction. */ public SqlCovarAggFunction(SqlKind kind) { super(kind.name(), null, kind, kind == SqlKind.REGR_COUNT ? ReturnTypes.BIGINT : ReturnTypes.COVAR_REGR_FUNCTION, null, OperandTypes.NUMERIC_NUMERIC, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); Preconditions.checkArgument(SqlKind.COVAR_AVG_AGG_FUNCTIONS.contains(kind), "unsupported sql kind: " + kind); }
Example 12
Source File: SqlFirstLastValueAggFunction.java From Bats with Apache License 2.0 | 5 votes |
public SqlFirstLastValueAggFunction(SqlKind kind) { super( kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.ANY, SqlFunctionCategory.NUMERIC, false, true, Optionality.FORBIDDEN); Preconditions.checkArgument(kind == SqlKind.FIRST_VALUE || kind == SqlKind.LAST_VALUE); }
Example 13
Source File: SqlFirstLastValueAggFunction.java From flink with Apache License 2.0 | 5 votes |
public SqlFirstLastValueAggFunction(SqlKind kind) { super( kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY, null, OperandTypes.ANY, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); Preconditions.checkArgument(kind == SqlKind.FIRST_VALUE || kind == SqlKind.LAST_VALUE); }
Example 14
Source File: SqlAggFunction.java From calcite with Apache License 2.0 | 5 votes |
@Deprecated // to be removed before 2.0 protected SqlAggFunction( String name, SqlIdentifier sqlIdentifier, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory funcType, boolean requiresOrder, boolean requiresOver) { this(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference, operandTypeChecker, funcType, requiresOrder, requiresOver, Optionality.FORBIDDEN); }
Example 15
Source File: SqlSumAggFunction.java From calcite with Apache License 2.0 | 5 votes |
public SqlSumAggFunction(RelDataType type) { super( "SUM", null, SqlKind.SUM, ReturnTypes.AGG_SUM, null, OperandTypes.NUMERIC, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); this.type = type; }
Example 16
Source File: SqlCountAggFunction.java From Bats with Apache License 2.0 | 4 votes |
public SqlCountAggFunction(String name, SqlOperandTypeChecker sqlOperandTypeChecker) { super(name, null, SqlKind.COUNT, ReturnTypes.BIGINT, null, sqlOperandTypeChecker, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); }
Example 17
Source File: BridgingSqlAggFunction.java From flink with Apache License 2.0 | 4 votes |
private static Optionality createGroupOrderRequirement() { return Optionality.FORBIDDEN; }
Example 18
Source File: PlannerTest.java From calcite with Apache License 2.0 | 4 votes |
public MyCountAggFunction() { super("MY_COUNT", null, SqlKind.OTHER_FUNCTION, ReturnTypes.BIGINT, null, OperandTypes.ANY, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); }
Example 19
Source File: SqlRankFunction.java From calcite with Apache License 2.0 | 4 votes |
public SqlRankFunction(SqlKind kind, SqlReturnTypeInference returnTypes, boolean requiresOrder) { super(kind.name(), null, kind, returnTypes, null, OperandTypes.NILADIC, SqlFunctionCategory.NUMERIC, requiresOrder, true, Optionality.FORBIDDEN); }
Example 20
Source File: SqlCountAggFunction.java From calcite with Apache License 2.0 | 4 votes |
public SqlCountAggFunction(String name, SqlOperandTypeChecker sqlOperandTypeChecker) { super(name, null, SqlKind.COUNT, ReturnTypes.BIGINT, null, sqlOperandTypeChecker, SqlFunctionCategory.NUMERIC, false, false, Optionality.FORBIDDEN); }