mickjermsurawong-stripe commented on a change in pull request #1563: URL: https://github.com/apache/iceberg/pull/1563#discussion_r501388147
########## 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 retain 2 helper classes here. One is the reader to test, and the other is this `CloseableIterator`. I was hoping i could somehow open the `FileScanTask` to a spy of `CloseableIterator`, and I could check invocation on `close`. However, I don't seem to find any impl of `CloseableIterator` readily available here. Any existing opening of task to iterator would also invoke other unneeded logic. - TableTestBase in core isn't actually visible from this test. So instead of mocking the file scan task, I create dummy table and extract the planned files instead. ---------------------------------------------------------------- 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]
