Files
impala/testdata/workloads/functional-query/queries/QueryTest/chars.test
Victor Bittorf 658f05f63c IMPALA-1316: crash on VARCHAR join
Fixed codegen issue casing some VARCHAR joins to crash.

Change-Id: Ib2674199a3b2c3c5a5fd63cfae0b64e3b1ca158b
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4616
Reviewed-by: Victor Bittorf <victor.bittorf@cloudera.com>
Tested-by: jenkins
2014-10-06 15:11:10 -07:00

232 lines
6.3 KiB
Plaintext

====
---- QUERY
# TODO: string literals should start as CHAR(N) and analysis should promote as necessary
# TODO: Test min/max aggregates on CHAR(N)
# TODO: Test hash joins on varchar to char
insert into test_char_tmp select cast("hello" as char(5))
====
---- QUERY
select * from test_char_tmp
---- TYPES
char
---- RESULTS
'hello'
====
---- QUERY
# Regression test for IMPALA-1248
insert into test_char_tmp values (cast("hel" as char(5)))
====
---- QUERY
insert into test_char_tmp select cast(cast("hello000" as VARCHAR(8)) as char(5))
====
---- QUERY
select * from test_char_tmp where c = cast('hel' as char(5))
---- TYPES
char
---- RESULTS
'hel '
====
---- QUERY
insert into test_char_tmp values (NULL)
====
---- QUERY
select * from test_char_tmp as A CROSS JOIN test_char_tmp as B
where B.c = cast('hel' as CHAR(5))
ORDER BY A.c
---- TYPES
char, char
---- RESULTS
'hel ','hel '
'hello','hel '
'hello','hel '
'NULL','hel '
====
---- QUERY
select * from test_char_tmp as A, test_char_tmp as B
where A.c = B.c AND A.c != 'hello'
---- TYPES
char, char
---- RESULTS
'hel ','hel '
====
---- QUERY
select lower(c) from test_char_tmp ORDER BY c
---- TYPES
string
---- RESULTS
'hel '
'hello'
'hello'
'NULL'
====
---- QUERY
insert into test_varchar_tmp values (cast("hello" as varchar(5)))
====
---- QUERY
select * from test_varchar_tmp
---- TYPES
string
---- RESULTS
'hello'
====
---- QUERY
insert into test_varchar_tmp values (cast("xyzzzzz12" as varchar(7)))
---- CATCH
would need to be cast to VARCHAR(5)
====
---- QUERY
insert into test_varchar_tmp values (cast("hel" as varchar(4)))
====
---- QUERY
select * from test_varchar_tmp
---- TYPES
string
---- RESULTS
'hello'
'hel'
====
---- QUERY
insert into allchars values (cast("123456" as char(5)), cast("123456" as char(140)),
cast("123456" as varchar(5)))
====
---- QUERY
select cshort, clong, vc from allchars
---- TYPES
char,char,string
---- RESULTS
'12345','123456 ','12345'
====
---- QUERY
insert into allchars_par values (cast("123456" as char(5)), cast("123456" as char(140)),
cast("123456" as varchar(5)))
====
---- QUERY
select cshort, clong, vc from allchars_par
---- TYPES
char,char,string
---- RESULTS
'12345','123456 ','12345'
=======
---- QUERY
select count(*), count(cs), count(cl), count(vc) from chars_tiny
---- TYPES
bigint,bigint,bigint,bigint
---- RESULTS
9,8,8,8
====
---- QUERY
select * from chars_tiny where cs = cast('6a' as CHAR(2))
---- TYPES
char,char,string
---- RESULTS
'6a ','6b ','6c'
'6a ','6b ','6c'
====
---- QUERY
select count(*) from chars_tiny where vc != cast('5c' as varchar(3))
---- TYPES
bigint
---- RESULTS
7
====
---- QUERY
select count(*) from chars_tiny where cs != cast('a' as char(3))
---- TYPES
bigint
---- RESULTS
7
====
---- QUERY
select count(DISTINCT cs) from chars_tiny where vc = cast('5c' as varchar(10))
---- TYPES
bigint
---- RESULTS
1
====
---- QUERY
select count(DISTINCT cs) from chars_tiny where cs = cast('5a' as char(10))
---- TYPES
bigint
---- RESULTS
1
====
---- QUERY
select cs, count(cl) from functional.chars_tiny group by cs having count(vc) > 1
---- TYPES
char, bigint
---- RESULTS
'6a ',2
====
---- QUERY
select A.cs from functional.chars_tiny as A, functional.chars_tiny as B where
cast(A.cs as char(1)) = cast(B.cl as char(1)) order by A.cs
---- TYPES
char
---- RESULTS
'1aaaa'
'2aaaa'
'3aaa '
'4aa '
'5a '
'6a '
'6a '
'6a '
'6a '
====
---- QUERY
drop table if exists char_parts
====
---- QUERY
create table if not exists char_parts (vc varchar(32)) partitioned by
(csp char(5), clp char(140), vcp varchar(32))
====
---- QUERY
insert into char_parts (csp, clp, vcp, vc) select cs, cl, vc, vc from chars_tiny
====
---- QUERY
select csp, clp, vcp from char_parts where csp != cast('dne' as char(5)) order by csp
---- TYPES
char, char, string
---- RESULTS
'1aaaa','1bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb','1cccc'
'2aaaa','2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb','2cccccc'
'3aaa ','3bbbbb ','3ccc'
'4aa ','4bbbb ','4cc'
'5a ','5bbb ','5c'
'6a ','6b ','6c'
'6a ','6b ','6c'
'a ','b ','c'
====
---- QUERY
insert into char_parts partition (csp=cast('foo' as char(5)),
clp=cast('01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789xxxxxxx' as char(140)),
vcp=cast('myvar' as varchar(32))) select cast('val' as varchar(32));
====
---- QUERY
select csp, clp, vcp from char_parts where csp = cast('foo' as char(3))
---- TYPES
char, char, string
---- RESULTS
'foo ','01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789','myvar'
====
---- QUERY
drop table if exists char_parts
====
---- QUERY
# Regression test for IMPALA-1316
select A.vc from functional.chars_tiny as A join functional.chars_tiny using (vc) order by A.vc
---- TYPES
string
---- RESULTS
'1cccc'
'2cccccc'
'3ccc'
'4cc'
'5c'
'6c'
'6c'
'6c'
'6c'
'c'
====