[ 
https://issues.apache.org/jira/browse/CALCITE-1073?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-1073:
---------------------------------
    Description: 
RelBuilder should validate function arguments. For example, if you try to 
create a call to SUBSTRING, RelBuilder should make sure that the arguments are 
of type VARCHAR (or CHAR), INTEGER, INTEGER.

Usually calls are validated using {{SqlValidator.validateCall}}, which 
delegates to the following policies inside the operator:

{code}
  private final SqlReturnTypeInference returnTypeInference;
  private final SqlOperandTypeInference operandTypeInference;
  private final SqlOperandTypeChecker operandTypeChecker;
{code}

There isn’t a SqlValidator accessible to RelBuilder, but I think we can somehow 
make RelBuilder call into the policies.

Also note that SqlOperandTypeChecker was intended for ASTs (SqlNode), and in 
SqlNode format the arguments are sometimes different (e.g. CAST has 2 arguments 
in SqlNode format and only one in RexNode format), so we'll have to fix up.

RelBuilder should also insert implicit casts, and should resolve overloaded 
operators. 

  was:
RelBuilder should validate function arguments. For example, if you try to 
create a call to SUBSTRING, RelBuilder should make sure that the arguments are 
of type VARCHAR (or CHAR), INTEGER, INTEGER.

SqlOperator has the means to validate itself, but it's a bit tricky to use it, 
because those means were intended for ASTs (SqlNode). In SqlNode format the 
arguments are sometimes different (e.g. CAST has 2 arguments in SqlNode format 
and only one in RexNode format).

RelBuilder should also insert implicit casts, and should resolve overloaded 
operators. 


> Validate function arguments in RelBuilder
> -----------------------------------------
>
>                 Key: CALCITE-1073
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1073
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>
> RelBuilder should validate function arguments. For example, if you try to 
> create a call to SUBSTRING, RelBuilder should make sure that the arguments 
> are of type VARCHAR (or CHAR), INTEGER, INTEGER.
> Usually calls are validated using {{SqlValidator.validateCall}}, which 
> delegates to the following policies inside the operator:
> {code}
>   private final SqlReturnTypeInference returnTypeInference;
>   private final SqlOperandTypeInference operandTypeInference;
>   private final SqlOperandTypeChecker operandTypeChecker;
> {code}
> There isn’t a SqlValidator accessible to RelBuilder, but I think we can 
> somehow make RelBuilder call into the policies.
> Also note that SqlOperandTypeChecker was intended for ASTs (SqlNode), and in 
> SqlNode format the arguments are sometimes different (e.g. CAST has 2 
> arguments in SqlNode format and only one in RexNode format), so we'll have to 
> fix up.
> RelBuilder should also insert implicit casts, and should resolve overloaded 
> operators. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to