beyond1920 commented on a change in pull request #17632: URL: https://github.com/apache/flink/pull/17632#discussion_r740955153
########## File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalWindowDeduplicate.scala ########## @@ -0,0 +1,91 @@ +/* + * 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.planner.plan.nodes.physical.stream + +import org.apache.flink.table.planner.calcite.FlinkTypeFactory +import org.apache.flink.table.planner.plan.logical.WindowingStrategy +import org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecWindowDeduplicate +import org.apache.flink.table.planner.plan.nodes.exec.{ExecNode, InputProperty} +import org.apache.flink.table.planner.plan.utils._ + +import org.apache.calcite.plan.{RelOptCluster, RelTraitSet} +import org.apache.calcite.rel._ +import org.apache.calcite.rel.`type`.RelDataType + +import java.util + +import scala.collection.JavaConverters._ + +/** + * Stream physical RelNode which deduplicate on keys and keeps only first row or last row for each + * window. This node is an optimization of [[StreamPhysicalWindowRank]]. + * Compared to [[StreamPhysicalWindowRank]], this node could access/write state with higher + * performance. The RelNode also requires PARTITION BY clause contains start and end columns of + * the windowing TVF. + */ +class StreamPhysicalWindowDeduplicate( + cluster: RelOptCluster, + traitSet: RelTraitSet, + inputRel: RelNode, + partitionKeys: Array[Int], + orderKey: Int, Review comment: Just like [Deduplication](https://ci.apache.org/projects/flink/flink-docs-master/docs/dev/table/sql/queries/deduplication/), the window deduplication requires only order by one time attribute field, otherwise the sql would be translated into window rank. Comparing with window rank, the window deduplicate would use ValueState instead of MapState. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
