You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "jnh5y (via GitHub)" <gi...@apache.org> on 2024/08/15 21:19:46 UTC

[PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

jnh5y opened a new pull request, #25206:
URL: https://github.com/apache/flink/pull/25206

   ## What is the purpose of the change
   
   * Adds Compiled Plan annotations to BatchExecRank.
   * Tests the new annotations with the existing TestPrograms.
   
   ## Verifying this change
   
   This change adds a BatchRestoreTest to cover the new annotations and show that the batch compiled plan can be restored and executed correctly.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (yes)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)
     - If yes, how is the feature documented? (not applicable)


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on code in PR #25206:
URL: https://github.com/apache/flink/pull/25206#discussion_r1857690306


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/common/RankTestPrograms.java:
##########
@@ -184,4 +207,32 @@ private static TableTestProgram getTableTestProgram(
                                     + "(select a, b, row_number() over(partition by a order by t asc) as c from MyTable1)"
                                     + " where c <= 2")
                     .build();
+
+    public static final TableTestProgram RANK_2_TEST =

Review Comment:
   As a note, this test is not supported in batch execution mode.  An error `Table RANK() on streaming table is not supported currently` is returned.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on code in PR #25206:
URL: https://github.com/apache/flink/pull/25206#discussion_r1719174902


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/batch/RankBatchRestoreTest.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.table.planner.plan.nodes.exec.common.RankTestPrograms;
+import org.apache.flink.table.planner.plan.nodes.exec.testutils.BatchRestoreTestBase;
+import org.apache.flink.table.test.program.TableTestProgram;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** Batch Compiled Plan tests for {@link BatchExecRank}. */
+public class RankBatchRestoreTest extends BatchRestoreTestBase {
+
+    public RankBatchRestoreTest() {
+        super(BatchExecRank.class);
+    }
+
+    @Override
+    public List<TableTestProgram> programs() {
+        return Arrays.asList(
+                RankTestPrograms.RANK_TEST_APPEND_FAST_STRATEGY,
+                // org.apache.flink.table.api.TableException: Querying a table in batch mode is
+                // currently only possible for INSERT-only table sources. But the source for table
+                // 'default_catalog.default_database.MyTable' produces other changelog messages than
+                // just INSERT.
+                // RankTestPrograms.RANK_TEST_RETRACT_STRATEGY,

Review Comment:
   This test cannot be made to work with batch.  
   
   Should we leave a comment like this or just remove it?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on code in PR #25206:
URL: https://github.com/apache/flink/pull/25206#discussion_r1840738408


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecRank.java:
##########
@@ -37,20 +39,48 @@
 import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
 import org.apache.flink.table.types.logical.RowType;
 
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
 import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecRank.FIELD_NAME_OUTPUT_RANK_NUMBER;
 
 /**
  * {@link BatchExecNode} for Rank.
  *
  * <p>This node supports two-stage(local and global) rank to reduce data-shuffling.
  */
+@ExecNodeMetadata(
+        name = "batch-exec-rank",

Review Comment:
   Ah, good catch.  The optimizations for rank are different in streaming and batch.  I'll go looking for a case which is optimized in batch.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #25206:
URL: https://github.com/apache/flink/pull/25206#discussion_r1840565494


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecRank.java:
##########
@@ -37,20 +39,48 @@
 import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
 import org.apache.flink.table.types.logical.RowType;
 
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
 import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecRank.FIELD_NAME_OUTPUT_RANK_NUMBER;
 
 /**
  * {@link BatchExecNode} for Rank.
  *
  * <p>This node supports two-stage(local and global) rank to reduce data-shuffling.
  */
+@ExecNodeMetadata(
+        name = "batch-exec-rank",

Review Comment:
   I cannot find this identifier in any of the attached plans. Maybe we need some additional test cases to trigger it?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on PR #25206:
URL: https://github.com/apache/flink/pull/25206#issuecomment-2501601868

   @flinkbot run azure


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #25206:
URL: https://github.com/apache/flink/pull/25206#discussion_r1719447587


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/batch/RankBatchRestoreTest.java:
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.exec.batch;
+
+import org.apache.flink.table.planner.plan.nodes.exec.common.RankTestPrograms;
+import org.apache.flink.table.planner.plan.nodes.exec.testutils.BatchRestoreTestBase;
+import org.apache.flink.table.test.program.TableTestProgram;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** Batch Compiled Plan tests for {@link BatchExecRank}. */
+public class RankBatchRestoreTest extends BatchRestoreTestBase {
+
+    public RankBatchRestoreTest() {
+        super(BatchExecRank.class);
+    }
+
+    @Override
+    public List<TableTestProgram> programs() {
+        return Arrays.asList(
+                RankTestPrograms.RANK_TEST_APPEND_FAST_STRATEGY,
+                // org.apache.flink.table.api.TableException: Querying a table in batch mode is
+                // currently only possible for INSERT-only table sources. But the source for table
+                // 'default_catalog.default_database.MyTable' produces other changelog messages than
+                // just INSERT.
+                // RankTestPrograms.RANK_TEST_RETRACT_STRATEGY,

Review Comment:
   Let's keep it. Once we have a materializing batch operator, we can reenable it



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on code in PR #25206:
URL: https://github.com/apache/flink/pull/25206#discussion_r1857417239


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/batch/BatchExecRank.java:
##########
@@ -37,20 +39,48 @@
 import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
 import org.apache.flink.table.types.logical.RowType;
 
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
 import java.util.Collections;
+import java.util.List;
+
+import static org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecRank.FIELD_NAME_OUTPUT_RANK_NUMBER;
 
 /**
  * {@link BatchExecNode} for Rank.
  *
  * <p>This node supports two-stage(local and global) rank to reduce data-shuffling.
  */
+@ExecNodeMetadata(
+        name = "batch-exec-rank",

Review Comment:
   Here's the test which adds support: https://github.com/apache/flink/pull/25206/commits/ac2bd74b1e52e5c34496ef8a6f091e4100535ba6#diff-22bac638f9ee782fcf9e02e2f5cc6525def6535f4e144596fc61900779c8682fR106 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #25206:
URL: https://github.com/apache/flink/pull/25206


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #25206:
URL: https://github.com/apache/flink/pull/25206#issuecomment-2292285471

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c82d7a7b541e88cf32a00b67b0066da681df86b2",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c82d7a7b541e88cf32a00b67b0066da681df86b2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c82d7a7b541e88cf32a00b67b0066da681df86b2 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36048] Add CompiledPlan annotations to BatchExecRank [flink]

Posted by "jnh5y (via GitHub)" <gi...@apache.org>.
jnh5y commented on PR #25206:
URL: https://github.com/apache/flink/pull/25206#issuecomment-2501417685

   @flinkbot run azure


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org