Fix NULL issues.

This commit is contained in:
Alex Behm
2013-03-21 15:14:14 -07:00
committed by Henry Robinson
parent 189f4313dc
commit 1b2e8280d4
41 changed files with 1152 additions and 407 deletions

View File

@@ -829,3 +829,25 @@ timestamp, bigint
2010-01-01 01:03:19.530000000,1
2010-01-01 01:04:20.160000000,1
====
---- QUERY
# Test NULLs in aggregate functions
select count(NULL), min(NULL), max(NULL), sum(NULL), avg(NULL) from alltypesagg
---- TYPES
bigint, NULL, NULL, NULL, double
---- RESULTS
0,NULL,NULL,NULL,NULL
====
---- QUERY
# Test ignored distinct in MIN and MAX with NULLs
---- TYPES
NULL, NULL
---- RESULTS
NULL,NULL
---- QUERY
# TODO: Fix count(distinct null) to return 0 instead of 1
select count(distinct NULL) from alltypesagg
---- TYPES
bigint
---- RESULTS
1
====

View File

@@ -694,6 +694,63 @@ boolean
true
====
---- QUERY
# IN predicate with NULLs and other types
select NULL in ('a', NULL, 'b')
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select NULL not in ('a', NULL, 'b')
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select NULL not in (1.0, NULL, 2.0)
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select NULL in (1.0, NULL, 2.0)
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select NULL in (true, NULL, false)
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select NULL not in (true, NULL, false)
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select true in (NULL, false)
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select true not in (NULL, false)
---- TYPES
boolean
---- RESULTS
NULL
====
---- QUERY
select count(*) from alltypesagg
where true in (bool_col, tinyint_col)
---- TYPES

View File

@@ -15,16 +15,42 @@ RELOAD nullinsert
---- TYPES
string, string, string, string, int
---- RESULTS
'NULL','','NULL','\N',NULL
'NULL','','NULL','NULL',NULL
====
---- QUERY
select * from alt_nullinsert
select * from nullinsert_alt
---- SETUP
RELOAD alt_nullinsert
RELOAD nullinsert_alt
---- TYPES
string
---- RESULTS
'\N,,NULL,\\N,\N'
'\N,,NULL,\N,\N'
====
---- QUERY
# Test inserting NULLs for all types
insert overwrite table alltypesnopart_insert
select NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
from alltypessmall limit 10
---- RESULTS
: 10
====
---- QUERY
select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col,
float_col, double_col, date_string_col, string_col, timestamp_col
from alltypesnopart_insert
---- TYPES
int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp
---- RESULTS
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'NULL','NULL',NULL
====
---- QUERY
# Test NULL partition keys using static partition insert. Both partitions keys are NULL.
@@ -71,7 +97,7 @@ year=__HIVE_DEFAULT_PARTITION__/month=10/: 25
====
---- QUERY
# Verify contents of alltypesinsert.
select cout(*) from alltypesinsert where year is null and month=10
select count(*) from alltypesinsert where year is null and month=10
---- TYPES
bigint
---- RESULTS

View File

@@ -706,7 +706,7 @@ select 2, 'b', NULL, 20.0f
union all
select 3, 'c', NULL, 30.0f
---- TYPES
tinyint, string, boolean, float
tinyint, string, null, float
---- RESULTS: VERIFY_IS_EQUAL_SORTED
1,'a',NULL,10.0
2,'b',NULL,20.0
@@ -720,7 +720,7 @@ select 2, 'b', NULL, 20.0f
union distinct
select 1, 'a', NULL, 10.0f
---- TYPES
tinyint, string, boolean, float
tinyint, string, null, float
---- RESULTS: VERIFY_IS_EQUAL_SORTED
1,'a',NULL,10.0
2,'b',NULL,20.0