-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: fix reading of split offsets in manifests #8834
Changes from all commits
11cd94f
22ed9e8
14ee4c0
4671f82
bb2dff6
5d64655
44a5891
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
*/ | ||
package org.apache.iceberg; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
@@ -28,6 +30,7 @@ | |
import org.apache.iceberg.relocated.com.google.common.collect.Streams; | ||
import org.apache.iceberg.types.Types; | ||
import org.assertj.core.api.Assertions; | ||
import org.assertj.core.api.recursive.comparison.RecursiveComparisonConfiguration; | ||
import org.junit.Assert; | ||
import org.junit.Assume; | ||
import org.junit.Test; | ||
|
@@ -41,6 +44,12 @@ public static Object[] parameters() { | |
return new Object[] {1, 2}; | ||
} | ||
|
||
private static final RecursiveComparisonConfiguration FILE_COMPARISON_CONFIG = | ||
RecursiveComparisonConfiguration.builder() | ||
.withIgnoredFields( | ||
"dataSequenceNumber", "fileOrdinal", "fileSequenceNumber", "fromProjectionPos") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this will compare split offsets now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it will compare all fields from the input data files, except for these excluded fields which aren't expected to match |
||
.build(); | ||
|
||
public TestManifestReader(int formatVersion) { | ||
super(formatVersion); | ||
} | ||
|
@@ -61,16 +70,14 @@ public void testReaderWithFilterWithoutSelect() throws IOException { | |
ManifestFile manifest = writeManifest(1000L, FILE_A, FILE_B, FILE_C); | ||
try (ManifestReader<DataFile> reader = | ||
ManifestFiles.read(manifest, FILE_IO).filterRows(Expressions.equal("id", 0))) { | ||
List<String> files = | ||
Streams.stream(reader).map(file -> file.path().toString()).collect(Collectors.toList()); | ||
List<DataFile> files = Streams.stream(reader).collect(Collectors.toList()); | ||
|
||
// note that all files are returned because the reader returns data files that may match, and | ||
// the partition is | ||
// bucketing by data, which doesn't help filter files | ||
Assert.assertEquals( | ||
"Should read the expected files", | ||
Lists.newArrayList(FILE_A.path(), FILE_B.path(), FILE_C.path()), | ||
files); | ||
assertThat(files) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this can be simplified to
that way you don't need the static final field for the comparison config There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My thought was the config variable could be reused in other tests |
||
.usingRecursiveComparison(FILE_COMPARISON_CONFIG) | ||
.isEqualTo(Lists.newArrayList(FILE_A, FILE_B, FILE_C)); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 Good catch.