Java Code Examples for org.apache.calcite.sql.SqlKind#OTHER_FUNCTION

The following examples show how to use org.apache.calcite.sql.SqlKind#OTHER_FUNCTION . 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: 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 2
Source File: SqlOperatorImpl.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public SqlOperatorImpl(String name, int argCountMin, int argCountMax, boolean isDeterministic,
    boolean isDynamic, SqlReturnTypeInference sqlReturnTypeInference, SqlSyntax syntax) {
  super(name,
    null,
    SqlKind.OTHER_FUNCTION,
    sqlReturnTypeInference,
    null,
    Checker.getChecker(argCountMin, argCountMax),
    null,
    SqlFunctionCategory.USER_DEFINED_FUNCTION);
  this.isDeterministic = isDeterministic;
  this.isDynamic = isDynamic;
  this.syntax = syntax;
}
 
Example 3
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 4
Source File: SqlOverlayFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlOverlayFunction() {
  super(
      "OVERLAY",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.DYADIC_STRING_SUM_PRECISION_NULLABLE_VARYING,
      null,
      OTC_CUSTOM,
      SqlFunctionCategory.STRING);
}
 
Example 5
Source File: SqlHistogramAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
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 6
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 7
Source File: SqlHistogramAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
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 8
Source File: SqlTranslate3Function.java    From Bats with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the SqlTranslate3Function.
 */
SqlTranslate3Function() {
  super("TRANSLATE3",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.ARG0_NULLABLE_VARYING,
      null,
      OperandTypes.STRING_STRING_STRING,
      SqlFunctionCategory.STRING);
}
 
Example 9
Source File: SqlUserDefinedAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a SqlUserDefinedAggFunction. */
public SqlUserDefinedAggFunction(SqlIdentifier opName,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker, AggregateFunction function,
    boolean requiresOrder, boolean requiresOver,
    Optionality requiresGroupOrder, RelDataTypeFactory typeFactory) {
  super(Util.last(opName.names), opName, SqlKind.OTHER_FUNCTION,
      returnTypeInference, operandTypeInference, operandTypeChecker,
      SqlFunctionCategory.USER_DEFINED_FUNCTION, requiresOrder, requiresOver,
      requiresGroupOrder);
  this.function = function;
  this.typeFactory = typeFactory;
}
 
Example 10
Source File: SqlRandFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlRandFunction() {
  super("RAND",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.DOUBLE,
      null,
      OperandTypes.or(OperandTypes.NILADIC, OperandTypes.NUMERIC),
      SqlFunctionCategory.NUMERIC);
}
 
Example 11
Source File: SqlConvertFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
protected SqlConvertFunction(String name) {
  super(
      name,
      SqlKind.OTHER_FUNCTION,
      null,
      null,
      null,
      SqlFunctionCategory.STRING);
}
 
Example 12
Source File: SqlRandFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlRandFunction() {
  super("RAND",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.DOUBLE,
      null,
      OperandTypes.or(OperandTypes.NILADIC, OperandTypes.NUMERIC),
      SqlFunctionCategory.NUMERIC);
}
 
Example 13
Source File: SqlCurrentDateFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlCurrentDateFunction() {
  super(
      "CURRENT_DATE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.DATE,
      null,
      OperandTypes.NILADIC,
      SqlFunctionCategory.TIMEDATE);
}
 
Example 14
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 15
Source File: MockSqlOperatorTable.java    From calcite with Apache License 2.0 5 votes vote down vote up
public DedupFunction() {
  super("DEDUP",
      SqlKind.OTHER_FUNCTION,
      null,
      null,
      OperandTypes.VARIADIC,
      SqlFunctionCategory.USER_DEFINED_FUNCTION);
}
 
Example 16
Source File: SqlBaseContextVariable.java    From Bats with Apache License 2.0 4 votes vote down vote up
/** Creates a SqlBaseContextVariable. */
protected SqlBaseContextVariable(String name,
    SqlReturnTypeInference returnType, SqlFunctionCategory category) {
  super(name, SqlKind.OTHER_FUNCTION, returnType, null, OperandTypes.NILADIC,
      category);
}
 
Example 17
Source File: MockSqlOperatorTable.java    From calcite with Apache License 2.0 4 votes vote down vote up
public MyAggFunc() {
  super("myAggFunc", null, SqlKind.OTHER_FUNCTION, ReturnTypes.BIGINT, null,
      OperandTypes.ONE_OR_MORE, SqlFunctionCategory.USER_DEFINED_FUNCTION, false, false,
      Optionality.FORBIDDEN);
}
 
Example 18
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 19
Source File: HiveSqlFunction.java    From marble with Apache License 2.0 4 votes vote down vote up
public HiveSqlFunction(String name,
    SqlReturnTypeInference returnTypeInference) {
  this(new SqlIdentifier(name, SqlParserPos.ZERO), SqlKind.OTHER_FUNCTION,
      returnTypeInference, SqlFunctionCategory.USER_DEFINED_FUNCTION);
}
 
Example 20
Source File: SqlAbstractTimeFunction.java    From calcite with Apache License 2.0 4 votes vote down vote up
protected SqlAbstractTimeFunction(String name, SqlTypeName typeName) {
  super(name, SqlKind.OTHER_FUNCTION, null, null, OTC_CUSTOM,
      SqlFunctionCategory.TIMEDATE);
  this.typeName = typeName;
}