garyli1019 commented on a change in pull request #2958:
URL: https://github.com/apache/hudi/pull/2958#discussion_r633375968



##########
File path: 
hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/GlobalHoodieRecordLocation.java
##########
@@ -0,0 +1,118 @@
+/*
+ * 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.hudi.sink.partitioner;
+
+import org.apache.hudi.common.model.HoodieRecordLocation;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * Similar with {@link org.apache.hudi.common.model.HoodieRecordLocation} but 
with partition path.
+ */
+public class GlobalHoodieRecordLocation implements Serializable {

Review comment:
       I think that's necessary, maybe other engines will use this later. How 
about renaming this to `HoodieRecordGlobalLocation`

##########
File path: 
hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/BucketAssignFunction.java
##########
@@ -90,7 +92,7 @@
    *   <li>If it does not, use the {@link BucketAssigner} to generate a new 
bucket ID</li>
    * </ul>
    */
-  private MapState<HoodieKey, HoodieRecordLocation> indexState;
+  private MapState<String, GlobalHoodieRecordLocation> indexState;

Review comment:
       Also, the global index is very expensive for a large table. Can we make 
the index type configurable? 

##########
File path: 
hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/BucketAssignFunction.java
##########
@@ -90,7 +92,7 @@
    *   <li>If it does not, use the {@link BucketAssigner} to generate a new 
bucket ID</li>
    * </ul>
    */
-  private MapState<HoodieKey, HoodieRecordLocation> indexState;
+  private MapState<String, GlobalHoodieRecordLocation> indexState;

Review comment:
       Let me give an example. When a record changes the partition, we will 
create a delete record to the old location and update the index with the new 
location, but this index state was globally distributed and only one 
parallelism will be affected. If we change the parallelism and restart the job, 
this record may be in different parallelism with a wrong location in the index 
state. 




-- 
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:
[email protected]


Reply via email to