[ 
https://issues.apache.org/jira/browse/FLINK-24462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17428311#comment-17428311
 ] 

Francesco Guardiani commented on FLINK-24462:
---------------------------------------------

An alternative I have in mind is to have {{CastRule#create}} return 
{{GeneratedExpression}}, including moving the cast interfaces back to runtime. 
This won't change in any way how the runtime works (because we still end up 
generating code) but just how our code is structured. The only problem with 
this solution is that it doesn't help with 
https://issues.apache.org/jira/browse/FLINK-21456, where some code (not all) 
will still be duplicated:


{code:java}
public interface CastRule {

[...]

    GeneratedExpression create(
            Context context, GeneratedExpression operand, LogicalType 
targetLogicalType);

[...]
}
{code}

Or perhaps we can have this method that returns the code generated expression 
in a subinterface like {{CodeGeneratingCastRule}}, which then by default 
implements the {{CastExecutor<IN, OUT> create(Context context, LogicalType 
inputLogicalType, LogicalType targetLogicalType)}} just compiling the 
{{GeneratedExpression}} as a {{CastExecutor}}.



> Refactor casting rules in a similar fashion to DataStructureConverter
> ---------------------------------------------------------------------
>
>                 Key: FLINK-24462
>                 URL: https://issues.apache.org/jira/browse/FLINK-24462
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / Planner
>            Reporter: Francesco Guardiani
>            Assignee: Francesco Guardiani
>            Priority: Major
>         Attachments: results.txt
>
>
> The goal of this issue is to reorganize CAST logic in rules, similarly to 
> DataStructureConverter. This makes the casting rules easier to debug and 
> extend, allows us to reuse some of the rules for 
> https://issues.apache.org/jira/browse/FLINK-21456 without duplicating any 
> code and simplifies/cleanups the code generator code base. These rules can be 
> reused in the context of https://issues.apache.org/jira/browse/FLINK-24385 as 
> well.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to