-
Notifications
You must be signed in to change notification settings - Fork 3k
Core: Make totalRecordCount optional in PartitionStats #12226
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
Changes from 4 commits
7ba9101
79e3b40
3f49981
9cfe5ab
91637db
e4a6033
7b288e8
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 |
|---|---|---|
|
|
@@ -270,12 +270,12 @@ public void testOptionalFieldsWriting() throws Exception { | |
| PartitionStats::positionDeleteFileCount, | ||
| PartitionStats::equalityDeleteRecordCount, | ||
| PartitionStats::equalityDeleteFileCount, | ||
| PartitionStats::totalRecordCount, | ||
| PartitionStats::totalRecords, | ||
| PartitionStats::lastUpdatedAt, | ||
| PartitionStats::lastUpdatedSnapshotId) | ||
| .isEqualTo( | ||
| Arrays.asList( | ||
| 0L, 0, 0L, 0, 0L, null, null)); // null counters must be initialized to zero. | ||
| 0L, 0, 0L, 0, null, null, null)); // null counters must be initialized to zero. | ||
|
|
||
| PartitionStatisticsFile statisticsFile = | ||
| PartitionStatsHandler.writePartitionStatsFile(testTable, 42L, dataSchema, expected); | ||
|
|
@@ -352,7 +352,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot1.timestampMillis(), | ||
| snapshot1.snapshotId()), | ||
| Tuple.tuple( | ||
|
|
@@ -365,7 +365,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot1.timestampMillis(), | ||
| snapshot1.snapshotId()), | ||
| Tuple.tuple( | ||
|
|
@@ -378,7 +378,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot1.timestampMillis(), | ||
| snapshot1.snapshotId()), | ||
| Tuple.tuple( | ||
|
|
@@ -391,7 +391,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot1.timestampMillis(), | ||
| snapshot1.snapshotId())); | ||
|
|
||
|
|
@@ -416,7 +416,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| eqDeletes.recordCount(), | ||
| 1, | ||
| 0L, | ||
| null, | ||
| snapshot3.timestampMillis(), | ||
| snapshot3.snapshotId()), | ||
| Tuple.tuple( | ||
|
|
@@ -429,7 +429,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot1.timestampMillis(), | ||
| snapshot1.snapshotId()), | ||
| Tuple.tuple( | ||
|
|
@@ -442,7 +442,7 @@ public void testPartitionStats() throws Exception { | |
| 1, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot2.timestampMillis(), | ||
| snapshot2.snapshotId()), | ||
| Tuple.tuple( | ||
|
|
@@ -455,7 +455,7 @@ public void testPartitionStats() throws Exception { | |
| 0, | ||
| 0L, | ||
| 0, | ||
| 0L, | ||
| null, | ||
| snapshot1.timestampMillis(), | ||
| snapshot1.snapshotId())); | ||
| } | ||
|
|
@@ -517,7 +517,7 @@ private static void computeAndValidatePartitionStats( | |
| PartitionStats::positionDeleteFileCount, | ||
| PartitionStats::equalityDeleteRecordCount, | ||
| PartitionStats::equalityDeleteFileCount, | ||
| PartitionStats::totalRecordCount, | ||
| PartitionStats::totalRecords, | ||
| PartitionStats::lastUpdatedAt, | ||
| PartitionStats::lastUpdatedSnapshotId) | ||
| .containsExactlyInAnyOrder(expectedValues); | ||
|
|
@@ -591,7 +591,7 @@ private static boolean isEqual( | |
| && stats1.positionDeleteFileCount() == stats2.positionDeleteFileCount() | ||
| && stats1.equalityDeleteRecordCount() == stats2.equalityDeleteRecordCount() | ||
| && stats1.equalityDeleteFileCount() == stats2.equalityDeleteFileCount() | ||
| && stats1.totalRecordCount() == stats2.totalRecordCount() | ||
| && Objects.equals(stats1.totalRecords(), stats2.totalRecords()) | ||
|
Contributor
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. not directly related to this PR, but why can't we handle equals/hashcode in
Member
Author
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.
It was discussed in one of the old PR. |
||
| && Objects.equals(stats1.lastUpdatedAt(), stats2.lastUpdatedAt()) | ||
| && Objects.equals(stats1.lastUpdatedSnapshotId(), stats2.lastUpdatedSnapshotId()); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
do we really need to deprecate the existing method and introduce a new one to handle this properly? I'm not a fan of having a method with
optionalin the name. Also what if the field itself becomes aLongbut the method's return type stays the same?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.
Maybe no one using it as the writer code is not present in previous version.
But just following the guidelines as it is a public interface and introduced in previous version.
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.
We wanted to return null when not computed as per the discussion. We can't do that if the return type is primitive.