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: [FLINK-3941][TableAPI]Add support for UNION (w...
Date Wed, 25 May 2016 09:26:35 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2025#discussion_r64541694
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/nodes/dataset/DataSetUnion.scala
---
    @@ -69,16 +73,23 @@ class DataSetUnion(
           rows + metadata.getRowCount(child)
         }
     
    -    planner.getCostFactory.makeCost(rowCnt, 0, 0)
    +    planner.getCostFactory.makeCost(
    +      rowCnt,
    +      if (all) 0 else rowCnt,
    +      if (all) 0 else rowCnt)
       }
     
       override def translateToPlan(
           tableEnv: BatchTableEnvironment,
           expectedType: Option[TypeInformation[Any]]): DataSet[Any] = {
     
    -    val leftDataSet = left.asInstanceOf[DataSetRel].translateToPlan(tableEnv)
    -    val rightDataSet = right.asInstanceOf[DataSetRel].translateToPlan(tableEnv)
    -    leftDataSet.union(rightDataSet).asInstanceOf[DataSet[Any]]
    +    val leftDataSet = left.asInstanceOf[DataSetRel].translateToPlan(tableEnv, expectedType)
    +    val rightDataSet = right.asInstanceOf[DataSetRel].translateToPlan(tableEnv, expectedType)
    +    if (all) {
    +      leftDataSet.union(rightDataSet).asInstanceOf[DataSet[Any]]
    +    } else {
    +      leftDataSet.union(rightDataSet).distinct().asInstanceOf[DataSet[Any]]
    --- End diff --
    
    Oh, yes. Completely forgot about that rule... 😊 
    So, we already supported the non-all union for SQL. Only the Table API was missing the
`union()` method.
    I think there are two ways to continue: 
    - remove the `UnionToDistinctRule` from `FlinkRuleSets`
    - revert the changes on `DataSetUnion` (except of pushing down the `expectedType`) and
`DataSetUnionRule`.
    
    I am fine either ways.


---
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