IMPALA-11230: Add test for crash in partitioned Top-N codegen code

User workloads hit a crash for certain queries that
use partitioned Top-N operators. The crash occurred
only when codegen is enabled. After investigation,
the crash was due to a nullptr being passed into
TupleRowComparator::Compare(). The issue was fixed
as part of IMPALA-10961.

This adds a test case with a SQL statement that
triggers a crash if IMPALA-10961 is not present.

Change-Id: I6909ef660b01ad3d301273deb8a8c31120445f79
Reviewed-on: http://gerrit.cloudera.org:8080/18389
Reviewed-by: Aman Sinha <amsinha@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Joe McDonnell
2022-04-06 14:41:18 -07:00
parent a0922079f5
commit 7b235eebd5

View File

@@ -323,3 +323,17 @@ STRING, STRING, STRING, STRING, DECIMAL, DECIMAL, DECIMAL, DECIMAL, DECIMAL, DEC
# Confirm that heaps were actually evicted due to memory pressure.
row_regex: .*InMemoryHeapsEvicted: .* \([1-9][0-9]*\)
====
---- QUERY
# IMPALA-11230: This is a minimal reproducing case for a crash in
# partitioned top-n codegen. This query requires a valid ScalarExprEvaluator
# in the TupleRowComparator::Compare() call. This was fixed by IMPALA-10961.
select count(*)
from (
select row_number() OVER (PARTITION BY ss_sold_date_sk ORDER BY CASE WHEN ss_promo_sk IN (101, 84) THEN 1 ELSE 0 END DESC) RN
from tpcds.store_sales) c
where c.rn = 1;
---- RESULTS
1824
---- TYPES
BIGINT
====