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

The following examples show how to use org.apache.calcite.sql.type.SqlOperandTypeInference. 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: SqlSpecialOperator.java    License: 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 2
Source Project: Bats   Source File: SqlSetOperator.java    License: 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 Project: Bats   Source File: SqlInternalOperator.java    License: 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 Project: Bats   Source File: SqlPostfixOperator.java    License: 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 5
Source Project: Bats   Source File: SqlBinaryOperator.java    License: 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 Project: Bats   Source File: SqlInfixOperator.java    License: 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 7
Source Project: Bats   Source File: SqlMonotonicBinaryOperator.java    License: 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 8
Source Project: Bats   Source File: SqlPrefixOperator.java    License: 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 9
Source Project: Bats   Source File: SqlAggFunction.java    License: 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 Project: Bats   Source File: SqlFunction.java    License: 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 Project: Bats   Source File: SqlFunction.java    License: 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 Project: Bats   Source File: SqlOperator.java    License: 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 Project: Bats   Source File: SqlOperator.java    License: 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 Project: Bats   Source File: SqlFunctionalOperator.java    License: 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 Project: calcite   Source File: SqlSpecialOperator.java    License: 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 Project: calcite   Source File: SqlSetOperator.java    License: 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 Project: calcite   Source File: SqlInternalOperator.java    License: 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 Project: calcite   Source File: SqlPostfixOperator.java    License: 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 Project: calcite   Source File: SqlBinaryOperator.java    License: 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 Project: calcite   Source File: SqlInfixOperator.java    License: 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 Project: calcite   Source File: SqlMonotonicBinaryOperator.java    License: 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 Project: calcite   Source File: SqlPrefixOperator.java    License: 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 Project: calcite   Source File: SqlAggFunction.java    License: 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 Project: calcite   Source File: SqlFunction.java    License: 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 Project: calcite   Source File: SqlFunction.java    License: 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 Project: calcite   Source File: SqlOperator.java    License: 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 Project: calcite   Source File: SqlOperator.java    License: 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 Project: calcite   Source File: SqlFunctionalOperator.java    License: 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 29
Source Project: Bats   Source File: SqlGroupedWindowFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a SqlGroupedWindowFunction.
 *
 * @param name Function name
 * @param kind Kind
 * @param groupFunction Group function, if this is an auxiliary;
 *                      null, if this is a group 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 SqlGroupedWindowFunction(String name, SqlKind kind,
    SqlGroupedWindowFunction groupFunction,
    SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category) {
  super(name, kind, returnTypeInference, operandTypeInference,
      operandTypeChecker, category);
  this.groupFunction = groupFunction;
  Preconditions.checkArgument(groupFunction == null
      || groupFunction.groupFunction == null);
}
 
Example 30
Source Project: Bats   Source File: SqlAsOperator.java    License: Apache License 2.0 5 votes vote down vote up
protected SqlAsOperator(String name, SqlKind kind, int prec,
    boolean leftAssoc, SqlReturnTypeInference returnTypeInference,
    SqlOperandTypeInference operandTypeInference,
    SqlOperandTypeChecker operandTypeChecker) {
  super(name, kind, prec, leftAssoc, returnTypeInference,
      operandTypeInference, operandTypeChecker);
}