mirror of
https://github.com/apache/impala.git
synced 2026-01-28 09:03:52 -05:00
Since HIVE-22589, Hive still uses Julian Calendar for writing dates before 1582-10-15, whereas Impala uses proleptic Gregorian Calendar. This affects the results Impala gets when querying tables written by Hive. Currently, the Avro and ORC formats of date_tbl are suffering this issue. This patch enables proleptic Gregorian Calendar for Hive by default. It also reverts the two commits of IMPALA-9555 which modifies the tests to satisfy the inconsistent results. Tests: - Ran CORE tests Change-Id: I6be9c9720dd352d6821cdaa6c64d35ba20473bc0 Reviewed-on: http://gerrit.cloudera.org:8080/18262 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
864 lines
24 KiB
Plaintext
864 lines
24 KiB
Plaintext
====
|
|
---- QUERY
|
|
select id, bool_col from functional_orc_def.alltypessmall
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
set explain_level=2;
|
|
explain select count(*) from functional_orc_def.alltypessmall where tinyint_col = 10
|
|
---- RESULTS: VERIFY_IS_SUBSET
|
|
' orc statistics predicates: tinyint_col = CAST(10 AS TINYINT)'
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for tinyint. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x <= min_val for tinyint.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col <= 0
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x >= max_val for tinyint.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col >= 9
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for tinyint. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col > 9
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col = -1
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col = 10
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for smallint. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x <= min_val for smallint.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col <= 0
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x >= max_val for smallint.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col >= 9
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for smallint. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col > 9
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col = -1
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col = 10
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for int. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x <= min_val for int.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col <= 0
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x >= max_val for int.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col >= 9
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for int. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col > 9
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col = -1
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col = 10
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for bigint. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x <= min_val for bigint.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col <= 0
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x >= max_val for bigint.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col >= 90
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for bigint. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col > 90
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col = -1
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test EQ predicate with values outside the range.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col = 100
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall_bool_sorted where bool_col = true;
|
|
---- RESULTS
|
|
50
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 50
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall_bool_sorted where bool_col = false;
|
|
---- RESULTS
|
|
50
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 50
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for float. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where float_col < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < a for float that can't filter out any RowGroups.
|
|
select count(*) from functional_orc_def.alltypessmall where float_col < 1
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for float. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where float_col > 9.9
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > a for float that can't filter out any RowGroups.
|
|
select count(*) from functional_orc_def.alltypessmall where float_col > 9
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for double. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where double_col < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < a for double that can't filter out any RowGroups.
|
|
select count(*) from functional_orc_def.alltypessmall where double_col < 1
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for double. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where double_col > 99
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > a for double that can't filter out any RowGroups.
|
|
select count(*) from functional_orc_def.alltypessmall where double_col > 90
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for string. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where string_col < "0"
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x <= min_val for string.
|
|
select count(*) from functional_orc_def.alltypessmall where string_col <= "0"
|
|
---- RESULTS
|
|
12
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x >= max_val for string.
|
|
select count(*) from functional_orc_def.alltypessmall where string_col >= "9"
|
|
---- RESULTS
|
|
8
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for string. No rows should be read by the ORC reader.
|
|
select count(*) from functional_orc_def.alltypessmall where string_col > "9"
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on TIMESTAMP predicates. Currently they are not pushed down (IMPALA-10915).
|
|
select count(*) from functional_orc_def.alltypessmall where timestamp_col < "2009-01-01 00:00:00"
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on TIMESTAMP predicates. Currently they are not pushed down (IMPALA-10915).
|
|
select count(*) from functional_orc_def.alltypessmall where timestamp_col > "2009-04-03 00:24:00.96"
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for decimal(9,0).
|
|
# Due to ORC-517 not included in the current Hive version (3.1.3000.7.2.12.0-104),
|
|
# the ORC files have wrong statistics on d1 column showing that its minimum is 0.
|
|
# So we still see RowsRead=5 here.
|
|
select count(*) from functional_orc_def.decimal_tbl where d1 < 1234
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 5
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d1 < 0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for decimal(9,0). No rows should be read by the ORC reader.
|
|
# Use 132842.0 instead of 132842 to workaround IMPALA-10916.
|
|
select count(*) from functional_orc_def.decimal_tbl where d1 > 132842.0
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x < min_val for decimal(20,10). No rows should be read by the ORC
|
|
# reader.
|
|
select count(*) from functional_orc_def.decimal_tbl where d3 < 1.23456789
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on predicate x > max_val for decimal(20,10). No rows should be read by the ORC
|
|
# reader.
|
|
select count(*) from functional_orc_def.decimal_tbl where d3 > 12345.6789
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on EQ predicate with a value out of the range.
|
|
select count(*) from functional_orc_def.decimal_tbl where d3 = 1.23456788
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test on EQ predicate with a value out of the range.
|
|
select count(*) from functional_orc_def.decimal_tbl where d3 = 12345.6799
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d4 > 0.123456789
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d4 < 0.123456789
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d4 >= 0.12345678
|
|
---- RESULTS
|
|
5
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 5
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d4 >= 0.12345679
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test with inverted predicate
|
|
select id, bool_col from functional_orc_def.alltypessmall where -1 > int_col
|
|
---- RESULTS
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Mix with partitioning columns
|
|
select count(*) from functional_orc_def.alltypessmall where int_col < 0 and year < 2012
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select id, bool_col from functional_orc_def.alltypessmall where int_col < 3 - 3
|
|
---- RESULTS
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select id, bool_col from functional_orc_def.alltypessmall where int_col < 3 - 3
|
|
---- RESULTS
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Without expr rewrite and thus without constant folding, predicates with const exprs
|
|
# won't be pushed down.
|
|
set enable_expr_rewrites=0;
|
|
select id, bool_col from functional_orc_def.alltypessmall where int_col < 3 - 3
|
|
---- RESULTS
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
select id, bool_col from functional_orc_def.alltypessmall where 5 + 5 < int_col
|
|
---- RESULTS
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Without expr rewrite and thus without constant folding, predicates with const exprs
|
|
# won't be pushed down.
|
|
set enable_expr_rewrites=0;
|
|
select id, bool_col from functional_orc_def.alltypessmall where 5 + 5 < int_col
|
|
---- RESULTS
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Query that has an implicit cast to a larger integer type
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col > 1000000000000
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Predicates with explicit casts are not supported when evaluating orc statistics.
|
|
select count(*) from functional_orc_def.alltypessmall where '0' > cast(tinyint_col as string)
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Explicit casts between numerical types can violate the transitivity of "min()", so they
|
|
# are not supported when evaluating orc statistics.
|
|
select count(*) from functional_orc_def.alltypes where cast(id as tinyint) < 10;
|
|
---- RESULTS
|
|
3878
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 7300
|
|
====
|
|
---- QUERY
|
|
# Predicates on array position can't be pushed down into the orc reader.
|
|
select count(*) from functional_orc_def.complextypestbl.int_array where pos < 5;
|
|
---- RESULTS
|
|
9
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 8
|
|
====
|
|
---- QUERY
|
|
# Test the conversion of constant IN lists to min/max predicats
|
|
select count(*) from functional_orc_def.alltypes where int_col in (-1,-2,-3,-4);
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypes where id IN (1,25,49);
|
|
---- RESULTS
|
|
3
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 310
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col < '0001-06-21';
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col <= '0001-06-21';
|
|
---- RESULTS
|
|
1
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 10
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col > '2018-12-31';
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col >= '2018-12-31';
|
|
---- RESULTS
|
|
1
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 3
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col = '2018-12-31';
|
|
---- RESULTS
|
|
1
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 3
|
|
====
|
|
---- QUERY
|
|
# Test predicates on CHAR type. They are not pushed down (IMPALA-10882). Just make sure
|
|
# we don't hit DCHECKs.
|
|
select count(*) from functional_orc_def.chars_tiny where cs < cast('1aaaa' as char(5));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 9
|
|
====
|
|
---- QUERY
|
|
# Test predicates on CHAR type. They are not pushed down (IMPALA-10882). Just make sure
|
|
# we don't hit DCHECKs.
|
|
select count(*) from functional_orc_def.chars_tiny where cs > cast('a' as char(5));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 9
|
|
====
|
|
---- QUERY
|
|
# Test predicates on VARCHAR type. They are not pushed down (IMPALA-10882). Just make sure
|
|
# we don't hit DCHECKs.
|
|
select count(*) from functional_orc_def.chars_tiny where vc < cast('1cccc' as varchar(32));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 9
|
|
====
|
|
---- QUERY
|
|
# Test predicates on VARCHAR type. They are not pushed down (IMPALA-10882). Just make sure
|
|
# we don't hit DCHECKs.
|
|
select count(*) from functional_orc_def.chars_tiny where vc > cast('c' as varchar(32));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 9
|
|
====
|
|
---- QUERY
|
|
# Test that stats support can be disabled using the orc_read_statistics query option.
|
|
set orc_read_statistics=0;
|
|
select count(*) from functional_orc_def.alltypes where id < 0;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 7300
|
|
====
|
|
---- QUERY
|
|
# Test on a larger ORC file that has multiple stripes and each stripe has multiple row
|
|
# groups.
|
|
select count(*) from tpch_orc_def.lineitem where l_orderkey = 1609411;
|
|
---- RESULTS
|
|
7
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 13501
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals outside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col in (-1, 10);
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals inside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col in (1, 5);
|
|
---- RESULTS
|
|
20
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals outside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col in (-1, 10);
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals inside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col in (1, 5);
|
|
---- RESULTS
|
|
20
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals outside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col in (-1, 10);
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals inside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where int_col in (1, 5);
|
|
---- RESULTS
|
|
20
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals inside the value range.
|
|
# The table has 4 files. 3 of them will be skipped.
|
|
select count(*) from functional_orc_def.alltypessmall where id in (1, 3, 5);
|
|
---- RESULTS
|
|
3
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 25
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals outside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col in (-1, 91);
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals inside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col in (10, 50);
|
|
---- RESULTS
|
|
20
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall_bool_sorted where bool_col in (true);
|
|
---- RESULTS
|
|
50
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 50
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall_bool_sorted where bool_col in (false);
|
|
---- RESULTS
|
|
50
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 50
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals outside the value range.
|
|
# The range of string_col is ['0', '9']. '/' is smaller than '0' and 'A' is larger
|
|
# than '9'.
|
|
select count(*) from functional_orc_def.alltypessmall where string_col in ('/', 'A');
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals inside the value range.
|
|
select count(*) from functional_orc_def.alltypessmall where string_col in ('1', '5');
|
|
---- RESULTS
|
|
20
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 100
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col in ('0001-06-18', '2019-12-31');
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.date_tbl
|
|
where date_part in ("2017-11-27", "1399-06-27") and date_col in ('0001-06-21', '2018-12-31');
|
|
---- RESULTS
|
|
2
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 13
|
|
====
|
|
---- QUERY
|
|
# Test pushing down IN-list predicate with literals outside the value range. Explicitly cast
|
|
# the literals so FE won't wrap 'd1' as casting to INT, so the predicate can be pushed down.
|
|
# Due to ORC-517 not included in the current Hive version (3.1.3000.7.2.12.0-104),
|
|
# the ORC files have wrong statistics on d1 column showing that its minimum is 0. So here we
|
|
# use -1 to be smaller than it. The max of d1 is 132842 so we use 132843.
|
|
select count(*) from functional_orc_def.decimal_tbl
|
|
where d1 in (cast(-1 as decimal(9,0)), cast(132843 as decimal(9,0)));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl
|
|
where d1 in (cast(0 as decimal(9,0)), cast(132842 as decimal(9,0)));
|
|
---- RESULTS
|
|
1
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 5
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl
|
|
where d1 in (cast(1234 as decimal(9,0)), cast(2345 as decimal(9,0)), cast(12345 as decimal(9,0)));
|
|
---- RESULTS
|
|
4
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 5
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl
|
|
where d3 in (cast(-1 as decimal(20,10)), cast(12346 as decimal(20,10)));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl
|
|
where d3 in (cast(2 as decimal(20,10)), cast(200 as decimal(20,10)));
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 5
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl
|
|
where d3 in (cast(12.3456789 as decimal(20,10)), cast(12345.6789 as decimal(20,10)));
|
|
---- RESULTS
|
|
2
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 5
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where bool_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where tinyint_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where smallint_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where int_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where bigint_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where float_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where double_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where string_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.alltypessmall where timestamp_col is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d1 is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|
|
---- QUERY
|
|
select count(*) from functional_orc_def.decimal_tbl where d4 is null;
|
|
---- RESULTS
|
|
0
|
|
---- RUNTIME_PROFILE
|
|
aggregation(SUM, RowsRead): 0
|
|
====
|