IMPALA-5580: fix Java UDFs that return NULL strings

In commit 741421de, we accidently made it so that is_null=true
StringVals became is_null=false with len=0. Fix that and add
a regression test.

Change-Id: I34d288aad66a2609484058c9a177c02200cb6a6e
Reviewed-on: http://gerrit.cloudera.org:8080/7364
Reviewed-by: Bharath Vissapragada <bharathv@cloudera.com>
Tested-by: Impala Public Jenkins
This commit is contained in:
Dan Hecht
2017-07-06 13:49:53 -07:00
committed by Impala Public Jenkins
parent 9037b8e385
commit 924066a4fa
2 changed files with 28 additions and 31 deletions

View File

@@ -22,71 +22,67 @@ DOUBLE
====
---- QUERY
# Test identity functions
select identity(true);
select identity(true), identity(cast(NULL as boolean));
---- TYPES
boolean
boolean, boolean
---- RESULTS
true
true,NULL
====
---- QUERY
select identity(cast(10 as tinyint));
select identity(cast(10 as tinyint)), identity(cast(NULL as tinyint));
---- TYPES
tinyint
tinyint, tinyint
---- RESULTS
10
10,NULL
====
---- QUERY
select identity(cast(10 as smallint));
select identity(cast(10 as smallint)), identity(cast(NULL as smallint));
---- TYPES
smallint
smallint, smallint
---- RESULTS
10
10,NULL
====
---- QUERY
select identity(cast(10 as int));
select identity(cast(10 as int)), identity(cast(NULL as int));
---- TYPES
int
int, int
---- RESULTS
10
10,NULL
====
---- QUERY
select identity(cast(10 as bigint));
select identity(cast(10 as bigint)), identity(cast(NULL as bigint));
---- TYPES
bigint
bigint, bigint
---- RESULTS
10
10,NULL
====
---- QUERY
select identity(cast(10.0 as float));
select identity(cast(10.0 as float)), identity(cast(NULL as float));
---- TYPES
float
float, float
---- RESULTS
10
10,NULL
====
---- QUERY
select identity(cast(10.0 as double));
select identity(cast(10.0 as double)), identity(cast(NULL as double));
---- TYPES
double
double, double
---- RESULTS
10
10,NULL
====
---- QUERY
# IMPALA-1456. Each "identity" call below tests a different type (BytesWritable, Text,
# and String).
select identity("why hello there"),
identity("why", " hello there"),
identity("why", " hello", " there");
identity("why", " hello", " there"),
identity(cast(NULL as string)),
identity(cast(NULL as string), cast(NULL as string)),
identity(cast(NULL as string), cast(NULL as string), cast(NULL as string));
---- TYPES
string, string, string
string, string, string, string, string, string
---- RESULTS
'why hello there','why hello there','why hello there'
====
---- QUERY
select identity(NULL);
---- TYPES
boolean
---- RESULTS
NULL
'why hello there','why hello there','why hello there','NULL','NULL','NULL'
====
---- QUERY
# IMPALA-1134. Each "identity" call below tests a different type (BytesWritable, Text,