mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
IMPALA-3018: Don't return NULL on zero length allocations.
FunctionContext::Allocate() and FunctionContext::AllocateLocal() used to return NULL for zero length allocations. This makes it hard to distinguish between allocation failures and zero length allocations. Such confusion may lead to DCHECK failure in the macro RETURN_IF_NULL() in debug builds or access to NULL pointers in non-debug builds. This change fixes the problem above by returning NULL only if there is allocation failure. Zero-length allocations will always return a dummy non-NULL pointer. Change-Id: Id8c3211f4d9417f44b8018ccc58ae182682693da Reviewed-on: http://gerrit.cloudera.org:8080/3601 Reviewed-by: Michael Ho <kwho@cloudera.com> Tested-by: Internal Jenkins
This commit is contained in:
committed by
Taras Bobrovytsky
parent
900f148078
commit
f129dfd202
@@ -154,13 +154,31 @@ from alltypesagg where day is not null
|
||||
bigint, string, string, string, string
|
||||
====
|
||||
---- QUERY
|
||||
# Test for IMPALA-3018. Verify update() function of min() handles
|
||||
# Test for IMPALA-3018. Verify update() functions of min() and max() handle
|
||||
# zero-length string correctly.
|
||||
select min(str) from (values ('aaa' as str), ('')) as tmp
|
||||
select max(str), min(str) from (values ('aaa' as str), (''), ('123')) as tmp
|
||||
---- RESULTS
|
||||
'aaa',''
|
||||
---- TYPES
|
||||
string,string
|
||||
====
|
||||
---- QUERY
|
||||
# Test for IMPALA-3018. Verify update() function of last_value() handles
|
||||
# zero-length string correctly.
|
||||
select last_value(b) over (partition by a order by d) from functional.nulltable;
|
||||
---- RESULTS
|
||||
''
|
||||
---- TYPES
|
||||
String
|
||||
string
|
||||
====
|
||||
---- QUERY
|
||||
# Test for IMPALA-3018. Verify update() function of first_value() handles
|
||||
# zero-length string correctly.
|
||||
select first_value(b) over (partition by a order by d) from functional.nulltable;
|
||||
---- RESULTS
|
||||
''
|
||||
---- TYPES
|
||||
string
|
||||
====
|
||||
---- QUERY
|
||||
# grouping by different data types, with NULLs
|
||||
|
||||
Reference in New Issue
Block a user