lxy-9602 commented on code in PR #8364: URL: https://github.com/apache/paimon/pull/8364#discussion_r3484980971
########## 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: Thanks for the review. This is a standalone PR that extracts a wrapper for converting physical columns to logical columns. Once this wrapper is merged, I will submit the previously mentioned append read/write end-to-end changes together in #8355. We mainly split this out to keep the PR size manageable and make the review easier. Also, the write-side changes have not been merged yet, so this will not produce data that cannot be read. -- 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]
