chenjunjiedada commented on a change in pull request #1497:
URL: https://github.com/apache/iceberg/pull/1497#discussion_r496456617
##########
File path: data/src/test/java/org/apache/iceberg/data/DeletesReadTest.java
##########
@@ -25,49 +25,45 @@
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.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 Table table;
+ protected DataFile dataFile;
- this.dataFile = FileHelpers.writeDataFile(table,
Files.localOutput(temp.newFile()), Row.of(0), records);
+ private List<Record> records;
- table.newAppend()
- .appendFile(dataFile)
- .commit();
- }
+ @Rule
+ public TemporaryFolder temp = new TemporaryFolder();
+
+ public abstract Table createTable(String name, Schema schema, PartitionSpec
spec) throws IOException;
Review comment:
Updated to protected.
----------------------------------------------------------------
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]