diff --git a/be/src/runtime/buffered-tuple-stream.cc b/be/src/runtime/buffered-tuple-stream.cc index c87549dbe..6403bae75 100644 --- a/be/src/runtime/buffered-tuple-stream.cc +++ b/be/src/runtime/buffered-tuple-stream.cc @@ -639,7 +639,7 @@ int64_t BufferedTupleStream::ComputeRowSize(TupleRow* row) const { for (int i = 0; i < desc_.tuple_descriptors().size(); ++i) { const TupleDescriptor* tuple_desc = desc_.tuple_descriptors()[i]; Tuple* tuple = row->GetTuple(i); - DCHECK(nullable_tuple_ || tuple != NULL); + DCHECK(nullable_tuple_ || tuple_desc->byte_size() == 0 || tuple != NULL); if (tuple == NULL) continue; size += tuple->TotalByteSize(*tuple_desc); } diff --git a/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test b/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test index 4e9e19719..0402e5f46 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test +++ b/testdata/workloads/functional-query/queries/QueryTest/nested-types-tpch.test @@ -91,3 +91,17 @@ limit 10; ---- TYPES bigint,string,bigint,string ==== +---- QUERY +# IMPALA-2335: non-nullable zero-width tuples can be NULL. This query hit a DCHECK. +# In this query no slots of the supplier.s_partssupps array are materialized, so there +# are NULL tuples once the array is unnested. +SELECT t2.s_name +FROM tpch_nested_parquet.customer t1 +INNER JOIN tpch_nested_parquet.supplier t2 + ON t2.s_phone = t1.c_phone AND t2.s_acctbal = t1.c_acctbal, +t2.s_partsupps t3 +WHERE t2.s_suppkey > t2.s_nationkey; +---- RESULTS +---- TYPES +string +====