Java Code Examples for org.apache.calcite.sql.type.SqlTypeTransforms

The following examples show how to use org.apache.calcite.sql.type.SqlTypeTransforms. These examples are extracted from open source projects. 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 Project: Bats   Source File: SqlCoalesceFunction.java    License: 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 2
Source Project: Bats   Source File: SqlJsonQueryFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonQueryFunction() {
  super("JSON_QUERY", SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.VARCHAR_2000,
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.family(SqlTypeFamily.ANY,
          SqlTypeFamily.ANY, SqlTypeFamily.ANY, SqlTypeFamily.ANY),
      SqlFunctionCategory.SYSTEM);
}
 
Example 3
Source Project: flink   Source File: ProctimeMaterializeSqlFunction.java    License: Apache License 2.0 5 votes vote down vote up
public ProctimeMaterializeSqlFunction() {
	super(
		"PROCTIME_MATERIALIZE",
		SqlKind.OTHER_FUNCTION,
		ReturnTypes.cascade(
				ReturnTypes.explicit(SqlTypeName.TIMESTAMP),
				SqlTypeTransforms.TO_NULLABLE),
		InferTypes.RETURN_TYPE,
		OperandTypes.family(SqlTypeFamily.TIMESTAMP),
		SqlFunctionCategory.SYSTEM);
}
 
Example 4
Source Project: flink   Source File: ProctimeMaterializeSqlFunction.java    License: 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 5
Source Project: calcite   Source File: SqlJsonDepthFunction.java    License: 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 6
Source Project: calcite   Source File: SqlRegexpReplaceFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlRegexpReplaceFunction() {
  super("REGEXP_REPLACE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.explicit(SqlTypeName.VARCHAR),
          SqlTypeTransforms.TO_NULLABLE),
      null,
      null,
      SqlFunctionCategory.STRING);
}
 
Example 7
Source Project: calcite   Source File: SqlJsonKeysFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonKeysFunction() {
  super("JSON_KEYS", SqlKind.OTHER_FUNCTION,
        ReturnTypes.cascade(ReturnTypes.VARCHAR_2000, SqlTypeTransforms.FORCE_NULLABLE),
        null,
        OperandTypes.or(OperandTypes.ANY,
            OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.CHARACTER)),
        SqlFunctionCategory.SYSTEM);
}
 
Example 8
Source Project: calcite   Source File: SqlJsonExistsFunction.java    License: 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 9
Source Project: calcite   Source File: SqlCoalesceFunction.java    License: 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 10
Source Project: calcite   Source File: SqlJsonQueryFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonQueryFunction() {
  super("JSON_QUERY", SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.VARCHAR_2000,
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.family(SqlTypeFamily.ANY,
          SqlTypeFamily.CHARACTER, SqlTypeFamily.ANY, SqlTypeFamily.ANY, SqlTypeFamily.ANY),
      SqlFunctionCategory.SYSTEM);
}
 
Example 11
Source Project: calcite   Source File: SqlJsonRemoveFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonRemoveFunction() {
  super("JSON_REMOVE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.VARCHAR_2000,
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      null,
      SqlFunctionCategory.SYSTEM);
}
 
Example 12
Source Project: calcite   Source File: SqlJsonPrettyFunction.java    License: 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 13
Source Project: calcite   Source File: SqlJsonValueFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonValueFunction(String name) {
  super(name, SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(
          opBinding -> explicitTypeSpec(opBinding).orElse(getDefaultType(opBinding)),
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.family(
          ImmutableList.of(SqlTypeFamily.ANY, SqlTypeFamily.CHARACTER),
          ordinal -> ordinal > 1),
      SqlFunctionCategory.SYSTEM);
}
 
Example 14
Source Project: calcite   Source File: SqlJsonStorageSizeFunction.java    License: 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 15
Source Project: calcite   Source File: SqlJsonTypeFunction.java    License: 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 16
Source Project: calcite   Source File: SqlJsonLengthFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlJsonLengthFunction() {
  super("JSON_LENGTH", SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.INTEGER,
          SqlTypeTransforms.FORCE_NULLABLE),
      null,
      OperandTypes.or(OperandTypes.ANY,
          OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.CHARACTER)),
      SqlFunctionCategory.SYSTEM);
}
 
Example 17
Source Project: calcite   Source File: SqlJsonValueExpressionOperator.java    License: Apache License 2.0 4 votes vote down vote up
public SqlJsonValueExpressionOperator() {
  super("FORMAT JSON", SqlKind.JSON_VALUE_EXPRESSION, 28,
      ReturnTypes.cascade(ReturnTypes.explicit(SqlTypeName.ANY),
          SqlTypeTransforms.TO_NULLABLE), null, OperandTypes.CHARACTER);
}