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

The following examples show how to use org.apache.calcite.sql.type.SqlTypeTransforms. 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: 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 #2
Source File: SqlJsonLengthFunction.java    From calcite with 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 #3
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 #4
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 #5
Source File: SqlJsonValueFunction.java    From calcite with 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 #6
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 #7
Source File: SqlJsonRemoveFunction.java    From calcite with 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 #8
Source File: SqlJsonQueryFunction.java    From calcite with 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 #9
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 #10
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 #11
Source File: SqlJsonKeysFunction.java    From calcite with 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 #12
Source File: SqlRegexpReplaceFunction.java    From calcite with 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 #13
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 #14
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 #15
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),
				SqlTypeTransforms.TO_NULLABLE),
		InferTypes.RETURN_TYPE,
		OperandTypes.family(SqlTypeFamily.TIMESTAMP),
		SqlFunctionCategory.SYSTEM);
}
 
Example #16
Source File: SqlJsonQueryFunction.java    From Bats with 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 #17
Source File: SqlJsonValueExpressionOperator.java    From calcite with 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);
}