Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/3040#discussion_r104723484 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/dataset/DataSetCorrelate.scala --- @@ -97,18 +103,41 @@ class DataSetCorrelate( val sqlFunction = rexCall.getOperator.asInstanceOf[TableSqlFunction] val pojoFieldMapping = sqlFunction.getPojoFieldMapping val udtfTypeInfo = sqlFunction.getRowTypeInfo.asInstanceOf[TypeInformation[Any]] + val returnType = FlinkTypeFactory.toInternalRowTypeInfo(getRowType) val mapFunc = correlateMapFunction( config, inputDS.getType, udtfTypeInfo, + returnType, getRowType, joinType, rexCall, condition, Some(pojoFieldMapping), ruleDescription) - inputDS.flatMap(mapFunc).name(correlateOpName(rexCall, sqlFunction, relRowType)) + def getIndices = { --- End diff -- A correlate forwards all fields from the input and the table function like this `[in1, in2, in3, tf1, tf2]` for an input `[in1, in2, in3]` and table function `[tf1, tf2]`. So we can do a simple position based mapping of the fields of the input type against the output type (field names might change). Basically similar to what you are doing with the single row join. We do not need to look at the table function or the condition.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---