manish1337 commented on code in PR #29614:
URL: https://github.com/apache/flink/pull/29614#discussion_r4435839244


##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/common/PartialInsertTest.xml:
##########
@@ -127,17 +127,17 @@ 
LogicalSink(table=[default_catalog.default_database.partitioned_sink], targetCol
     <Resource name="optimized rel plan">
       <![CDATA[
 Sink(table=[default_catalog.default_database.partitioned_sink], 
targetColumns=[[4],[0],[6],[5],[2],[3]], fields=[a, c, d, e, f, g])
-+- Calc(select=[a0 AS a, c0 AS c, d0 AS d, e0 AS e, f0 AS f, g0 AS g])
-   +- Correlate(invocation=[$REPLICATE_ROWS$1($0, $1, $2, $3, $4, $5, $6)], 
correlate=[table($REPLICATE_ROWS$1(sum_vcol_marker,a,c,d,e,f,g))], 
select=[sum_vcol_marker,a,c,d,e,f,g,a0,c0,d0,e0,f0,g0], 
rowType=[RecordType(BIGINT sum_vcol_marker, INTEGER a, VARCHAR(2147483647) c, 
VARCHAR(2147483647) d, DOUBLE e, BIGINT f, INTEGER g, INTEGER a0, 
VARCHAR(2147483647) c0, VARCHAR(2147483647) d0, DOUBLE e0, BIGINT f0, INTEGER 
g0)], joinType=[INNER])
-      +- Calc(select=[sum_vcol_marker, a, c, d, e, f, g], 
where=[>(sum_vcol_marker, 0)])
-         +- GroupAggregate(groupBy=[a, c, d, e, f, g], select=[a, c, d, e, f, 
g, SUM_RETRACT(vcol_marker) AS sum_vcol_marker])
-            +- Exchange(distribution=[hash[a, c, d, e, f, g]])
-               +- Union(all=[true], union=[a, c, d, e, f, g, vcol_marker])
-                  :- Calc(select=[a, c, d, e, CAST(123 AS BIGINT) AS f, 
CAST(456 AS INTEGER) AS g, 1 AS vcol_marker])
++- Calc(select=[a0 AS a, c0 AS c, d0 AS d, e0 AS e, CAST(123 AS BIGINT) AS f, 
CAST(456 AS INTEGER) AS g])
+   +- Correlate(invocation=[$REPLICATE_ROWS$1($0, $1, $2, $3, $4, $5, $6)], 
correlate=[table($REPLICATE_ROWS$1(sum_vcol_marker,a,c,d,e,EXPR$4,EXPR$5))], 
select=[sum_vcol_marker,a,c,d,e,EXPR$4,EXPR$5,a0,c0,d0,e0,EXPR$40,EXPR$50], 
rowType=[RecordType(BIGINT sum_vcol_marker, INTEGER a, VARCHAR(2147483647) c, 
VARCHAR(2147483647) d, DOUBLE e, INTEGER EXPR$4, INTEGER EXPR$5, INTEGER a0, 
VARCHAR(2147483647) c0, VARCHAR(2147483647) d0, DOUBLE e0, INTEGER EXPR$40, 
INTEGER EXPR$50)], joinType=[INNER])
+      +- Calc(select=[sum_vcol_marker, a, c, d, e, EXPR$4, EXPR$5], 
where=[>(sum_vcol_marker, 0)])
+         +- GroupAggregate(groupBy=[a, c, d, e, EXPR$4, EXPR$5], select=[a, c, 
d, e, EXPR$4, EXPR$5, SUM_RETRACT(vcol_marker) AS sum_vcol_marker])
+            +- Exchange(distribution=[hash[a, c, d, e, EXPR$4, EXPR$5]])
+               +- Union(all=[true], union=[a, c, d, e, EXPR$4, EXPR$5, 
vcol_marker])
+                  :- Calc(select=[a, c, d, e, 123 AS EXPR$4, 456 AS EXPR$5, 1 
AS vcol_marker])
                   :  +- GroupAggregate(groupBy=[a, b, c, d, e], select=[a, b, 
c, d, e])
                   :     +- Exchange(distribution=[hash[a, b, c, d, e]])
                   :        +- TableSourceScan(table=[[default_catalog, 
default_database, MyTable]], fields=[a, b, c, d, e])
-                  +- Calc(select=[a, c, d, e, CAST(123 AS BIGINT) AS f, 
CAST(456 AS INTEGER) AS g, -1 AS vcol_marker])
+                  +- Calc(select=[a, c, d, e, 456 AS EXPR$4, 789 AS EXPR$5, -1 
AS vcol_marker])

Review Comment:
   Good catch, you're right. The right side got the left side's constants. 
Fixed the description and added a semantic test for it.



##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/FlinkProjectSetOpTransposeRule.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.rules.logical;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.rel.logical.LogicalProject;
+import org.apache.calcite.rel.logical.LogicalUnion;
+import org.apache.calcite.rel.rules.ProjectSetOpTransposeRule;
+
+/**
+ * Extends calcite's ProjectSetOpTransposeRule, modification: only matches 
{@link LogicalUnion}.

Review Comment:
   Done.



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

Reply via email to