[ https://issues.apache.org/jira/browse/FLINK-9344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16486721#comment-16486721 ]
ASF GitHub Bot commented on FLINK-9344: --------------------------------------- Github user walterddr commented on a diff in the pull request: https://github.com/apache/flink/pull/5998#discussion_r190119234 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/datastream/DataStreamIntersect.scala --- @@ -0,0 +1,116 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.plan.nodes.datastream + +import org.apache.calcite.plan.{RelOptCluster, RelOptCost, RelOptPlanner, RelTraitSet} +import org.apache.calcite.rel.{BiRel, RelNode, RelWriter} +import org.apache.calcite.rel.`type`.RelDataType +import org.apache.calcite.rel.metadata.RelMetadataQuery +import org.apache.flink.api.java.typeutils.RowTypeInfo +import org.apache.flink.streaming.api.datastream.DataStream +import org.apache.flink.table.api.{StreamQueryConfig, StreamTableEnvironment} +import org.apache.flink.table.plan.schema.RowSchema +import org.apache.flink.table.runtime.CRowKeySelector +import org.apache.flink.table.runtime.setop.StreamIntersectCoProcessFunction +import org.apache.flink.table.runtime.types.{CRow, CRowTypeInfo} + +import scala.collection.JavaConverters._ + +class DataStreamIntersect( + cluster: RelOptCluster, + traitSet: RelTraitSet, + leftNode: RelNode, + rightNode: RelNode, + rowRelDataType: RelDataType, + all: Boolean) + extends BiRel(cluster, traitSet, leftNode, rightNode) + with DataStreamRel { + + private lazy val intersectType = if (all) { + "All" + } else { + "" + } + + override def needsUpdatesAsRetraction: Boolean = true + + override def deriveRowType() = rowRelDataType + + override def copy(traitSet: RelTraitSet, inputs: java.util.List[RelNode]): RelNode = { + new DataStreamIntersect( + cluster, + traitSet, + inputs.get(0), + inputs.get(1), + getRowType, + all + ) + } + + override def toString: String = { + s"Intersect$intersectType(intersect$intersectType: ($intersectSelectionToString))" --- End diff -- `s"Intersect$intersectType(intersect: ($intersectSelectionToString))"` I dont think you need to duplicate the type twice > Support INTERSECT and INTERSECT ALL for streaming > ------------------------------------------------- > > Key: FLINK-9344 > URL: https://issues.apache.org/jira/browse/FLINK-9344 > Project: Flink > Issue Type: Improvement > Components: Table API & SQL > Reporter: Ruidong Li > Assignee: Ruidong Li > Priority: Major > > support intersect and intersect all for both SQL and TableAPI -- This message was sent by Atlassian JIRA (v7.6.3#76005)