rdblue commented on a change in pull request #1497:
URL: https://github.com/apache/iceberg/pull/1497#discussion_r496880204
##########
File path: data/src/test/java/org/apache/iceberg/data/DeletesReadTest.java
##########
@@ -25,53 +25,68 @@
import org.apache.iceberg.DataFile;
import org.apache.iceberg.DeleteFile;
import org.apache.iceberg.Files;
+import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Table;
-import org.apache.iceberg.TableTestBase;
import org.apache.iceberg.TestHelpers.Row;
-import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.iceberg.relocated.com.google.common.collect.Sets;
+import org.apache.iceberg.types.Types;
import org.apache.iceberg.util.ArrayUtil;
import org.apache.iceberg.util.Pair;
import org.apache.iceberg.util.StructLikeSet;
import org.apache.iceberg.util.StructProjection;
+import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
-public class TestGenericReaderDeletes extends TableTestBase {
- public TestGenericReaderDeletes() {
- super(2 /* format v2 with delete files */);
- }
+import static org.apache.iceberg.types.Types.NestedField.required;
- private List<Record> records = null;
- private DataFile dataFile = null;
+public abstract class DeletesReadTest {
+ // Schema passed to create tables
+ public static final Schema SCHEMA = new Schema(
+ required(1, "id", Types.IntegerType.get()),
+ required(2, "data", Types.StringType.get())
+ );
- @Before
- public void writeTestDataFile() throws IOException {
- this.records = Lists.newArrayList();
+ // Partition spec used to create tables
+ public static final PartitionSpec SPEC = PartitionSpec.builderFor(SCHEMA)
+ .bucket("data", 16)
+ .build();
- // records all use IDs that are in bucket id_bucket=0
- GenericRecord record = GenericRecord.create(table.schema());
- records.add(record.copy("id", 29, "data", "a"));
- records.add(record.copy("id", 43, "data", "b"));
- records.add(record.copy("id", 61, "data", "c"));
- records.add(record.copy("id", 89, "data", "d"));
- records.add(record.copy("id", 100, "data", "e"));
- records.add(record.copy("id", 121, "data", "f"));
- records.add(record.copy("id", 122, "data", "g"));
+ protected final String testTableName = "test";
+ protected Table testTable;
+ protected DataFile dataFile;
Review comment:
Why are these protected and not private?
My earlier suggestion was to avoid sharing fields with subclasses because
the tests are all in this class. Only creating a table and reading it needs to
be customized by subclasses, and we can pass in anything necessary to do that.
----------------------------------------------------------------
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]