rdblue commented on a change in pull request #1563: URL: https://github.com/apache/iceberg/pull/1563#discussion_r501365481
########## File path: spark/src/test/java/org/apache/iceberg/spark/source/TestSparkBaseDataReader.java ########## @@ -0,0 +1,297 @@ +/* + * 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.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import org.apache.hadoop.conf.Configuration; +import org.apache.iceberg.BaseCombinedScanTask; +import org.apache.iceberg.DataFile; +import org.apache.iceberg.DataFiles; +import org.apache.iceberg.FileFormat; +import org.apache.iceberg.FileScanTask; +import org.apache.iceberg.PartitionSpec; +import org.apache.iceberg.encryption.PlaintextEncryptionManager; +import org.apache.iceberg.expressions.Expression; +import org.apache.iceberg.hadoop.HadoopFileIO; +import org.apache.iceberg.io.CloseableIterator; +import org.junit.Assert; +import org.junit.Test; + +public abstract class TestSparkBaseDataReader { + + private static final Configuration CONF = new Configuration(); + + // Simulates the closeable iterator of data to be read + private static class CloseableIntegerRange implements CloseableIterator<Integer> { Review comment: I think this is a good test to have, but I'm a little concerned about the number of classes it takes. Have you considered an alternative structure? What about using a `spy` object that is injected the same way, in the `ClosureTrackingReader.open` method? Then you'd be able to use normal file splits and planning with `TableTestBase`, and you'd be able to keep track of all the spies in the reader you instantiate. I think that would get rid of a few of these static classes, which would make this easier to understand and maintain. ---------------------------------------------------------------- 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]
