mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
IMPALA-3018: Fix AllocBuffer() and CopyStringVal() to handle empty strings.
AllocBuffer() and CopyStringVal() are two helper functions used by various UDAs to allocate buffers for StringVal during their Init() and Update() functions. Previously, these functions assumed that the buffer length is always greater than 0. That turned out to be an invalid assumption. This change removes this assumption and handles zero-length StringVal by initializing its 'ptr' to NULL and 'len' to 0. A new test is also added to exercise this case. Change-Id: Ia1e4140376c65ca3c734c40ecc3cce15b8bf2d3f Reviewed-on: http://gerrit.cloudera.org:8080/2211 Reviewed-by: Dan Hecht <dhecht@cloudera.com> Tested-by: Internal Jenkins
This commit is contained in:
committed by
Harrison Sheinblatt
parent
91d411fa39
commit
f9232c98b0
@@ -154,6 +154,15 @@ from alltypesagg where day is not null
|
||||
bigint, string, string, string, string
|
||||
====
|
||||
---- QUERY
|
||||
# Test for IMPALA-3018. Verify update() function of min() handles
|
||||
# zero-length string correctly.
|
||||
select min(str) from (values ('aaa' as str), ('')) as tmp
|
||||
---- RESULTS
|
||||
''
|
||||
---- TYPES
|
||||
String
|
||||
====
|
||||
---- QUERY
|
||||
# grouping by different data types, with NULLs
|
||||
select tinyint_col, count(*) from alltypesagg where day is not null group by 1 order by 1
|
||||
---- RESULTS
|
||||
|
||||
Reference in New Issue
Block a user