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

The following examples show how to use org.apache.calcite.sql.type.SqlOperandTypeInference. 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: SqlFunctionalOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlFunctionalOperator(
    String name,
    SqlKind kind,
    int pred,
    boolean isLeftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      pred,
      isLeftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #2
Source File: SqlSetOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlSetOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean all,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      true,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
  this.all = all;
}
 
Example #3
Source File: SqlInternalOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlInternalOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean isLeftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      isLeftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #4
Source File: SqlPrefixOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlPrefixOperator(
    String name,
    SqlKind kind,
    int prec,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      leftPrec(prec, true),
      rightPrec(prec, true),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #5
Source File: SqlBinaryOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a SqlBinaryOperator.
 *
 * @param name                 Name of operator
 * @param kind                 Kind
 * @param prec                 Precedence
 * @param leftAssoc            Left-associativity
 * @param returnTypeInference  Strategy to infer return type
 * @param operandTypeInference Strategy to infer operand types
 * @param operandTypeChecker   Validator for operand types
 */
public SqlBinaryOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean leftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      leftPrec(prec, leftAssoc),
      rightPrec(prec, leftAssoc),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #6
Source File: SqlPostfixOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlPostfixOperator(
    String name,
    SqlKind kind,
    int prec,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      leftPrec(prec, true),
      rightPrec(prec, true),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #7
Source File: SqlInfixOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
protected SqlInfixOperator(
    String[] names,
    SqlKind kind,
    int precedence,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      names[0],
      kind,
      precedence,
      true,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
  assert names.length > 1;
  this.names = names;
}
 
Example #8
Source File: SqlMonotonicBinaryOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlMonotonicBinaryOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean isLeftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      isLeftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #9
Source File: SqlAggFunction.java    From Bats with Apache License 2.0 6 votes vote down vote up
/** Creates a built-in or user-defined SqlAggFunction or window function.
 *
 * <p>A user-defined function will have a value for {@code sqlIdentifier}; for
 * a built-in function it will be null. */
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType,
    boolean requiresOrder,
    boolean requiresOver,
    Optionality requiresGroupOrder) {
  super(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, null, funcType);
  this.requiresOrder = requiresOrder;
  this.requiresOver = requiresOver;
  this.requiresGroupOrder = Objects.requireNonNull(requiresGroupOrder);
}
 
Example #10
Source File: SqlFunction.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new SqlFunction for a call to a builtin function.
 *
 * @param name                 Name of builtin function
 * @param kind                 kind of operator implemented by function
 * @param returnTypeInference  strategy to use for return type inference
 * @param operandTypeInference strategy to use for parameter type inference
 * @param operandTypeChecker   strategy to use for parameter type checking
 * @param category             categorization for function
 */
public SqlFunction(
    String name,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory category) {
  // We leave sqlIdentifier as null to indicate
  // that this is a builtin.  Same for paramTypes.
  this(name, null, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, null, category);

  assert !((category == SqlFunctionCategory.USER_DEFINED_CONSTRUCTOR)
      && (returnTypeInference == null));
}
 
Example #11
Source File: SqlFunction.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Internal constructor.
 */
protected SqlFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    List<RelDataType> paramTypes,
    SqlFunctionCategory category) {
  super(name, kind, 100, 100, returnTypeInference, operandTypeInference,
      operandTypeChecker);

  this.sqlIdentifier = sqlIdentifier;
  this.category = Objects.requireNonNull(category);
  this.paramTypes =
      paramTypes == null ? null : ImmutableList.copyOf(paramTypes);
}
 
Example #12
Source File: SqlOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an operator.
 */
protected SqlOperator(
    String name,
    SqlKind kind,
    int leftPrecedence,
    int rightPrecedence,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  assert kind != null;
  this.name = name;
  this.kind = kind;
  this.leftPrec = leftPrecedence;
  this.rightPrec = rightPrecedence;
  this.returnTypeInference = returnTypeInference;
  this.operandTypeInference = operandTypeInference;
  this.operandTypeChecker = operandTypeChecker;
}
 
Example #13
Source File: SqlOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an operator specifying left/right associativity.
 */
protected SqlOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean leftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  this(
      name,
      kind,
      leftPrec(prec, leftAssoc),
      rightPrec(prec, leftAssoc),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #14
Source File: SqlFunctionalOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlFunctionalOperator(
    String name,
    SqlKind kind,
    int pred,
    boolean isLeftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      pred,
      isLeftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #15
Source File: SqlSpecialOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlSpecialOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean leftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      leftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #16
Source File: SqlSetOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlSetOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean all,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      true,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
  this.all = all;
}
 
Example #17
Source File: SqlInternalOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlInternalOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean isLeftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      isLeftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #18
Source File: SqlPostfixOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlPostfixOperator(
    String name,
    SqlKind kind,
    int prec,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      leftPrec(prec, true),
      rightPrec(prec, true),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #19
Source File: SqlBinaryOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a SqlBinaryOperator.
 *
 * @param name                 Name of operator
 * @param kind                 Kind
 * @param prec                 Precedence
 * @param leftAssoc            Left-associativity
 * @param returnTypeInference  Strategy to infer return type
 * @param operandTypeInference Strategy to infer operand types
 * @param operandTypeChecker   Validator for operand types
 */
public SqlBinaryOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean leftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      leftPrec(prec, leftAssoc),
      rightPrec(prec, leftAssoc),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #20
Source File: SqlInfixOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
protected SqlInfixOperator(
    String[] names,
    SqlKind kind,
    int precedence,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      names[0],
      kind,
      precedence,
      true,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
  assert names.length > 1;
  this.names = names;
}
 
Example #21
Source File: SqlMonotonicBinaryOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlMonotonicBinaryOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean isLeftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      isLeftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #22
Source File: SqlPrefixOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
public SqlPrefixOperator(
    String name,
    SqlKind kind,
    int prec,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      leftPrec(prec, true),
      rightPrec(prec, true),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #23
Source File: SqlAggFunction.java    From calcite with Apache License 2.0 6 votes vote down vote up
/** Creates a built-in or user-defined SqlAggFunction or window function.
 *
 * <p>A user-defined function will have a value for {@code sqlIdentifier}; for
 * a built-in function it will be null. */
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType,
    boolean requiresOrder,
    boolean requiresOver,
    Optionality requiresGroupOrder) {
  super(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, null, funcType);
  this.requiresOrder = requiresOrder;
  this.requiresOver = requiresOver;
  this.requiresGroupOrder = Objects.requireNonNull(requiresGroupOrder);
}
 
Example #24
Source File: SqlFunction.java    From calcite with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new SqlFunction for a call to a builtin function.
 *
 * @param name                 Name of builtin function
 * @param kind                 kind of operator implemented by function
 * @param returnTypeInference  strategy to use for return type inference
 * @param operandTypeInference strategy to use for parameter type inference
 * @param operandTypeChecker   strategy to use for parameter type checking
 * @param category             categorization for function
 */
public SqlFunction(
    String name,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory category) {
  // We leave sqlIdentifier as null to indicate
  // that this is a builtin.  Same for paramTypes.
  this(name, null, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, null, category);

  assert !((category == SqlFunctionCategory.USER_DEFINED_CONSTRUCTOR)
      && (returnTypeInference == null));
}
 
Example #25
Source File: SqlFunction.java    From calcite with Apache License 2.0 6 votes vote down vote up
/**
 * Internal constructor.
 */
protected SqlFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    List<RelDataType> paramTypes,
    SqlFunctionCategory category) {
  super(name, kind, 100, 100, returnTypeInference, operandTypeInference,
      operandTypeChecker);

  this.sqlIdentifier = sqlIdentifier;
  this.category = Objects.requireNonNull(category);
  this.paramTypes =
      paramTypes == null ? null : ImmutableList.copyOf(paramTypes);
}
 
Example #26
Source File: SqlOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an operator.
 */
protected SqlOperator(
    String name,
    SqlKind kind,
    int leftPrecedence,
    int rightPrecedence,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  assert kind != null;
  this.name = name;
  this.kind = kind;
  this.leftPrec = leftPrecedence;
  this.rightPrec = rightPrecedence;
  this.returnTypeInference = returnTypeInference;
  this.operandTypeInference = operandTypeInference;
  this.operandTypeChecker = operandTypeChecker;
}
 
Example #27
Source File: SqlOperator.java    From calcite with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an operator specifying left/right associativity.
 */
protected SqlOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean leftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  this(
      name,
      kind,
      leftPrec(prec, leftAssoc),
      rightPrec(prec, leftAssoc),
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #28
Source File: SqlSpecialOperator.java    From Bats with Apache License 2.0 6 votes vote down vote up
public SqlSpecialOperator(
    String name,
    SqlKind kind,
    int prec,
    boolean leftAssoc,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(
      name,
      kind,
      prec,
      leftAssoc,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker);
}
 
Example #29
Source File: SqlAggFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
/** Creates a user-defined SqlAggFunction. */
@Deprecated // to be removed before 2.0
protected SqlAggFunction(
    String name,
    SqlIdentifier sqlIdentifier,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType) {
  this(name, sqlIdentifier, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, funcType, false, false,
      Optionality.FORBIDDEN);
}
 
Example #30
Source File: SqlMonotonicUnaryFunction.java    From calcite with Apache License 2.0 5 votes vote down vote up
protected SqlMonotonicUnaryFunction(
    String name,
    SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker,
    SqlFunctionCategory funcType) {
  super(
      name,
      kind,
      returnTypeInference,
      operandTypeInference,
      operandTypeChecker,
      funcType);
}