rdblue commented on a change in pull request #853: Task data reader changes for 
vectorized reads
URL: https://github.com/apache/incubator-iceberg/pull/853#discussion_r395836481
 
 

 ##########
 File path: 
spark/src/main/java/org/apache/iceberg/spark/source/BaseDataReader.java
 ##########
 @@ -0,0 +1,117 @@
+/*
+ * 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 com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.iceberg.CombinedScanTask;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.encryption.EncryptedFiles;
+import org.apache.iceberg.encryption.EncryptionManager;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.InputFile;
+import org.apache.spark.rdd.InputFileBlockHolder;
+import org.apache.spark.sql.sources.v2.reader.InputPartitionReader;
+
+/**
+ * @param <T> Base class of readers to read data as objects of type @param 
&lt;T&gt;
+ */
+@SuppressWarnings("checkstyle:VisibilityModifier")
+abstract class BaseDataReader<T> implements InputPartitionReader<T> {
+  final Iterator<FileScanTask> tasks;
+  final Schema tableSchema;
+  final Schema expectedSchema;
+  final FileIO fileIo;
+  final Map<String, InputFile> inputFiles;
+  final boolean caseSensitive;
+
+  Iterator<T> currentIterator;
+  Closeable currentCloseable = null;
+  T current = null;
+  final int batchSize;
 
 Review comment:
   We need to clean up how these instance fields are shared. Some, like 
`tableSchema`, `expectedSchema`, `caseSensitive` don't need to be held by this 
class and should be removed. I think we need a `protected` method to get an 
`InputFile` from `inputFiles`. And I think that `tasks` isn't shared and can be 
private.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to