flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] hequn8128 commented on a change in pull request #7196: [FLINK-10974] [table] Add support for flatMap to table API
Date Mon, 08 Apr 2019 06:44:26 GMT
hequn8128 commented on a change in pull request #7196: [FLINK-10974] [table] Add support for
flatMap to table API
URL: https://github.com/apache/flink/pull/7196#discussion_r272899748
 
 

 ##########
 File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/OperationTreeBuilder.scala
 ##########
 @@ -376,6 +377,33 @@ class OperationTreeBuilder(private val tableEnv: TableEnvironment) {
     Project(expandedFields.map(UnresolvedAlias), childNode).validate(tableEnv)
   }
 
+  def flatMap(tableFunction: Expression, child: TableOperation): TableOperation = {
 
 Review comment:
   Maybe this method can be simplified as follows ?
   ```
     def flatMap(tableFunction: Expression, child: TableOperation): TableOperation = {
       val tableFuncWithoutAlias = getLeadingNonAliasExpr(tableFunction)
       val joinNode = joinLateral(child, tableFuncWithoutAlias, JoinType.INNER, Optional.empty())
       val dropNode = dropColumns(
         child.getTableSchema.getFieldNames.map(a => UnresolvedFieldReference(a)),
         joinNode)
   
       val temporalTable = UserDefinedFunctionUtils.createLogicalFunctionCall(
         expressionBridge.bridge(tableFunction),
         child.asInstanceOf[LogicalNode])
   
       alias(temporalTable.fieldNames.map(a => UnresolvedFieldReference(a)), dropNode)
     }
   ```
   Furthermore, we don't need the `extractTableFunction()` in `UserDefinedFunctionUtils` if
we change the implementation to the above one. 
   What do you think?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message