-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Spark 3.3, 3.4: use a deterministic where condition to make rewrite_data_files… #6760
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 all commits
22b8722
f579cc7
6da89af
8e09dac
f67abe2
a27bf48
1aa2838
f31e4e3
304e52a
99f91c8
54ebdc5
38145a6
ed35030
24bdd88
4198b5f
e98a6e0
b8770b1
22f0e83
5570ed0
6d5b660
7d446e6
47a8359
e865f06
dc45f3d
9a5d87d
24aa16a
a298b97
26c8aec
d433101
5faac1e
4a026d3
b600d11
5bbb179
31588fe
0a4d2c2
2451995
5fc3614
fa865e8
3b0c395
bf413e1
0408626
e69ebdb
c006716
d500fe4
02e2f76
63dfe2f
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 |
|---|---|---|
|
|
@@ -245,6 +245,49 @@ public void testRewriteDataFilesWithFilter() { | |
| assertEquals("Data after compaction should not change", expectedRecords, actualRecords); | ||
| } | ||
|
|
||
| @Test | ||
| public void testRewriteDataFilesWithDeterministicTrueFilter() { | ||
| createTable(); | ||
| // create 10 files under non-partitioned table | ||
| insertData(10); | ||
| List<Object[]> expectedRecords = currentData(); | ||
| // select all 10 files for compaction | ||
| List<Object[]> output = | ||
| sql( | ||
| "CALL %s.system.rewrite_data_files(table => '%s', where => '1=1')", | ||
| catalogName, tableIdent); | ||
| assertEquals( | ||
| "Action should rewrite 10 data files and add 1 data files", | ||
| row(10, 1), | ||
|
Member
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. Optional: I think the test is more understandable if we just put row(10, 1, Long.valueOf(snapshotSummar().get(...)). I do realize its that way in other tests. |
||
| Arrays.copyOf(output.get(0), 2)); | ||
| // verify rewritten bytes separately | ||
| assertThat(output.get(0)).hasSize(3); | ||
| assertThat(output.get(0)[2]) | ||
| .isInstanceOf(Long.class) | ||
| .isEqualTo(Long.valueOf(snapshotSummary().get(SnapshotSummary.REMOVED_FILE_SIZE_PROP))); | ||
| List<Object[]> actualRecords = currentData(); | ||
| assertEquals("Data after compaction should not change", expectedRecords, actualRecords); | ||
| } | ||
|
|
||
| @Test | ||
| public void testRewriteDataFilesWithDeterministicFalseFilter() { | ||
| createTable(); | ||
| // create 10 files under non-partitioned table | ||
| insertData(10); | ||
| List<Object[]> expectedRecords = currentData(); | ||
| // select no files for compaction | ||
| List<Object[]> output = | ||
| sql( | ||
| "CALL %s.system.rewrite_data_files(table => '%s', where => '0=1')", | ||
| catalogName, tableIdent); | ||
| assertEquals( | ||
| "Action should rewrite 0 data files and add 0 data files", | ||
| row(0, 0), | ||
| Arrays.copyOf(output.get(0), 2)); | ||
|
Member
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. Do we get output=0,0,0? Can we just assert all 3 values instead of first two in this case?
Contributor
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. i think it is due to the first two values are of type of integer and the last one is of type of long.
Member
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. You mean the assert fails? How about row(0,0,0L?)
Contributor
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. |
||
| List<Object[]> actualRecords = currentData(); | ||
| assertEquals("Data after compaction should not change", expectedRecords, actualRecords); | ||
| } | ||
|
|
||
| @Test | ||
| public void testRewriteDataFilesWithFilterOnPartitionTable() { | ||
| createPartitionTable(); | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.