jaykanakiya commented on code in PR #19704:
URL: https://github.com/apache/druid/pull/19704#discussion_r3810669041
##########
processing/src/test/java/org/apache/druid/timeline/partition/DimensionValueSetShardSpecTest.java:
##########
@@ -310,4 +333,245 @@ public void testEmptyAllowedList_prunesEverything()
final DimensionValueSetShardSpec s = spec(ImmutableMap.of(TENANT,
List.of()));
Assertions.assertFalse(s.possibleInDomain(domain(TENANT, "tenant_a")));
}
+
+ @Test
+ public void testStringDomain_skipsTypeStampedDimension()
+ {
+ // A LONG-stamped dim holds canonicalized values ("1"); a non-canonical
selector like code = "00001" matches
+ // the indexed LONG via coercion, so the literal string range must not
prune this segment.
+ final DimensionValueSetShardSpec s = spec(
+ ImmutableMap.of(CODE, List.of("1")),
+ ImmutableMap.of(CODE, ColumnType.LONG)
+ );
+ Assertions.assertTrue(s.possibleInDomain(domain(CODE, "00001")));
+ }
+
+ @Test
+ public void testNullDomain_prunesTypeStampedDimensionWithoutNull()
+ {
+ // IS NULL yields no typed value set, so it is pruned here (not by
possibleInValueDomain): a segment with no null
+ // observed cannot match.
+ final DimensionValueSetShardSpec s = spec(
+ ImmutableMap.of(CODE, List.of("1", "2")),
+ ImmutableMap.of(CODE, ColumnType.LONG)
+ );
+ Assertions.assertFalse(s.possibleInDomain(nullDomain(CODE)));
+ }
+
+ @Test
+ public void testNullDomain_keepsTypeStampedDimensionThatObservedNull()
+ {
+ // A LONG-stamped dim that observed a null value must be kept for an IS
NULL query.
+ final DimensionValueSetShardSpec s = spec(
+ ImmutableMap.of(CODE, Arrays.asList("1", null)),
+ ImmutableMap.of(CODE, ColumnType.LONG)
+ );
+ Assertions.assertTrue(s.possibleInDomain(nullDomain(CODE)));
+ }
+
+ @Test
+ public void
testMixedNullAndValueDomain_defersTypeStampedDimensionToValueChannel()
Review Comment:
Good catch on the null path. I added testPruneDimValueSetIsNull, which
covers the genuinely reachable null path end-to-end through the real
FilterSegmentPruner: IS NULL on a LONG-stamped segment prunes one that observed
no null and keeps one that did.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]