JingsongLi commented on code in PR #8364: URL: https://github.com/apache/paimon/pull/8364#discussion_r3484835433
########## paimon-common/src/main/java/org/apache/paimon/data/shredding/MapSharedShreddingReader.java: ########## @@ -0,0 +1,362 @@ +/* + * 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.paimon.data.shredding; + +import org.apache.paimon.data.BinaryString; +import org.apache.paimon.data.Blob; +import org.apache.paimon.data.Decimal; +import org.apache.paimon.data.GenericMap; +import org.apache.paimon.data.InternalArray; +import org.apache.paimon.data.InternalMap; +import org.apache.paimon.data.InternalRow; +import org.apache.paimon.data.InternalVector; +import org.apache.paimon.data.Timestamp; +import org.apache.paimon.data.variant.Variant; +import org.apache.paimon.fs.Path; +import org.apache.paimon.reader.FileRecordIterator; +import org.apache.paimon.reader.FileRecordReader; +import org.apache.paimon.types.DataField; +import org.apache.paimon.types.DataType; +import org.apache.paimon.types.MapType; +import org.apache.paimon.types.RowKind; +import org.apache.paimon.types.RowType; + +import javax.annotation.Nullable; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * A reader wrapper that rebuilds logical MAP values from shared-shredding physical ROW values. + * + * <p>The wrapped format reader reads the physical schema stored in a file. This reader presents the + * original logical schema to upper layers by lazily converting only shared-shredding MAP fields + * when {@link InternalRow#getMap(int)} is called. + */ +public class MapSharedShreddingReader implements FileRecordReader<InternalRow> { Review Comment: The wrapper is never used by the actual data-file read path. I only see references from this class and its unit test; `RawFileSplitRead`, `DataEvolutionSplitRead`, and `FormatTableRead` still pass the format reader directly into `DataFileRecordReader`, and nothing reads `SupportsReaderFieldMetadata` to build these metas before returning rows. As a result, a table containing a shared-shredding MAP would still expose the physical ROW from the format reader instead of this logical MAP wrapper, so the PR does not yet provide real read support outside the unit test. Please wire this reader into the real read paths after recovering the field metadata, and add an end-to-end read/write test that reads a shared-shredding map through the table API. -- 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]
