Files
impala/testdata/workloads/functional-query/queries/QueryTest/exprs.test
Lenni Kuff 04edc8f534 Update benchmark tests to run against generic workload, data loading with scale factor, +more
This change updates the run-benchmark script to enable it to target one or more
workloads. Now benchmarks can be run like:

./run-benchmark --workloads=hive-benchmark,tpch

We lookup the workload in the workloads directory, then read the associated
query .test files and start executing them.

To ensure the queries are not duplicated between benchmark and query tests, I
moved all existing queries (under fe/src/test/resources/* to the workloads
directory. You do NOT need to look through all the .test files, I've just moved
them. The one new file is the 'hive-benchmark.test' which contains the hive
benchmark queries.

Also added support for generating schema for different scale factors as well as
executing against these scale factors. For example, let's say we have a dataset
with a scale factor called "SF1". We would first generate the schema using:

./generate_schema_statements --workload=<workload> --scale_factor="SF3"
This will create tables with a unique names from the other scale factors.

Run the generated .sql file to load the data. Alternatively, the data can loaded
by running a new python script:
./bin/load-data.py -w <workload1>,<workload2> -e <exploration strategy> -s [scale factor]
For example: load-data.sh -w tpch -e core -s SF3

Then run against this:
./run-benchmark --workloads=<workload> --scale_factor=SF3

This changeset also includes a few other minor tweaks to some of the test
scripts.

Change-Id: Ife8a8d91567d75c9612be37bec96c1e7780f50d6
2014-01-08 10:44:22 -08:00

822 lines
22 KiB
Plaintext

# IS NULL predicate
select count(*) from alltypesagg$TABLE
---- TYPES
bigint
---- RESULTS
10000
====
select count(*) from alltypesagg$TABLE where tinyint_col is null
---- TYPES
bigint
---- RESULTS
1000
====
select count(*) from alltypesagg$TABLE where tinyint_col is not null
---- TYPES
bigint
---- RESULTS
9000
====
# =
select count(*) from alltypesagg$TABLE where tinyint_col = 1
---- TYPES
bigint
---- RESULTS
1000
====
select count(*) from alltypesagg$TABLE where smallint_col = 1
---- TYPES
bigint
---- RESULTS
100
====
select count(*) from alltypesagg$TABLE where int_col = 1
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where bigint_col = 10
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where float_col = cast(1.1 as float)
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where double_col = 10.1
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where date_string_col = '01/01/10'
---- TYPES
bigint
---- RESULTS
1000
====
# <>
select count(*) from alltypesagg$TABLE where tinyint_col <> 1
---- TYPES
bigint
---- RESULTS
8000
====
select count(*) from alltypesagg$TABLE where smallint_col <> 1
---- TYPES
bigint
---- RESULTS
9800
====
select count(*) from alltypesagg$TABLE where int_col <> 1
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where bigint_col <> 1
---- TYPES
bigint
---- RESULTS
9990
====
select count(*) from alltypesagg$TABLE where float_col <> cast(1.1 as float)
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where double_col <> 10.1
---- TYPES
bigint
---- RESULTS
9980
====
# <
select count(*) from alltypesagg$TABLE where tinyint_col < 2
---- TYPES
bigint
---- RESULTS
1000
====
select count(*) from alltypesagg$TABLE where smallint_col < 2
---- TYPES
bigint
---- RESULTS
100
====
select count(*) from alltypesagg$TABLE where int_col < 2
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where bigint_col < 20
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where float_col < 2.2
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where double_col < 20.2
---- TYPES
bigint
---- RESULTS
10
====
# >
select count(*) from alltypesagg$TABLE where tinyint_col > 1
---- TYPES
bigint
---- RESULTS
8000
====
select count(*) from alltypesagg$TABLE where smallint_col > 1
---- TYPES
bigint
---- RESULTS
9800
====
select count(*) from alltypesagg$TABLE where int_col > 1
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where bigint_col > 10
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where float_col > cast(1.1 as float)
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where double_col > 10.1
---- TYPES
bigint
---- RESULTS
9980
====
# <=
select count(*) from alltypesagg$TABLE where tinyint_col <= 1
---- TYPES
bigint
---- RESULTS
1000
====
select count(*) from alltypesagg$TABLE where smallint_col <= 1
---- TYPES
bigint
---- RESULTS
100
====
select count(*) from alltypesagg$TABLE where int_col <= 1
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where bigint_col <= 10
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where float_col <= cast(1.1 as float)
---- TYPES
bigint
---- RESULTS
10
====
select count(*) from alltypesagg$TABLE where double_col <= 10.1
---- TYPES
bigint
---- RESULTS
10
====
# >=
select count(*) from alltypesagg$TABLE where tinyint_col >= 2
---- TYPES
bigint
---- RESULTS
8000
====
select count(*) from alltypesagg$TABLE where smallint_col >= 2
---- TYPES
bigint
---- RESULTS
9800
====
select count(*) from alltypesagg$TABLE where int_col >= 2
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where bigint_col >= 20
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where float_col >= 2.2
---- TYPES
bigint
---- RESULTS
9980
====
select count(*) from alltypesagg$TABLE where double_col >= 20.2
---- TYPES
bigint
---- RESULTS
9980
====
# +
select
SUM(tinyint_col) + SUM(smallint_col),
SUM(tinyint_col + smallint_col),
SUM(tinyint_col) + SUM(smallint_col) + SUM(int_col),
SUM(tinyint_col + smallint_col + int_col),
SUM(tinyint_col) + SUM(smallint_col) + SUM(int_col) + SUM(bigint_col),
SUM(tinyint_col + smallint_col + int_col + bigint_col),
SUM(tinyint_col) + SUM(smallint_col) + SUM(int_col) + SUM(bigint_col) + SUM(float_col),
SUM(tinyint_col + smallint_col + int_col + bigint_col + float_col),
SUM(tinyint_col) + SUM(smallint_col) + SUM(int_col) + SUM(bigint_col) + SUM(float_col) + SUM(double_col),
SUM(tinyint_col + smallint_col + int_col + bigint_col + float_col + double_col)
from alltypesaggnonulls$TABLE
---- TYPES
bigint, bigint, bigint, bigint, bigint, bigint, double, double, double, double
---- RESULTS
540000,540000,5535000,5535000,55485000,55485000,60979499.99976754,60979499.99976754,111428999.9997675,111428999.9997676
====
# -
select
-1 * SUM(tinyint_col) - SUM(smallint_col),
SUM(-1 * tinyint_col - smallint_col),
-1 * SUM(tinyint_col) - SUM(smallint_col) - SUM(int_col),
SUM(-1 * tinyint_col - smallint_col - int_col),
-1 * SUM(tinyint_col) - SUM(smallint_col) - SUM(int_col) - SUM(bigint_col),
SUM(-1 * tinyint_col - smallint_col - int_col - bigint_col),
-1 * SUM(tinyint_col) - SUM(smallint_col) - SUM(int_col) - SUM(bigint_col) - SUM(float_col),
SUM(-1 * tinyint_col - smallint_col - int_col - bigint_col - float_col),
-1 * SUM(tinyint_col) - SUM(smallint_col) - SUM(int_col) - SUM(bigint_col) - SUM(float_col) - SUM(double_col),
SUM(-1 * tinyint_col - smallint_col - int_col - bigint_col - float_col - double_col)
from alltypesaggnonulls$TABLE
---- TYPES
bigint, bigint, bigint, bigint, bigint, bigint, double, double, double, double
---- RESULTS
-540000,-540000,-5535000,-5535000,-55485000,-55485000,-60979499.99976754,-60979499.99976754,-111428999.9997675,-111428999.9997676
====
# *
select
MAX(tinyint_col) * MAX(smallint_col),
MAX(tinyint_col * smallint_col),
MAX(tinyint_col) * MAX(smallint_col) * MAX(int_col),
MAX(tinyint_col * smallint_col * int_col),
MAX(tinyint_col) * MAX(smallint_col) * MAX(int_col) * MAX(bigint_col),
MAX(tinyint_col * smallint_col * int_col * bigint_col),
MAX(tinyint_col) * MAX(smallint_col) * MAX(int_col) * MAX(bigint_col) * MAX(float_col),
MAX(tinyint_col * smallint_col * int_col * bigint_col * float_col),
MAX(tinyint_col) * MAX(smallint_col) * MAX(int_col) * MAX(bigint_col) * MAX(float_col) * MAX(double_col),
MAX(tinyint_col * smallint_col * int_col * bigint_col * float_col * double_col)
from alltypesaggnonulls$TABLE
---- TYPES
bigint, bigint, bigint, bigint, bigint, bigint, double, double, double, double
---- RESULTS
891,891,890109,890109,8892188910,8892188910,9771626610293.455,9771626610293.455,9.859473533519994e+16,9.859473533519994e+16
====
# LIKE exprs w/ the like/regex pattern coming from a column
select * from LikeTbl
---- TYPES
string, string, string, string, string
---- RESULTS
'NULL','%','NULL','.*','X'
'beginning of line','begin%','not begin%','^begin.*','^not begin.*'
'eight','%eight%','n%eight%','.*eight.*','n.*eight.*'
'end of line','%line','%line end','.*line$','.*line end$'
'five','%five%','n%five%','.*five.*','n.*five.*'
'four','%four%','n%four%','.*four.*','n.*four.*'
'middle of line','%of%','%of','^.*of.*$','.*of$'
'nine','%nine%','n%nine%','.*nine.*','n.*nine.*'
'one','%one%','n%one%','.*one.*','n.*one.*'
'seven','%seven%','n%seven%','.*seven.*','n.*seven.*'
'six','%six%','n%six%','.*six.*','n.*six.*'
'ten','%ten%','n%ten%','.*ten.*','n.*ten.*'
'three','%three%','n%three%','.*three.*','n.*three.*'
'two','%two%','n%two%','.*two.*','n.*two.*'
====
select str_col, match_like_col from LikeTbl
where str_col LIKE match_like_col
---- TYPES
string, string
---- RESULTS
'beginning of line','begin%'
'eight','%eight%'
'end of line','%line'
'five','%five%'
'four','%four%'
'middle of line','%of%'
'nine','%nine%'
'one','%one%'
'seven','%seven%'
'six','%six%'
'ten','%ten%'
'three','%three%'
'two','%two%'
====
select str_col, match_like_col from LikeTbl
where str_col NOT LIKE match_like_col
---- TYPES
string, string
---- RESULTS
====
select str_col, match_like_col from LikeTbl
where str_col LIKE no_match_like_col
---- TYPES
string, string
---- RESULTS
====
select str_col, no_match_like_col from LikeTbl
where str_col NOT LIKE no_match_like_col
---- TYPES
string, string
---- RESULTS
'beginning of line','not begin%'
'eight','n%eight%'
'end of line','%line end'
'five','n%five%'
'four','n%four%'
'middle of line','%of'
'nine','n%nine%'
'one','n%one%'
'seven','n%seven%'
'six','n%six%'
'ten','n%ten%'
'three','n%three%'
'two','n%two%'
====
select str_col, match_regex_col from LikeTbl
where str_col REGEXP match_regex_col
---- TYPES
string, string
---- RESULTS
'beginning of line','^begin.*'
'eight','.*eight.*'
'end of line','.*line$'
'five','.*five.*'
'four','.*four.*'
'middle of line','^.*of.*$'
'nine','.*nine.*'
'one','.*one.*'
'seven','.*seven.*'
'six','.*six.*'
'ten','.*ten.*'
'three','.*three.*'
'two','.*two.*'
====
select str_col, no_match_regex_col from LikeTbl
where str_col REGEXP no_match_regex_col
---- TYPES
string, string
---- RESULTS
====
select str_col, match_regex_col from LikeTbl
where str_col NOT REGEXP match_regex_col
---- TYPES
string, string
---- RESULTS
====
select str_col, no_match_regex_col from LikeTbl
where str_col NOT REGEXP no_match_regex_col
---- TYPES
string, string
---- RESULTS
'beginning of line','^not begin.*'
'eight','n.*eight.*'
'end of line','.*line end$'
'five','n.*five.*'
'four','n.*four.*'
'middle of line','.*of$'
'nine','n.*nine.*'
'one','n.*one.*'
'seven','n.*seven.*'
'six','n.*six.*'
'ten','n.*ten.*'
'three','n.*three.*'
'two','n.*two.*'
====
select 1+2
---- TYPES
bigint
---- RESULTS
3
====
select timestamp_col, to_date(timestamp_col), year(timestamp_col), month(timestamp_col),
dayofmonth(timestamp_col), day(timestamp_col), weekofyear(timestamp_col),
hour(timestamp_col), minute(timestamp_col), second(timestamp_col)
from alltypessmall$TABLE
---- TYPES
timestamp, string, int, int, int, int, int, int, int, int
---- RESULTS
2009-01-01 00:00:00,'2009-01-01',2009,1,1,1,1,0,0,0
2009-01-01 00:01:00,'2009-01-01',2009,1,1,1,1,0,1,0
2009-01-01 00:02:00.100000000,'2009-01-01',2009,1,1,1,1,0,2,0
2009-01-01 00:03:00.300000000,'2009-01-01',2009,1,1,1,1,0,3,0
2009-01-01 00:04:00.600000000,'2009-01-01',2009,1,1,1,1,0,4,0
2009-01-01 00:05:00.100000000,'2009-01-01',2009,1,1,1,1,0,5,0
2009-01-01 00:06:00.150000000,'2009-01-01',2009,1,1,1,1,0,6,0
2009-01-01 00:07:00.210000000,'2009-01-01',2009,1,1,1,1,0,7,0
2009-01-01 00:08:00.280000000,'2009-01-01',2009,1,1,1,1,0,8,0
2009-01-01 00:09:00.360000000,'2009-01-01',2009,1,1,1,1,0,9,0
2009-01-02 00:10:00.450000000,'2009-01-02',2009,1,2,2,1,0,10,0
2009-01-02 00:11:00.450000000,'2009-01-02',2009,1,2,2,1,0,11,0
2009-01-02 00:12:00.460000000,'2009-01-02',2009,1,2,2,1,0,12,0
2009-01-02 00:13:00.480000000,'2009-01-02',2009,1,2,2,1,0,13,0
2009-01-02 00:14:00.510000000,'2009-01-02',2009,1,2,2,1,0,14,0
2009-01-02 00:15:00.550000000,'2009-01-02',2009,1,2,2,1,0,15,0
2009-01-02 00:16:00.600000000,'2009-01-02',2009,1,2,2,1,0,16,0
2009-01-02 00:17:00.660000000,'2009-01-02',2009,1,2,2,1,0,17,0
2009-01-02 00:18:00.730000000,'2009-01-02',2009,1,2,2,1,0,18,0
2009-01-02 00:19:00.810000000,'2009-01-02',2009,1,2,2,1,0,19,0
2009-01-03 00:20:00.900000000,'2009-01-03',2009,1,3,3,1,0,20,0
2009-01-03 00:21:00.900000000,'2009-01-03',2009,1,3,3,1,0,21,0
2009-01-03 00:22:00.910000000,'2009-01-03',2009,1,3,3,1,0,22,0
2009-01-03 00:23:00.930000000,'2009-01-03',2009,1,3,3,1,0,23,0
2009-01-03 00:24:00.960000000,'2009-01-03',2009,1,3,3,1,0,24,0
2009-02-01 00:00:00,'2009-02-01',2009,2,1,32,5,0,0,0
2009-02-01 00:01:00,'2009-02-01',2009,2,1,32,5,0,1,0
2009-02-01 00:02:00.100000000,'2009-02-01',2009,2,1,32,5,0,2,0
2009-02-01 00:03:00.300000000,'2009-02-01',2009,2,1,32,5,0,3,0
2009-02-01 00:04:00.600000000,'2009-02-01',2009,2,1,32,5,0,4,0
2009-02-01 00:05:00.100000000,'2009-02-01',2009,2,1,32,5,0,5,0
2009-02-01 00:06:00.150000000,'2009-02-01',2009,2,1,32,5,0,6,0
2009-02-01 00:07:00.210000000,'2009-02-01',2009,2,1,32,5,0,7,0
2009-02-01 00:08:00.280000000,'2009-02-01',2009,2,1,32,5,0,8,0
2009-02-01 00:09:00.360000000,'2009-02-01',2009,2,1,32,5,0,9,0
2009-02-02 00:10:00.450000000,'2009-02-02',2009,2,2,33,6,0,10,0
2009-02-02 00:11:00.450000000,'2009-02-02',2009,2,2,33,6,0,11,0
2009-02-02 00:12:00.460000000,'2009-02-02',2009,2,2,33,6,0,12,0
2009-02-02 00:13:00.480000000,'2009-02-02',2009,2,2,33,6,0,13,0
2009-02-02 00:14:00.510000000,'2009-02-02',2009,2,2,33,6,0,14,0
2009-02-02 00:15:00.550000000,'2009-02-02',2009,2,2,33,6,0,15,0
2009-02-02 00:16:00.600000000,'2009-02-02',2009,2,2,33,6,0,16,0
2009-02-02 00:17:00.660000000,'2009-02-02',2009,2,2,33,6,0,17,0
2009-02-02 00:18:00.730000000,'2009-02-02',2009,2,2,33,6,0,18,0
2009-02-02 00:19:00.810000000,'2009-02-02',2009,2,2,33,6,0,19,0
2009-02-03 00:20:00.900000000,'2009-02-03',2009,2,3,34,6,0,20,0
2009-02-03 00:21:00.900000000,'2009-02-03',2009,2,3,34,6,0,21,0
2009-02-03 00:22:00.910000000,'2009-02-03',2009,2,3,34,6,0,22,0
2009-02-03 00:23:00.930000000,'2009-02-03',2009,2,3,34,6,0,23,0
2009-02-03 00:24:00.960000000,'2009-02-03',2009,2,3,34,6,0,24,0
2009-03-01 00:00:00,'2009-03-01',2009,3,1,60,9,0,0,0
2009-03-01 00:01:00,'2009-03-01',2009,3,1,60,9,0,1,0
2009-03-01 00:02:00.100000000,'2009-03-01',2009,3,1,60,9,0,2,0
2009-03-01 00:03:00.300000000,'2009-03-01',2009,3,1,60,9,0,3,0
2009-03-01 00:04:00.600000000,'2009-03-01',2009,3,1,60,9,0,4,0
2009-03-01 00:05:00.100000000,'2009-03-01',2009,3,1,60,9,0,5,0
2009-03-01 00:06:00.150000000,'2009-03-01',2009,3,1,60,9,0,6,0
2009-03-01 00:07:00.210000000,'2009-03-01',2009,3,1,60,9,0,7,0
2009-03-01 00:08:00.280000000,'2009-03-01',2009,3,1,60,9,0,8,0
2009-03-01 00:09:00.360000000,'2009-03-01',2009,3,1,60,9,0,9,0
2009-03-02 00:10:00.450000000,'2009-03-02',2009,3,2,61,10,0,10,0
2009-03-02 00:11:00.450000000,'2009-03-02',2009,3,2,61,10,0,11,0
2009-03-02 00:12:00.460000000,'2009-03-02',2009,3,2,61,10,0,12,0
2009-03-02 00:13:00.480000000,'2009-03-02',2009,3,2,61,10,0,13,0
2009-03-02 00:14:00.510000000,'2009-03-02',2009,3,2,61,10,0,14,0
2009-03-02 00:15:00.550000000,'2009-03-02',2009,3,2,61,10,0,15,0
2009-03-02 00:16:00.600000000,'2009-03-02',2009,3,2,61,10,0,16,0
2009-03-02 00:17:00.660000000,'2009-03-02',2009,3,2,61,10,0,17,0
2009-03-02 00:18:00.730000000,'2009-03-02',2009,3,2,61,10,0,18,0
2009-03-02 00:19:00.810000000,'2009-03-02',2009,3,2,61,10,0,19,0
2009-03-03 00:20:00.900000000,'2009-03-03',2009,3,3,62,10,0,20,0
2009-03-03 00:21:00.900000000,'2009-03-03',2009,3,3,62,10,0,21,0
2009-03-03 00:22:00.910000000,'2009-03-03',2009,3,3,62,10,0,22,0
2009-03-03 00:23:00.930000000,'2009-03-03',2009,3,3,62,10,0,23,0
2009-03-03 00:24:00.960000000,'2009-03-03',2009,3,3,62,10,0,24,0
2009-04-01 00:00:00,'2009-04-01',2009,4,1,91,14,0,0,0
2009-04-01 00:01:00,'2009-04-01',2009,4,1,91,14,0,1,0
2009-04-01 00:02:00.100000000,'2009-04-01',2009,4,1,91,14,0,2,0
2009-04-01 00:03:00.300000000,'2009-04-01',2009,4,1,91,14,0,3,0
2009-04-01 00:04:00.600000000,'2009-04-01',2009,4,1,91,14,0,4,0
2009-04-01 00:05:00.100000000,'2009-04-01',2009,4,1,91,14,0,5,0
2009-04-01 00:06:00.150000000,'2009-04-01',2009,4,1,91,14,0,6,0
2009-04-01 00:07:00.210000000,'2009-04-01',2009,4,1,91,14,0,7,0
2009-04-01 00:08:00.280000000,'2009-04-01',2009,4,1,91,14,0,8,0
2009-04-01 00:09:00.360000000,'2009-04-01',2009,4,1,91,14,0,9,0
2009-04-02 00:10:00.450000000,'2009-04-02',2009,4,2,92,14,0,10,0
2009-04-02 00:11:00.450000000,'2009-04-02',2009,4,2,92,14,0,11,0
2009-04-02 00:12:00.460000000,'2009-04-02',2009,4,2,92,14,0,12,0
2009-04-02 00:13:00.480000000,'2009-04-02',2009,4,2,92,14,0,13,0
2009-04-02 00:14:00.510000000,'2009-04-02',2009,4,2,92,14,0,14,0
2009-04-02 00:15:00.550000000,'2009-04-02',2009,4,2,92,14,0,15,0
2009-04-02 00:16:00.600000000,'2009-04-02',2009,4,2,92,14,0,16,0
2009-04-02 00:17:00.660000000,'2009-04-02',2009,4,2,92,14,0,17,0
2009-04-02 00:18:00.730000000,'2009-04-02',2009,4,2,92,14,0,18,0
2009-04-02 00:19:00.810000000,'2009-04-02',2009,4,2,92,14,0,19,0
2009-04-03 00:20:00.900000000,'2009-04-03',2009,4,3,93,14,0,20,0
2009-04-03 00:21:00.900000000,'2009-04-03',2009,4,3,93,14,0,21,0
2009-04-03 00:22:00.910000000,'2009-04-03',2009,4,3,93,14,0,22,0
2009-04-03 00:23:00.930000000,'2009-04-03',2009,4,3,93,14,0,23,0
2009-04-03 00:24:00.960000000,'2009-04-03',2009,4,3,93,14,0,24,0
====
# IN predicate
select NULL in (1, 2, 3)
----
boolean
----
NULL
====
select NULL in (1, NULL, 3)
----
boolean
----
NULL
====
select 1 in (2, NULL, 1)
----
boolean
----
true
====
select 1 in (1, NULL, 2)
----
boolean
----
true
====
select 1 in (2, NULL, 3)
----
boolean
----
NULL
====
select 1 in (2, 3, 4)
----
boolean
----
false
====
select NULL not in (1, 2, 3)
----
boolean
----
NULL
====
select NULL not in (1, NULL, 3)
----
boolean
----
NULL
====
select 1 not in (2, NULL, 1)
----
boolean
----
false
====
select 1 not in (1, NULL, 2)
----
boolean
----
false
====
select 1 not in (2, NULL, 3)
----
boolean
----
NULL
====
select 1 not in (2, 3, 4)
----
boolean
----
true
====
select count(*) from alltypesagg$TABLE
where true in (bool_col, tinyint_col)
----
bigint
----
6000
====
select count(*) from alltypesagg$TABLE
where true not in (bool_col, tinyint_col)
----
bigint
----
4000
====
select count(*) from alltypesagg$TABLE
where 1 in (tinyint_col, smallint_col, int_col, bigint_col)
----
bigint
----
1000
====
select count(*) from alltypesagg$TABLE
where 1 not in (tinyint_col, smallint_col, int_col, bigint_col)
----
bigint
----
8000
====
select count(*) from alltypesagg$TABLE
where 10.1 in (tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col)
----
bigint
----
10
====
select count(*) from alltypesagg$TABLE
where 10.1 not in (tinyint_col, smallint_col, int_col, bigint_col, float_col, double_col)
----
bigint
----
8990
====
select count(*) from alltypesagg$TABLE
where '01/01/10' in (date_string_col, string_col, 'abc')
----
bigint
----
1000
====
select count(*) from alltypesagg$TABLE
where '01/01/10' not in (date_string_col, string_col, 'abc')
----
bigint
----
9000
====
select count(*) from alltypesagg$TABLE
where cast('2010-01-01 00:00:00' as timestamp) in (timestamp_col)
----
bigint
----
1
====
select count(*) from alltypesagg$TABLE
where cast('2010-01-01 00:00:00' as timestamp) not in (timestamp_col)
----
bigint
----
9999
====
# BETWEEN predicate
select count(*) from alltypesagg$TABLE where tinyint_col between 1 and 2
---- TYPES
bigint
---- RESULTS
2000
====
select count(*) from alltypesagg$TABLE where tinyint_col not between 1 and 2
---- TYPES
bigint
---- RESULTS
7000
====
select count(*) from alltypesagg$TABLE where smallint_col between 1 and 20
---- TYPES
bigint
---- RESULTS
2000
====
select count(*) from alltypesagg$TABLE where smallint_col not between 1 and 20
---- TYPES
bigint
---- RESULTS
7900
====
select count(*) from alltypesagg$TABLE where int_col between 1 and 200
---- TYPES
bigint
---- RESULTS
2000
====
select count(*) from alltypesagg$TABLE where int_col not between 1 and 200
---- TYPES
bigint
---- RESULTS
7990
====
select count(*) from alltypesagg$TABLE where bigint_col between 1 and 2000
---- TYPES
bigint
---- RESULTS
2000
====
select count(*) from alltypesagg$TABLE where bigint_col not between 1 and 2000
---- TYPES
bigint
---- RESULTS
7990
====
select count(*) from alltypesagg$TABLE
where float_col between cast(1.0 as float) and cast(110.0 as float)
---- TYPES
bigint
---- RESULTS
1000
====
select count(*) from alltypesagg$TABLE
where float_col not between cast(1.0 as float) and cast(110.0 as float)
---- TYPES
bigint
---- RESULTS
8990
====
select count(*) from alltypesagg$TABLE where double_col between 1.0 and 110.0
---- TYPES
bigint
---- RESULTS
100
====
select count(*) from alltypesagg$TABLE where double_col not between 1.0 and 110.0
---- TYPES
bigint
---- RESULTS
9890
====
select count(*) from alltypesagg$TABLE where date_string_col
between '01/01/10' and '01/05/10'
---- TYPES
bigint
---- RESULTS
5000
====
select count(*) from alltypesagg$TABLE where date_string_col
not between '01/01/10' and '01/05/10'
---- TYPES
bigint
---- RESULTS
5000
====
select count(*) from alltypesagg$TABLE where timestamp_col
between cast('2010-01-01 00:00:00' as timestamp)
and cast('2010-01-01 01:40:00' as timestamp)
---- TYPES
bigint
---- RESULTS
100
====
select count(*) from alltypesagg$TABLE where timestamp_col
not between cast('2010-01-01 00:00:00' as timestamp)
and cast('2010-01-01 01:40:00' as timestamp)
---- TYPES
bigint
---- RESULTS
9900
====
// Test NOW() function.
select now()
---- TYPES
timestamp
---- RESULTS
// Matches a single date of the form 'yyyy-MM-dd HH:mm:ss'
// or 'yyyy-MM-dd HH:mm:ss.SSSSSS'
regex: \d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?
====
select now(), now(), now(), now()
---- TYPES
timestamp, timestamp, timestamp, timestamp
---- RESULTS
// Matches four identical timestamps separated by commas.
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
====
select now(), now(), now(), now() from alltypestiny
---- TYPES
timestamp, timestamp, timestamp, timestamp
---- RESULTS
// Matches four identical timestamps separated by commas.
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1,\1,\1
====
// Check that now() returns the same value when evaluated on different nodes
// (alltypessmall is partitioned)
select min(now()), max(now()) from alltypessmall
---- TYPES
timestamp, timestamp
---- RESULTS
// Matches two identical timestamps separated by commas.
regex: (\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}(\.\d{9})?),\1
====