mikebridge commented on code in PR #45904:
URL: https://github.com/apache/superset/pull/45904#discussion_r4447350667
##########
tests/unit_tests/semantic_layers/cache_policy_test.py:
##########
@@ -188,6 +188,103 @@ def test_filter_implication_matrix(
assert cache_policy.implies(new_filter, cached_filter) is expected
[email protected](
+ "new_filter,cached_filter,expected",
+ [
+ # Empty IN is FALSE, so it proves every cached predicate it is
compared to.
+ (
+ where(COUNTRY, Operator.IN, frozenset()),
+ where(COUNTRY, Operator.IN, frozenset({"GB"})),
+ True,
+ ),
+ (
+ where(COUNTRY, Operator.IN, frozenset()),
+ where(COUNTRY, Operator.IS_NOT_NULL, None),
+ True,
+ ),
+ # Empty NOT IN is TRUE for NULL rows too, so it proves no narrower
cache.
+ (
+ where(COUNTRY, Operator.NOT_IN, frozenset()),
+ where(COUNTRY, Operator.IS_NOT_NULL, None),
+ False,
+ ),
+ (
+ where(COUNTRY, Operator.NOT_IN, frozenset()),
+ where(COUNTRY, Operator.NOT_IN, frozenset()),
+ True,
+ ),
+ ],
+)
+def test_empty_membership_implication(
+ new_filter: Filter,
+ cached_filter: Filter,
+ expected: bool,
+) -> None:
+ assert cache_policy.implies(new_filter, cached_filter) is expected
+
+
[email protected](
+ "operator,expected_countries,expected_revenue",
+ [
+ (Operator.IN, None, [None]),
Review Comment:
Added in 497ae38d39. The cache regression includes MIN and MAX and asserts
that ungrouped empty IN returns exactly one row, with both extrema equal to
explicitly typed Arrow float64 NULL arrays. This passed against the existing
production path, so the commit is test-only. The semantic-layer unit tests, SDK
semantic tests and MCP chart-data tests pass: 2,300 passed, 4 skipped.
--
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]