hk-lrzy commented on a change in pull request #2600: URL: https://github.com/apache/hudi/pull/2600#discussion_r583366344
########## File path: hudi-flink/src/main/java/org/apache/hudi/operator/partitioner/BucketAssignFunction.java ########## @@ -136,15 +137,10 @@ public void open(Configuration parameters) throws Exception { new SerializableConfiguration(this.hadoopConf), new FlinkTaskContextSupplier(getRuntimeContext())); this.bucketAssigner = new BucketAssigner(context, writeConfig); - List<String> allPartitionPaths = FSUtils.getAllPartitionPaths(this.context, - this.conf.getString(FlinkOptions.PATH), false, false, false); - final int parallelism = getRuntimeContext().getNumberOfParallelSubtasks(); - final int maxParallelism = getRuntimeContext().getMaxNumberOfParallelSubtasks(); - final int taskID = getRuntimeContext().getIndexOfThisSubtask(); - // reference: org.apache.flink.streaming.api.datastream.KeyedStream - this.initialPartitionsToLoad = allPartitionPaths.stream() - .filter(partition -> KeyGroupRangeAssignment.assignKeyToParallelOperator(partition, maxParallelism, parallelism) == taskID) - .collect(Collectors.toList()); + + // initialize and check the partitions load state + loadInitialPartitions(); + checkPartitionsLoaded(); Review comment: I have some doubts about this, because the current key of the keycontext has not been set, so the key state of flink cannot be accessed in the open method. Should we move this method to processElement? If possible, I can submit a patch. thanks. ``` private void checkKeyNamespacePreconditions(K key, N namespace) { Preconditions.checkNotNull(key, "No key set. This method should not be called outside of a keyed context."); Preconditions.checkNotNull(namespace, "Provided namespace is null."); } ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org