[ https://issues.apache.org/jira/browse/FLINK-11449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16760010#comment-16760010 ]
Timo Walther commented on FLINK-11449: -------------------------------------- Thanks for working on this [~sunjincheng121]. I think most of the changes should be clearly defined now. Feel free to start developing. I will summarize the approach again here: In {{flink-table-api-common}}, because we can even put those expression classes into flink-table-common for FilterableTableSources in the future: {code} public class FunctionDefinition { public String name; } public class ScalarFunctionDefinition extends FunctionDefinition { // the name is ignored for now public UserDefinedFunction f; } public class TableFunctionDefinition extends FunctionDefinition { // the name is ignored for now public UserDefinedFunction f; } public class AggregateFunctionDefinition extends FunctionDefinition { // the name is ignored for now public UserDefinedFunction f; } public class Expression { abstract List<Expression> getChildren(); abstract <R> R accept(ExpressionVisitor<R> visitor); // do we need more methods here? } public final class FunctionDefinitions { // implement just a basic definition (only name) for know // we can extend this functionality in the future with type inference logic etc. public static final FunctionDefinition TRIM = new FunctionDefinition("trim"); public static final FunctionDefinition CAST = new FunctionDefinition("cast"); public static List<FunctionDefinitions> getDefinitions() { // use reflection for all definitions similar to Calcite's SqlStdOperatorTable } } CallExpression(FunctionDefinition, Expression*) extends Expression SymbolExpression(TableSymbol ???) extends Expression FieldReferenceExpression(String) extends Expression TypeLiteralExpression(TypeInformation) extends Expression ValueLiteralExpression(Object) extends Expression {code} In {{flink-table-api-java}}: {code} TableReferenceExpression(String, Table) extends Expression {code} In {{flink-table-planner}}: {code} + visitor pattern in the planner to translate (can be in Scala) in Flink: to Flink's case classes in Blink: to Blink's case classes visit(call Call) match { case TRIM => .... } {code} expressionDsl.scala and ExpressionParser.scala can still remain implemented in Scala. > Uncouple the Expression class from RexNodes > ------------------------------------------- > > Key: FLINK-11449 > URL: https://issues.apache.org/jira/browse/FLINK-11449 > Project: Flink > Issue Type: New Feature > Components: Table API & SQL > Reporter: Timo Walther > Assignee: sunjincheng > Priority: Major > > A more detailed description can be found in > [FLIP-32|https://cwiki.apache.org/confluence/display/FLINK/FLIP-32%3A+Restructure+flink-table+for+future+contributions]. > Calcite will not be part of any API module anymore. Therefore, RexNode > translation must happen in a different layer. This issue will require a new > design document. -- This message was sent by Atlassian JIRA (v7.6.3#76005)