diff --git a/core/src/main/java/org/apache/iceberg/ManifestGroup.java b/core/src/main/java/org/apache/iceberg/ManifestGroup.java index ad7ed1fb15d1..1120bdfb36d3 100644 --- a/core/src/main/java/org/apache/iceberg/ManifestGroup.java +++ b/core/src/main/java/org/apache/iceberg/ManifestGroup.java @@ -164,7 +164,7 @@ public CloseableIterable planFiles() { boolean dropStats = ManifestReader.dropStats(dataFilter, columns); if (!deleteFiles.isEmpty()) { - select(Lists.newArrayList(ManifestReader.withStatsColumns(columns))); + select(ManifestReader.withStatsColumns(columns)); } Iterable> tasks = entries((manifest, entries) -> { diff --git a/core/src/main/java/org/apache/iceberg/ManifestReader.java b/core/src/main/java/org/apache/iceberg/ManifestReader.java index 75ea1272aa99..3a151a97bd9e 100644 --- a/core/src/main/java/org/apache/iceberg/ManifestReader.java +++ b/core/src/main/java/org/apache/iceberg/ManifestReader.java @@ -88,7 +88,7 @@ private String fileClass() { private Expression partFilter = alwaysTrue(); private Expression rowFilter = alwaysTrue(); private Schema fileProjection = null; - private Collection columns = null; + private List columns = null; private boolean caseSensitive = true; // lazily initialized @@ -143,7 +143,7 @@ public PartitionSpec spec() { return spec; } - public ManifestReader select(Collection newColumns) { + public ManifestReader select(List newColumns) { Preconditions.checkState(fileProjection == null, "Cannot select columns using both select(String...) and project(Schema)"); this.columns = newColumns; @@ -296,7 +296,7 @@ static boolean dropStats(Expression rowFilter, Collection columns) { Sets.intersection(Sets.newHashSet(columns), STATS_COLUMNS).isEmpty(); } - static Collection withStatsColumns(Collection columns) { + static List withStatsColumns(List columns) { if (columns.containsAll(ManifestReader.ALL_COLUMNS)) { return columns; } else { diff --git a/core/src/test/java/org/apache/iceberg/TestManifestReaderStats.java b/core/src/test/java/org/apache/iceberg/TestManifestReaderStats.java index 0f4b483cdced..41d31d16bb51 100644 --- a/core/src/test/java/org/apache/iceberg/TestManifestReaderStats.java +++ b/core/src/test/java/org/apache/iceberg/TestManifestReaderStats.java @@ -24,8 +24,8 @@ import java.util.Map; import org.apache.iceberg.expressions.Expressions; import org.apache.iceberg.io.CloseableIterable; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; -import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet; import org.apache.iceberg.types.Conversions; import org.apache.iceberg.types.Types; import org.junit.Assert; @@ -88,7 +88,7 @@ public void testReadWithFilterIncludesFullStats() throws IOException { public void testReadEntriesWithFilterAndSelectIncludesFullStats() throws IOException { ManifestFile manifest = writeManifest(1000L, FILE); try (ManifestReader reader = ManifestFiles.read(manifest, FILE_IO) - .select(ImmutableSet.of("file_path")) + .select(ImmutableList.of("file_path")) .filterRows(Expressions.equal("id", 3))) { CloseableIterable> entries = reader.entries(); ManifestEntry entry = entries.iterator().next(); @@ -100,7 +100,7 @@ public void testReadEntriesWithFilterAndSelectIncludesFullStats() throws IOExcep public void testReadIteratorWithFilterAndSelectDropsStats() throws IOException { ManifestFile manifest = writeManifest(1000L, FILE); try (ManifestReader reader = ManifestFiles.read(manifest, FILE_IO) - .select(ImmutableSet.of("file_path")) + .select(ImmutableList.of("file_path")) .filterRows(Expressions.equal("id", 3))) { DataFile entry = reader.iterator().next(); assertStatsDropped(entry); @@ -110,7 +110,7 @@ public void testReadIteratorWithFilterAndSelectDropsStats() throws IOException { public void testReadIteratorWithFilterAndSelectStatsIncludesFullStats() throws IOException { ManifestFile manifest = writeManifest(1000L, FILE); try (ManifestReader reader = ManifestFiles.read(manifest, FILE_IO) - .select(ImmutableSet.of("file_path", "value_counts")) + .select(ImmutableList.of("file_path", "value_counts")) .filterRows(Expressions.equal("id", 3))) { DataFile entry = reader.iterator().next(); assertFullStats(entry); @@ -121,7 +121,7 @@ public void testReadIteratorWithFilterAndSelectStatsIncludesFullStats() throws I public void testReadEntriesWithSelectNotIncludeFullStats() throws IOException { ManifestFile manifest = writeManifest(1000L, FILE); try (ManifestReader reader = ManifestFiles.read(manifest, FILE_IO) - .select(ImmutableSet.of("file_path"))) { + .select(ImmutableList.of("file_path"))) { CloseableIterable> entries = reader.entries(); ManifestEntry entry = entries.iterator().next(); assertNoStats(entry.file()); @@ -131,7 +131,7 @@ public void testReadEntriesWithSelectNotIncludeFullStats() throws IOException { public void testReadEntriesWithSelectCertainStatNotIncludeFullStats() throws IOException { ManifestFile manifest = writeManifest(1000L, FILE); try (ManifestReader reader = ManifestFiles.read(manifest, FILE_IO) - .select(ImmutableSet.of("file_path", "value_counts"))) { + .select(ImmutableList.of("file_path", "value_counts"))) { DataFile dataFile = reader.iterator().next(); Assert.assertEquals(-1, dataFile.recordCount());