Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  <T> Optional<T> getArgumentValue(int pos, Class<T> clazz);

   /**

   * Returns the set of usages in this context.

   */

  default Set<ContextUsage> getUsages() {

    return Collections.emptySet();

  }

  /**

   * Return whether a function in an aggregate query with grouping columnsReturns the function's name usually referencing the function in a catalog.

   *

   * @return Returns true if the number of grouping columns greater than zero.

   * The other cases will return false.

   */

<p>Note: The name is meant for debugging purposes only.

   */

  String getName();

}

/**

* Provides details about the function call for {@link InputTypeValidator} and {@link TypeStrategy}.

*/

@PublicEvolving

public interface CallContext extends CallContextBase {  boolean hasGrouping();

  /**

   * Returns a resolved list of the functioncall's name usually referencing the function in a catalog.

   *

argument types. It also includes a type for every argument

   * in a vararg function call   * <p>Note: The name is meant for debugging purposes only.

   */

  String getNameList<DataType> getArgumentDataTypes();

}

/**

* Provides details about the function call for Characteristics that a {@link InputTypeValidator} and {@link TypeStrategy}.

*/

@PublicEvolving

CallContextBase} use.

*/

public enum ContextUsage {

  /**

   * Using grouping columns for aggregation, indicate the grouping size is greater than zero.

   */

  GROUPING_AGGREGATION,public interface CallContext extends CallContextBase {

  /**

   * Returns a resolved list of the call's argument types. It also includes a type for every argument   * in a vararg function callIndicate the function is an aggregate function with a filter.

   */

  List<DataType> getArgumentDataTypes();FILTERING_AGGREGATION

}

Introduce InputTypeStrategy

...

  1. Complete BuiltInFunctionDefinition and FunctionDefinition
    1. add standardSql field
    2. add isDeterministic field
    3. add monotonicity field
    4. add InputTypeStrategy to type inference
    5. CallContext support hasGroupingsupport ContextUsage.GROUPING_AGGREGATION
  2. Introduce wrappers
    1. Introduce SqlOperandTypeCheckerWrapper
    2. Introduce SqlReturnTypeInferenceWrapper
    3. Introduce SqlOperandTypeInferenceWrapper
    4. Introduce SqlFunctionWrapper
  3. Introduce ExpressionConverter (If no type inference implementation for function, still do PlannerExpression way)
    1. Support that standardSql field, directly convert to SqlFunction of SqlStdOperatorTable
    2. Support SqlFunctionWrapper
  4. Use new Expression in RexNodeToExpressionConverter instead of PlannerExpression. (for remove PlannerExpressions)
  5. Start rework BuiltInFunctionDefinitions, With the judge of ResolveCallByArgumentsRule and ExpressionConverter. (definition.getTypeInference().getOutputTypeStrategy() != TypeStrategies.MISSING), we can implement FunctionDefinition one by one and drop PlannerExpressions one by one.
    1. Introduce TypeStrategies: CascadeTypeStrategy, ExplicitTypeStrategy, OrdinalTypeStrategy, ChainTypeStrategy
    2. Introduce TypeTransformations: ToNullableTransformation, FORCE_NULLABLE, TO_VARYING
    3. Introduce InputTypeStrategies: FIRST_KNOWN, OUTPUT_TYPE, BOOLEAN
    4. Introduce InputTypeValidators: CompositeTypeValidator, AnyTypeValidator, PassingTypeValidator, TypeFamilyTypeValidator, TypeRootTypeValidator, SameTypeValidator.
    5. Implement type inference for logic functions. And introduce a testing infrastructure to verify flink type inference and calcite type inference. 
    6. Implement type inference for string functions.
    7. Implement type inference for math functions.
    8. Implement type inference for time functions.
    9. Implement type inference for other functions.
    10. Drop PlannerExpressions one by one.
    11. Apply things in blink-planner and add blink-planner extended functions

...