RussellSpitzer commented on a change in pull request #2472: URL: https://github.com/apache/iceberg/pull/2472#discussion_r614965500
########## File path: spark3/src/main/java/org/apache/iceberg/spark/source/SparkFilesScan.java ########## @@ -0,0 +1,123 @@ +/* + * 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.iceberg.spark.source; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.apache.iceberg.CombinedScanTask; +import org.apache.iceberg.FileScanTask; +import org.apache.iceberg.Table; +import org.apache.iceberg.encryption.EncryptionManager; +import org.apache.iceberg.io.CloseableIterable; +import org.apache.iceberg.io.FileIO; +import org.apache.iceberg.relocated.com.google.common.base.Preconditions; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; +import org.apache.iceberg.relocated.com.google.common.collect.Lists; +import org.apache.iceberg.spark.FileScanTaskSetManager; +import org.apache.iceberg.spark.Spark3Util; +import org.apache.iceberg.spark.SparkReadOptions; +import org.apache.iceberg.util.PropertyUtil; +import org.apache.iceberg.util.TableScanUtil; +import org.apache.spark.broadcast.Broadcast; +import org.apache.spark.sql.util.CaseInsensitiveStringMap; + +import static org.apache.iceberg.TableProperties.SPLIT_LOOKBACK; +import static org.apache.iceberg.TableProperties.SPLIT_LOOKBACK_DEFAULT; +import static org.apache.iceberg.TableProperties.SPLIT_OPEN_FILE_COST; +import static org.apache.iceberg.TableProperties.SPLIT_OPEN_FILE_COST_DEFAULT; +import static org.apache.iceberg.TableProperties.SPLIT_SIZE; +import static org.apache.iceberg.TableProperties.SPLIT_SIZE_DEFAULT; + +class SparkFilesScan extends SparkBatchScan { + private final String taskSetID; + private final Long splitSize; + private final Integer splitLookback; + private final Long splitOpenFileCost; + + private List<CombinedScanTask> tasks = null; // lazy cache of tasks + + SparkFilesScan(Table table, Broadcast<FileIO> io, Broadcast<EncryptionManager> encryption, + boolean caseSensitive, CaseInsensitiveStringMap options) { + super(table, io, encryption, caseSensitive, table.schema(), ImmutableList.of(), options); + + this.taskSetID = options.get(SparkReadOptions.FILE_SCAN_TASK_SET_ID); + + Map<String, String> props = table.properties(); + + long tableSplitSize = PropertyUtil.propertyAsLong(props, SPLIT_SIZE, SPLIT_SIZE_DEFAULT); Review comment: One thing I was considering here is whether we should just be ignoring split_look_back and split_file_open cost. Both of these parameters kind of break our compaction behavior since really the only property we care about is split_size. I don't think there is an issue here really because the Compaction action can always force these values... so I don't know if you need to change it -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
