Java Code Examples for org.apache.calcite.sql.SqlFunctionCategory#SYSTEM

The following examples show how to use org.apache.calcite.sql.SqlFunctionCategory#SYSTEM . 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: SqlListAggFunction.java    From flink with Apache License 2.0 6 votes vote down vote up
public SqlListAggFunction() {
	super("LISTAGG",
			null,
			SqlKind.LISTAGG,
			ReturnTypes.ARG0_NULLABLE,
			null,
			OperandTypes.or(
					OperandTypes.CHARACTER,
					OperandTypes.sequence(
							"'LISTAGG(<CHARACTER>, <CHARACTER_LITERAL>)'",
							OperandTypes.CHARACTER,
							OperandTypes.and(OperandTypes.CHARACTER, OperandTypes.LITERAL)
					)),
			SqlFunctionCategory.SYSTEM,
			false,
			false);
}
 
Example 2
Source File: SqlDatePartOperator.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
public SqlDatePartOperator() {
  super(
      "DATE_PART",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.BIGINT_NULLABLE,
      null,
      OperandTypes.sequence(
          "<PERIOD LITERAL>, <DATE or TIMESTAMP or INTERVAL>",
          new EnumeratedListChecker(VALID_PERIODS.keySet()),
          OperandTypes.or(
              OperandTypes.family(SqlTypeFamily.DATE),
              OperandTypes.family(SqlTypeFamily.TIMESTAMP),
              OperandTypes.family(SqlTypeFamily.DATETIME),
              OperandTypes.family(SqlTypeFamily.DATETIME_INTERVAL),
              OperandTypes.family(SqlTypeFamily.INTERVAL_DAY_TIME),
              OperandTypes.family(SqlTypeFamily.INTERVAL_YEAR_MONTH))
          ),
          SqlFunctionCategory.SYSTEM);
}
 
Example 3
Source File: SqlJsonObjectAggAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
/** 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 4
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 5
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 6
Source File: SqlJsonValueFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlJsonValueFunction(String name, boolean returnAny) {
  super(name, SqlKind.OTHER_FUNCTION, null,
      (callBinding, returnType, operandTypes) -> {
        RelDataTypeFactory typeFactory = callBinding.getTypeFactory();
        for (int i = 0; i < operandTypes.length; ++i) {
          operandTypes[i] = typeFactory.createSqlType(SqlTypeName.ANY);
        }
      },
      null, SqlFunctionCategory.SYSTEM);
  this.returnAny = returnAny;
}
 
Example 7
Source File: SqlJsonObjectAggAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a SqlJsonObjectAggAggFunction. */
public SqlJsonObjectAggAggFunction(SqlKind kind,
    SqlJsonConstructorNullClause nullClause) {
  super(kind + "_" + nullClause.name(), null, kind, ReturnTypes.VARCHAR_2000,
      (callBinding, returnType, operandTypes) -> {
        RelDataTypeFactory typeFactory = callBinding.getTypeFactory();
        operandTypes[0] = typeFactory.createSqlType(SqlTypeName.VARCHAR);
        operandTypes[1] = typeFactory.createTypeWithNullability(
            typeFactory.createSqlType(SqlTypeName.ANY), true);
      }, OperandTypes.family(SqlTypeFamily.CHARACTER,
          SqlTypeFamily.ANY),
      SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN);
  this.nullClause = Objects.requireNonNull(nullClause);
}
 
Example 8
Source File: SqlCastFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlCastFunction() {
  super("CAST",
      SqlKind.CAST,
      null,
      InferTypes.FIRST_KNOWN,
      null,
      SqlFunctionCategory.SYSTEM);
}
 
Example 9
Source File: ProctimeMaterializeSqlFunction.java    From flink with Apache License 2.0 5 votes vote down vote up
public ProctimeMaterializeSqlFunction() {
	super(
		"PROCTIME_MATERIALIZE",
		SqlKind.OTHER_FUNCTION,
		ReturnTypes.cascade(
				ReturnTypes.explicit(SqlTypeName.TIMESTAMP, 3),
				SqlTypeTransforms.TO_NULLABLE),
		InferTypes.RETURN_TYPE,
		OperandTypes.family(SqlTypeFamily.TIMESTAMP),
		SqlFunctionCategory.SYSTEM);
}
 
Example 10
Source File: SqlCastFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlCastFunction() {
  super(
      "CAST",
      SqlKind.CAST,
      null,
      InferTypes.FIRST_KNOWN,
      null,
      SqlFunctionCategory.SYSTEM);
}
 
Example 11
Source File: SqlJsonArrayAggAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlJsonArrayAggAggFunction(SqlKind kind,
    SqlJsonConstructorNullClause nullClause) {
  super(kind + "_" + nullClause.name(), null, kind, ReturnTypes.VARCHAR_2000, null,
      OperandTypes.family(SqlTypeFamily.ANY), SqlFunctionCategory.SYSTEM,
      false, false, Optionality.OPTIONAL);
  this.nullClause = Objects.requireNonNull(nullClause);
}
 
Example 12
Source File: SqlCoalesceFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlCoalesceFunction() {
  // NOTE jvs 26-July-2006:  We fill in the type strategies here,
  // but normally they are not used because the validator invokes
  // rewriteCall to convert COALESCE into CASE early.  However,
  // validator rewrite can optionally be disabled, in which case these
  // strategies are used.
  super("COALESCE",
      SqlKind.COALESCE,
      ReturnTypes.cascade(ReturnTypes.LEAST_RESTRICTIVE,
          SqlTypeTransforms.LEAST_NULLABLE),
      null,
      OperandTypes.SAME_VARIADIC,
      SqlFunctionCategory.SYSTEM);
}
 
Example 13
Source File: SqlCoalesceFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlCoalesceFunction() {
  // NOTE jvs 26-July-2006:  We fill in the type strategies here,
  // but normally they are not used because the validator invokes
  // rewriteCall to convert COALESCE into CASE early.  However,
  // validator rewrite can optionally be disabled, in which case these
  // strategies are used.
  super("COALESCE",
      SqlKind.COALESCE,
      ReturnTypes.cascade(ReturnTypes.LEAST_RESTRICTIVE,
          SqlTypeTransforms.LEAST_NULLABLE),
      null,
      OperandTypes.SAME_VARIADIC,
      SqlFunctionCategory.SYSTEM);
}
 
Example 14
Source File: StreamRecordTimestampSqlFunction.java    From flink with Apache License 2.0 5 votes vote down vote up
public StreamRecordTimestampSqlFunction() {
	super(
		"STREAMRECORD_TIMESTAMP",
		SqlKind.OTHER_FUNCTION,
		ReturnTypes.explicit(SqlTypeName.BIGINT),
		InferTypes.RETURN_TYPE,
		OperandTypes.family(SqlTypeFamily.NUMERIC),
		SqlFunctionCategory.SYSTEM);
}
 
Example 15
Source File: SqlJsonExistsFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlJsonExistsFunction() {
  super("JSON_EXISTS", SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.BOOLEAN, SqlTypeTransforms.FORCE_NULLABLE), null,
      OperandTypes.or(
          OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.CHARACTER),
          OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.CHARACTER, SqlTypeFamily.ANY)),
      SqlFunctionCategory.SYSTEM);
}
 
Example 16
Source File: SqlStringContextVariable.java    From Bats with Apache License 2.0 4 votes vote down vote up
protected SqlStringContextVariable(String name) {
  super(name, ReturnTypes.VARCHAR_2000, SqlFunctionCategory.SYSTEM);
}
 
Example 17
Source File: SqlJsonExistsFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlJsonExistsFunction() {
  super("JSON_EXISTS", SqlKind.OTHER_FUNCTION,
      ReturnTypes.BOOLEAN_FORCE_NULLABLE, null,
      OperandTypes.or(OperandTypes.ANY, OperandTypes.ANY_ANY),
      SqlFunctionCategory.SYSTEM);
}
 
Example 18
Source File: SqlExtractFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlExtractFunction() {
  super("EXTRACT", SqlKind.EXTRACT, ReturnTypes.BIGINT_NULLABLE, null,
      OperandTypes.INTERVALINTERVAL_INTERVALDATETIME,
      SqlFunctionCategory.SYSTEM);
}
 
Example 19
Source File: SqlJsonArrayFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlJsonArrayFunction() {
  super("JSON_ARRAY", SqlKind.OTHER_FUNCTION, ReturnTypes.VARCHAR_2000, null,
      OperandTypes.VARIADIC, SqlFunctionCategory.SYSTEM);
}
 
Example 20
Source File: SqlGroupIdFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
SqlGroupIdFunction() {
  super("GROUP_ID", SqlKind.GROUP_ID, ReturnTypes.BIGINT, null,
      OperandTypes.NILADIC, SqlFunctionCategory.SYSTEM);
}