You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "swuferhong (via GitHub)" <gi...@apache.org> on 2023/09/14 11:50:18 UTC

[GitHub] [flink] swuferhong commented on a diff in pull request #23414: [hotfix][test] Fix test value source throw ClassCastException while push down none-existent partition

swuferhong commented on code in PR #23414:
URL: https://github.com/apache/flink/pull/23414#discussion_r1325831177


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/factories/TestValuesTableFactory.java:
##########
@@ -1244,26 +1244,34 @@ public void applyPartitions(List<Map<String, String>> remainingPartitions) {
                 } else {
                     // we will read data from Collections.emptyList() if allPartitions is empty.
                     // therefore, we should clear all data manually.
-                    remainingPartitions = (List<Map<String, String>>) Collections.emptyMap();
+                    remainingPartitions = createEmptyRemainingPartitions();
                     this.data.put(Collections.emptyMap(), Collections.emptyList());
                 }
 
             } else {
                 this.allPartitions = remainingPartitions;
                 if (remainingPartitions.isEmpty()) {
-                    remainingPartitions = (List<Map<String, String>>) Collections.emptyMap();
+                    remainingPartitions = createEmptyRemainingPartitions();
                 }
             }
             // only keep the data in the remaining partitions
             this.data = pruneDataByRemainingPartitions(remainingPartitions, this.data);
         }
 
+        private List<Map<String, String>> createEmptyRemainingPartitions() {

Review Comment:
   > What about using `Collections.singletonList(Collections.emptyMap())`?
   
   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: issues-unsubscribe@flink.apache.org

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