Java Code Examples for org.apache.calcite.sql.type.OperandTypes#ANY

The following examples show how to use org.apache.calcite.sql.type.OperandTypes#ANY . 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: SqlJsonStorageSizeFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlJsonStorageSizeFunction() {
  super("JSON_STORAGE_SIZE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.INTEGER,
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM);
}
 
Example 2
Source File: SqlAnyValueAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** 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 3
Source File: ClassRowTypeCache.java    From mat-calcite-plugin with Apache License 2.0 5 votes vote down vote up
public RexNode apply(RexBuilderContext context) {
	RelOptCluster cluster = context.getCluster();
	RelDataTypeFactory typeFactory = cluster.getTypeFactory();
	final SqlFunction UDF =
			new SqlUserDefinedFunction(
					new SqlIdentifier("TO_REFERENCE", SqlParserPos.ZERO),
					ReturnTypes.explicit(typeFactory.createJavaType(HeapReference.class)),
					null,
					OperandTypes.ANY,
					ImmutableList.of(typeFactory.createTypeWithNullability(typeFactory.createJavaType(IObject.class), false)),
					ScalarFunctionImpl.create(ISnapshotMethods.class, "toReference")
			);
	return context.getBuilder().makeCall(UDF, context.getIObject());
}
 
Example 4
Source File: SqlJsonPrettyFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlJsonPrettyFunction() {
  super("JSON_PRETTY",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.VARCHAR_2000,
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM);
}
 
Example 5
Source File: SqlCursorConstructor.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlCursorConstructor() {
  super(
      "CURSOR",
      SqlKind.CURSOR, MDX_PRECEDENCE,
      false,
      ReturnTypes.CURSOR,
      null,
      OperandTypes.ANY);
}
 
Example 6
Source File: SqlJsonTypeFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlJsonTypeFunction() {
  super("JSON_TYPE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(
          ReturnTypes.explicit(SqlTypeName.VARCHAR, 20),
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM);
}
 
Example 7
Source File: SqlAuxiliaryGroupAggFunction.java    From flink with Apache License 2.0 5 votes vote down vote up
public SqlAuxiliaryGroupAggFunction() {
	super("AUXILIARY_GROUP",
			null,
			SqlKind.OTHER_FUNCTION,
			ReturnTypes.ARG0,
			null,
			OperandTypes.ANY,
			SqlFunctionCategory.SYSTEM,
			false,
			false);
}
 
Example 8
Source File: SqlAnyValueAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
/** 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 9
Source File: SqlJsonPrettyFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlJsonPrettyFunction() {
  super("JSON_PRETTY",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.VARCHAR_2000, SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM);
}
 
Example 10
Source File: SqlJsonDepthFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlJsonDepthFunction() {
  super("JSON_DEPTH",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.INTEGER,
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM);
}
 
Example 11
Source File: SqlColumnListConstructor.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlColumnListConstructor() {
  super(
      "COLUMN_LIST",
      SqlKind.COLUMN_LIST, MDX_PRECEDENCE,
      false,
      ReturnTypes.COLUMN_LIST,
      null,
      OperandTypes.ANY);
}
 
Example 12
Source File: HyperLogLog.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public SqlHllAggFunction() {
  super("HLL",
    null,
    SqlKind.OTHER_FUNCTION,
    ReturnTypes.explicit(SqlTypeName.VARBINARY, HLL_VARBINARY_SIZE),
    null,
    OperandTypes.ANY,
    SqlFunctionCategory.USER_DEFINED_FUNCTION,
    false,
    false
  );
}
 
Example 13
Source File: SqlFirstLastValueAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
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 14
Source File: SqlLateralOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlLateralOperator(SqlKind kind) {
  super(kind.name(), kind, 200, true, ReturnTypes.ARG0, null,
      OperandTypes.ANY);
}
 
Example 15
Source File: SqlCountAggFunction.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlCountAggFunction(String name) {
  this(name, CalciteSystemProperty.STRICT.value() ? OperandTypes.ANY : OperandTypes.ONE_OR_MORE);
}
 
Example 16
Source File: SqlNullTreatmentOperator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlNullTreatmentOperator(SqlKind kind) {
  super(kind.sql, kind, 20, true, ReturnTypes.ARG0, null, OperandTypes.ANY);
  Preconditions.checkArgument(kind == SqlKind.RESPECT_NULLS
      || kind == SqlKind.IGNORE_NULLS);
}
 
Example 17
Source File: SqlCollectionTableOperator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlCollectionTableOperator(String name, SqlModality modality) {
  super(name, SqlKind.COLLECTION_TABLE, 200, true, ReturnTypes.ARG0, null,
      OperandTypes.ANY);
  this.modality = modality;
}
 
Example 18
Source File: PlannerTest.java    From calcite with Apache License 2.0 4 votes vote down vote up
public MyCountAggFunction() {
  super("MY_COUNT", null, SqlKind.OTHER_FUNCTION, ReturnTypes.BIGINT, null,
      OperandTypes.ANY, SqlFunctionCategory.NUMERIC, false, false,
      Optionality.FORBIDDEN);
}
 
Example 19
Source File: SqlCountAggFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlCountAggFunction(String name) {
  this(name, CalciteSystemProperty.STRICT.value() ? OperandTypes.ANY : OperandTypes.ONE_OR_MORE);
}
 
Example 20
Source File: PigRelSqlUdfs.java    From calcite with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a generic SqlUDF operator from a Pig UDF.
 *
 * @param udfName Name of the UDF
 * @param method Method "exec" for implementing the UDF
 * @param funcSpec Pig Funcspec
 * @param inputType Argument type for the input
 * @param returnType Function return data type
 */
static SqlUserDefinedFunction createGeneralPigUdf(String udfName,
    Method method, FuncSpec funcSpec, RelDataType inputType,
    RelDataType returnType) {
  return new PigUserDefinedFunction(udfName, opBinding -> returnType,
      OperandTypes.ANY, Collections.singletonList(inputType),
      ScalarFunctionImpl.createUnsafe(method), funcSpec);
}