Gabriel39 commented on code in PR #70869: URL: https://github.com/apache/doris/pull/70869#discussion_r4674884638
########## fe/fe-iceberg-common/src/main/java/org/apache/doris/connector/iceberg/IcebergV4FileIO.java: ########## @@ -0,0 +1,416 @@ +// 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.doris.connector.iceberg; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import org.apache.iceberg.ContentFile; +import org.apache.iceberg.DataFile; +import org.apache.iceberg.DeleteFile; +import org.apache.iceberg.FileFormat; +import org.apache.iceberg.InternalData; +import org.apache.iceberg.ManifestFile; +import org.apache.iceberg.ManifestListFile; +import org.apache.iceberg.Schema; +import org.apache.iceberg.Snapshot; +import org.apache.iceberg.StructLike; +import org.apache.iceberg.TableMetadata; +import org.apache.iceberg.TableMetadataParser; +import org.apache.iceberg.avro.AvroIterable; +import org.apache.iceberg.exceptions.NotFoundException; +import org.apache.iceberg.io.CloseableIterable; +import org.apache.iceberg.io.FileIO; +import org.apache.iceberg.io.InputFile; +import org.apache.iceberg.io.OutputFile; +import org.apache.iceberg.types.Types; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** Serializable, borrowed read view for table-relative format v4 locations. */ +public final class IcebergV4FileIO implements FileIO { + private static final long serialVersionUID = 1L; + private static final Pattern SCHEME = Pattern.compile("^[a-zA-Z][a-zA-Z0-9+.-]*:.*", Pattern.DOTALL); + private final FileIO delegate; + private final String tableLocation; + private final String metadataFileLocation; + private final Map<Long, String> inlineSnapshotLists; + private transient volatile TableMetadata metadata; + private transient LoadingCache<String, TableMetadata> metadataFiles; + private transient LoadingCache<String, Integer> manifestVersions; + private transient LoadingCache<Long, MetadataHeader> snapshotHeaders; + private transient ConcurrentMap<String, MetadataLocation> metadataLocations; + + public IcebergV4FileIO(FileIO delegate, String tableLocation) { + this(delegate, tableLocation, null); + } + + public IcebergV4FileIO(FileIO delegate, String tableLocation, TableMetadata metadata) { + this(delegate, tableLocation, metadata, metadata == null ? null : metadata.metadataFileLocation(), Review Comment: Fixed in 5072e047bf25. The read view no longer builds or serializes inlineSnapshotLists. Frozen metadata and query-local caches remain transient; FE prepares each transported lazy task with at most its own concrete manifest/list binding. The regression adds 2,000 historical snapshots and bounds growth for both the serialized IO and the complete metadata task while also checking the returned record count. Baseline IO payload grows from 1,104 to 144,640 base64 bytes; the corrected task payload stays within the fixed-size growth bound. Existing lazy-history coverage also remains passing. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
