flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #2159: [FLINK-3942] [tableAPI] Add support for INTERSECT
Date Wed, 29 Jun 2016 22:09:40 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2159#discussion_r69037698
  
    --- 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 "*".
    --- End diff --
    
    I think you can use `*` for all cases. Composite types should be (recursively) expanded
to all atomic member types.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message