fhan688 commented on code in PR #3501:
URL: https://github.com/apache/fluss/pull/3501#discussion_r3445624202


##########
fluss-lake/fluss-lake-hudi/src/main/java/org/apache/fluss/lake/hudi/source/HudiSortedRecordReader.java:
##########
@@ -0,0 +1,232 @@
+/*
+ * 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.fluss.lake.hudi.source;
+
+import org.apache.fluss.annotation.VisibleForTesting;
+import org.apache.fluss.config.Configuration;
+import org.apache.fluss.lake.hudi.utils.HudiTableInfo;
+import org.apache.fluss.lake.source.SortedRecordReader;
+import org.apache.fluss.metadata.TablePath;
+import org.apache.fluss.record.LogRecord;
+import org.apache.fluss.row.InternalRow;
+import org.apache.fluss.types.DataType;
+import org.apache.fluss.types.DataTypeRoot;
+import org.apache.fluss.types.DataTypes;
+import org.apache.fluss.utils.CloseableIterator;
+import org.apache.fluss.utils.InternalRowUtils;
+
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.org.apache.avro.Schema;
+import org.apache.hudi.source.ExpressionPredicates;
+import org.apache.hudi.util.AvroSchemaConverter;
+import org.apache.hudi.util.StreamerUtil;
+
+import javax.annotation.Nullable;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+/** Hudi record reader that exposes primary-key ordering for Fluss union read. 
*/
+public class HudiSortedRecordReader implements SortedRecordReader {

Review Comment:
   > Does the underlying hudi record reader ensure the records emit is ordered? 
If not, we can just remove HudiSortedRecordReader like iceberg. The 
SortedRecordReader only needed for batch union read primary key table. We can 
leave it unsupported. That's fine, we also don't support for icebrg.
   
   Thanks for pointing this out. You are right that the current Hudi reader 
path does not guarantee records are emitted in primary-key order.
   
     `SortedRecordReader` requires `read()` to return records ordered by 
`order()`, and `SortMergeReader` relies on each lake iterator being sorted. 
Since `HudiRecordReader` currently delegates to
     Hudi file-slice readers directly, we cannot safely claim that contract 
here.
   
     I removed `HudiSortedRecordReader` and its tests in the latest update. 
This PR now only keeps Hudi predicate pushdown support. Hudi primary-key batch 
union read can stay unsupported for now,
     consistent with the current Iceberg behavior.



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