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

The following examples show how to use org.apache.calcite.sql.SqlFunctionCategory#NUMERIC . 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: SqlBitOpAggFunction.java    From calcite with Apache License 2.0 6 votes vote down vote up
/** Creates a SqlBitOpAggFunction. */
public SqlBitOpAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.INTEGER,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.BIT_AND
      || kind == SqlKind.BIT_OR
      || kind == SqlKind.BIT_XOR);
}
 
Example 2
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 3
Source File: SqlAvgAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
SqlAvgAggFunction(String name, SqlKind kind) {
  super(name,
      null,
      kind,
      ReturnTypes.AVG_AGG_FUNCTION,
      null,
      OperandTypes.NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(SqlKind.AVG_AGG_FUNCTIONS.contains(kind),
      "unsupported sql kind");
}
 
Example 4
Source File: SqlSumEmptyIsZeroAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlSumEmptyIsZeroAggFunction() {
  super("$SUM0",
      null,
      SqlKind.SUM0,
      ReturnTypes.AGG_SUM_EMPTY_IS_ZERO,
      null,
      OperandTypes.NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
}
 
Example 5
Source File: SqlFirstLastValueAggFunction.java    From flink 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,
			false,
			Optionality.FORBIDDEN);
	Preconditions.checkArgument(kind == SqlKind.FIRST_VALUE
			|| kind == SqlKind.LAST_VALUE);
}
 
Example 6
Source File: SqlSumAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlSumAggFunction(RelDataType type) {
  super(
      "SUM",
      null,
      SqlKind.SUM,
      ReturnTypes.AGG_SUM,
      null,
      OperandTypes.NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  this.type = type;
}
 
Example 7
Source File: SqlLeadLagAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlLeadLagAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      RETURN_TYPE,
      null,
      OPERAND_TYPES,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.LEAD
      || kind == SqlKind.LAG);
}
 
Example 8
Source File: SqlRandIntegerFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlRandIntegerFunction() {
  super("RAND_INTEGER",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.INTEGER,
      null,
      OperandTypes.or(OperandTypes.NUMERIC, OperandTypes.NUMERIC_NUMERIC),
      SqlFunctionCategory.NUMERIC);
}
 
Example 9
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 10
Source File: SqlFloorFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlFloorFunction(SqlKind kind) {
  super(kind.name(), kind, ReturnTypes.ARG0_OR_EXACT_NO_SCALE, null,
      OperandTypes.or(OperandTypes.NUMERIC_OR_INTERVAL,
          OperandTypes.sequence(
              "'" + kind + "(<DATE> TO <TIME_UNIT>)'\n"
              + "'" + kind + "(<TIME> TO <TIME_UNIT>)'\n"
              + "'" + kind + "(<TIMESTAMP> TO <TIME_UNIT>)'",
              OperandTypes.DATETIME,
              OperandTypes.ANY)),
      SqlFunctionCategory.NUMERIC);
  Preconditions.checkArgument(kind == SqlKind.FLOOR || kind == SqlKind.CEIL);
}
 
Example 11
Source File: SqlNtileAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlNtileAggFunction() {
  super(
      "NTILE",
      null,
      SqlKind.NTILE,
      ReturnTypes.RANK,
      null,
      OperandTypes.POSITIVE_INTEGER_LITERAL,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
}
 
Example 12
Source File: SqlFirstLastValueAggFunction.java    From Bats 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 13
Source File: SqlCovarAggFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a SqlCovarAggFunction.
 */
public SqlCovarAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      kind == SqlKind.REGR_COUNT ? ReturnTypes.BIGINT : ReturnTypes.COVAR_REGR_FUNCTION,
      null,
      OperandTypes.NUMERIC_NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(SqlKind.COVAR_AVG_AGG_FUNCTIONS.contains(kind),
      "unsupported sql kind: " + kind);
}
 
Example 14
Source File: SqlPositionFunction.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlPositionFunction() {
  super(
      "POSITION",
      SqlKind.POSITION,
      ReturnTypes.INTEGER_NULLABLE,
      null,
      OTC_CUSTOM,
      SqlFunctionCategory.NUMERIC);
}
 
Example 15
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 16
Source File: SqlCovarAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a SqlCovarAggFunction.
 */
public SqlCovarAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      kind == SqlKind.REGR_COUNT ? ReturnTypes.BIGINT : ReturnTypes.COVAR_REGR_FUNCTION,
      null,
      OperandTypes.NUMERIC_NUMERIC,
      SqlFunctionCategory.NUMERIC,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(SqlKind.COVAR_AVG_AGG_FUNCTIONS.contains(kind),
      "unsupported sql kind: " + kind);
}
 
Example 17
Source File: SqlNtileAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlNtileAggFunction() {
  super(
      "NTILE",
      null,
      SqlKind.NTILE,
      ReturnTypes.RANK,
      null,
      OperandTypes.POSITIVE_INTEGER_LITERAL,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
}
 
Example 18
Source File: SqlCountAggFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlCountAggFunction(String name,
    SqlOperandTypeChecker sqlOperandTypeChecker) {
  super(name, null, SqlKind.COUNT, ReturnTypes.BIGINT, null,
      sqlOperandTypeChecker, SqlFunctionCategory.NUMERIC, false, false,
      Optionality.FORBIDDEN);
}
 
Example 19
Source File: SqlNthValueAggFunction.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlNthValueAggFunction(SqlKind kind) {
  super(kind.name(), null, kind, ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null, OperandTypes.ANY_NUMERIC, SqlFunctionCategory.NUMERIC, false,
      true, Optionality.FORBIDDEN);
}
 
Example 20
Source File: SqlCountAggFunction.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlCountAggFunction(String name,
    SqlOperandTypeChecker sqlOperandTypeChecker) {
  super(name, null, SqlKind.COUNT, ReturnTypes.BIGINT, null,
      sqlOperandTypeChecker, SqlFunctionCategory.NUMERIC, false, false,
      Optionality.FORBIDDEN);
}