Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/2159#discussion_r69037753
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/nodes/dataset/DataSetIntersect.scala
---
@@ -83,66 +82,68 @@ class DataSetIntersect(
tableEnv: BatchTableEnvironment,
expectedType: Option[TypeInformation[Any]]): DataSet[Any] = {
- var leftDataSet: DataSet[Any] = null
- var rightDataSet: DataSet[Any] = null
+ val leftDataSet: DataSet[Any] =
left.asInstanceOf[DataSetRel].translateToPlan(tableEnv)
+ val rightDataSet: DataSet[Any] =
right.asInstanceOf[DataSetRel].translateToPlan(tableEnv)
- expectedType match {
- case None =>
- leftDataSet =
left.asInstanceOf[DataSetRel].translateToPlan(tableEnv)
- rightDataSet =
- right.asInstanceOf[DataSetRel].translateToPlan(tableEnv,
Some(leftDataSet.getType))
- case _ =>
- leftDataSet =
left.asInstanceOf[DataSetRel].translateToPlan(tableEnv, expectedType)
- rightDataSet =
right.asInstanceOf[DataSetRel].translateToPlan(tableEnv, expectedType)
- }
-
- val config = tableEnv.getConfig
-
- val returnType = determineReturnType(
- getRowType,
- expectedType,
- config.getNullCheck,
- config.getEfficientTypeUsage)
-
- val generator = new CodeGenerator(
- config,
- false,
- leftDataSet.getType,
- Some(rightDataSet.getType))
-
- val conversion = generator.generateConverterResultExpression(
- returnType,
- left.getRowType.getFieldNames)
+ val coGroupedDs = leftDataSet.coGroup(rightDataSet)
+ val leftType = leftDataSet.getType
+ val rightType = rightDataSet.getType
- val body = s"""
- |${conversion.code}
- |${generator.collectorTerm}.collect(${conversion.resultTerm});
- |""".stripMargin
+ // If it is atomic type, the field expression need to be "*".
+ // Otherwise, we use int-based field position keys
+ val coGroupedPredicateDs =
+ if (leftType.isTupleType ||
leftType.isInstanceOf[CompositeType[Any]]) {
+ coGroupedDs.where(0 until left.getRowType.getFieldCount: _*)
+ } else {
+ coGroupedDs.where("*")
+ }
- val genFunction = generator.generateFunction(
- ruleDescription,
- classOf[FlatJoinFunction[Any, Any, Any]],
- body,
- returnType)
+ val coGroupedWithoutFunctionDs =
--- End diff --
Same here.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---