From 5f0d20e5bbcd46225f1c3230e4037cb62eafbe4b Mon Sep 17 00:00:00 2001 From: shuke987 Date: Mon, 15 Jun 2026 16:30:49 +0800 Subject: [PATCH] [fix](case) one_col_range_partition: query a date range that has data The CASE WHEN at this assertion simplifies to `dt >= '2021-05-01'`, but the table's data only spans 2020-01-01 ~ 2021-02-20 (10000 hours), so that range contains no data. The optimizer now correctly prunes the all-empty partitions to VEMPTYSET (verified: a plain `dt >= '2021-05-01'` prunes the same way, and inserting a matching row immediately makes it scan that partition and return the row), so the stale `partitions=417/1826` expectation no longer holds. This is not a correctness bug -- the result is correct (0 rows, nothing matches). Change the threshold to '2021-1-15' (within the data range) so the CASE WHEN prunes to a real, non-empty partition set; update the expected count to 37/1826. Scope check: this is the only stale assertion in the suite (the sibling CASE WHEN near line 261 still yields 417/1826 and is left unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../partition_prune/one_col_range_partition.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regression-test/suites/nereids_rules_p0/partition_prune/one_col_range_partition.groovy b/regression-test/suites/nereids_rules_p0/partition_prune/one_col_range_partition.groovy index 4d1e3eb223b1a7..4e234d04ce817f 100644 --- a/regression-test/suites/nereids_rules_p0/partition_prune/one_col_range_partition.groovy +++ b/regression-test/suites/nereids_rules_p0/partition_prune/one_col_range_partition.groovy @@ -254,9 +254,9 @@ suite("one_col_range_partition") { contains("partitions=417/1826") } explain { - sql """SELECT * FROM one_col_range_partition_date WHERE case when dt<'2021-1-01 00:00:00' then false when dt<'2021-5-01' then false + sql """SELECT * FROM one_col_range_partition_date WHERE case when dt<'2021-1-01 00:00:00' then false when dt<'2021-1-15' then false else true end;""" - contains("partitions=417/1826") + contains("partitions=37/1826") } explain { sql """SELECT * FROM one_col_range_partition_date WHERE case when dt<'2022-1-01 00:00:00' then dt