-
Notifications
You must be signed in to change notification settings - Fork 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
Fix reading NDV using Iceberg metadata on table with NULL partitions #21844
Changes from all commits
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 |
---|---|---|
|
@@ -118,6 +118,30 @@ public void testOptimization() | |
values(ImmutableList.of("b", "c"), ImmutableList.of()))); | ||
} | ||
|
||
@Test | ||
public void testOptimizationWithNullPartitions() | ||
{ | ||
String testTable = "test_metadata_optimization_with_null_partitions"; | ||
|
||
getPlanTester().executeStatement(format( | ||
"CREATE TABLE %s (a, b, c) WITH (PARTITIONING = ARRAY['b', 'c'])" + | ||
"AS VALUES (5, 6, CAST(NULL AS INTEGER)), (8, 9, CAST(NULL AS INTEGER))", | ||
testTable)); | ||
|
||
Session session = Session.builder(getPlanTester().getDefaultSession()) | ||
.setSystemProperty("optimize_metadata_queries", "true") | ||
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. @raunaqmorarka we've been speaking already on |
||
.build(); | ||
|
||
assertPlan( | ||
format("SELECT DISTINCT b, c FROM %s ORDER BY b", testTable), | ||
session, | ||
anyTree(values( | ||
ImmutableList.of("b", "c"), | ||
ImmutableList.of( | ||
ImmutableList.of(new Constant(INTEGER, 6L), new Constant(INTEGER, null)), | ||
ImmutableList.of(new Constant(INTEGER, 9L), new Constant(INTEGER, null)))))); | ||
} | ||
|
||
@AfterAll | ||
public void cleanup() | ||
throws Exception | ||
|
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.
Did you consider calling the
NullableValue
constructor instead?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 question. I don't have a preference. I don't quite understand why it has both constructor and static methods.
Which way do you think is better?
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.
they have different semantics --
NullableValue.of
doesn't allow null value(i with the difference was more obvious from the NullableValue class's api)