blob: 886fb05d78708cafe91be193df253dc6f63f8af8 [file] [log] [blame]
# full scan of string typed row-key
select * from functional_hbase.stringids
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
row-size=107B cardinality=17.33K
====
# predicate on row key doesn't get transformed into scan parameter, because
# it's mapped as an int (but stored in ascii and ordered lexicographically)
select * from functional_hbase.alltypessmall
where id < 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
row-size=89B cardinality=5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 3:7
HBASE KEYRANGE 7:<unbounded>
HBASE KEYRANGE <unbounded>:3
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
row-size=89B cardinality=5
====
# if the row key is mapped as a string col, range predicates are applied to the scan
select * from functional_hbase.stringids
where id = '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id = '5'
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=1
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 5:5\0
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id = '5'
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=1
====
select * from functional_hbase.stringids
where id > '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id > '5'
start key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=953
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 5\0:7
HBASE KEYRANGE 7:<unbounded>
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id > '5'
start key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=953
====
select * from functional_hbase.stringids
where id >= '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '5'
start key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=953
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 5:7
HBASE KEYRANGE 7:<unbounded>
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '5'
start key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=953
====
select * from functional_hbase.stringids
where id < '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id < '5'
stop key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=969
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 3:5
HBASE KEYRANGE <unbounded>:3
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id < '5'
stop key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=969
====
select * from functional_hbase.stringids
where id <= '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id <= '5'
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=1.45K
====
select * from functional_hbase.stringids
where id > '4' and id < '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id > '4', id < '5'
start key: 4\0
stop key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=475
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 4\0:5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id > '4', id < '5'
start key: 4\0
stop key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=475
====
select * from functional_hbase.stringids
where id >= '4' and id < '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id < '5'
start key: 4
stop key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=475
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 4:5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id < '5'
start key: 4
stop key: 5
predicates: tinyint_col = 5
row-size=107B cardinality=475
====
select * from functional_hbase.stringids
where id > '4' and id <= '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id > '4', id <= '5'
start key: 4\0
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=953
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 4\0:5\0
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id > '4', id <= '5'
start key: 4\0
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=953
====
select * from functional_hbase.stringids
where id >= '4' and id <= '5'
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id <= '5'
start key: 4
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=953
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 4:5\0
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id <= '5'
start key: 4
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=953
====
# with aggregation
select int_col, count(*)
from functional_hbase.alltypessmall
where id < 5
group by 1
---- PLAN
PLAN-ROOT SINK
|
01:AGGREGATE [FINALIZE]
| output: count(*)
| group by: int_col
| row-size=12B cardinality=5
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
row-size=8B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
04:EXCHANGE [UNPARTITIONED]
|
03:AGGREGATE [FINALIZE]
| output: count:merge(*)
| group by: int_col
| row-size=12B cardinality=5
|
02:EXCHANGE [HASH(int_col)]
|
01:AGGREGATE [STREAMING]
| output: count(*)
| group by: int_col
| row-size=12B cardinality=5
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
row-size=8B cardinality=5
====
# predicates on string columns against a constant string are converted to HBase filters
select * from functional_hbase.alltypessmall where string_col = '4'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
predicates: string_col = '4'
row-size=89B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
predicates: string_col = '4'
row-size=89B cardinality=5
====
# test all comparison ops
select * from functional_hbase.alltypessmall where string_col != '4'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col NOT_EQUAL '4'
predicates: string_col != '4'
row-size=89B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col NOT_EQUAL '4'
predicates: string_col != '4'
row-size=89B cardinality=5
====
select * from functional_hbase.alltypessmall where string_col < '4'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS '4'
predicates: string_col < '4'
row-size=89B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS '4'
predicates: string_col < '4'
row-size=89B cardinality=5
====
select * from functional_hbase.alltypessmall where string_col > '4'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER '4'
predicates: string_col > '4'
row-size=89B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER '4'
predicates: string_col > '4'
row-size=89B cardinality=5
====
select * from functional_hbase.alltypessmall where string_col <= '4'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS_OR_EQUAL '4'
predicates: string_col <= '4'
row-size=89B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS_OR_EQUAL '4'
predicates: string_col <= '4'
row-size=89B cardinality=5
====
select * from functional_hbase.alltypessmall where string_col >= '4'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER_OR_EQUAL '4'
predicates: string_col >= '4'
row-size=89B cardinality=5
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER_OR_EQUAL '4'
predicates: string_col >= '4'
row-size=89B cardinality=5
====
# test multiple filters
select * from functional_hbase.alltypessmall
where string_col >= '4' and string_col != '2' and date_string_col = '04/03/09'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters:
d:string_col NOT_EQUAL '2'
d:string_col GREATER_OR_EQUAL '4'
d:date_string_col EQUAL '04/03/09'
predicates: string_col != '2', string_col >= '4', date_string_col = '04/03/09'
row-size=89B cardinality=1
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters:
d:string_col NOT_EQUAL '2'
d:string_col GREATER_OR_EQUAL '4'
d:date_string_col EQUAL '04/03/09'
predicates: string_col != '2', string_col >= '4', date_string_col = '04/03/09'
row-size=89B cardinality=1
====
# mix of predicates and functional_hbase. filters
select * from functional_hbase.alltypessmall where string_col = '4' and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5, string_col = '4'
row-size=89B cardinality=1
====
# mix of predicates, functional_hbase. filters and start/stop keys
select * from functional_hbase.stringids
where string_col = '4' and tinyint_col = 5 and id >= '4' and id <= '5'
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id <= '5'
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5, string_col = '4'
row-size=107B cardinality=2
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 4:5\0
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id <= '5'
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5, string_col = '4'
row-size=107B cardinality=2
====
# predicates involving casts (ie, non-string comparisons) cannot be turned into filters
select * from functional_hbase.alltypessmall where cast(string_col as int) >= 4
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: CAST(string_col AS INT) >= 4
row-size=89B cardinality=5
====
# non-const comparisons cannot be turned into filters
select * from functional_hbase.alltypessmall where string_col >= date_string_col
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: string_col >= date_string_col
row-size=89B cardinality=5
====
# IMP-1188 - row key predicate is a constant expr.
select * from functional_hbase.stringids
where id = concat('', '5')
and tinyint_col = 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id = '5'
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
row-size=107B cardinality=1
====
# IMP-1188 - row key predicate is a constant expr.
select * from functional_hbase.stringids
where string_col = '4' and tinyint_col = 5
and id >= concat('', '4') and id <= concat('5', '')
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id <= '5'
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5, string_col = '4'
row-size=107B cardinality=2
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 4:5\0
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
key predicates: id >= '4', id <= '5'
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5, string_col = '4'
row-size=107B cardinality=2
====
# IMP-1188 - row key predicate is null.
select * from functional_hbase.stringids where id = null
---- PLAN
PLAN-ROOT SINK
|
empty scan node
row-size=107B cardinality=1
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
empty scan node
row-size=107B cardinality=1
====
# IMP-1188 - row key lower bound is bigger than upper bound.
select * from functional_hbase.stringids where id > 'b' and id < 'a'
---- PLAN
PLAN-ROOT SINK
|
empty scan node
row-size=107B cardinality=1
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
empty scan node
row-size=107B cardinality=1
====
# IMP-1188 - casting row key to non-string type disables predicate from being pushed
# into HBase
select * from functional_hbase.stringids
where cast(id as int) < 5
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.stringids]
predicates: CAST(id AS INT) < 5
row-size=107B cardinality=1.73K
====
# The following test cases test plan generation for queries executed against HBase
# and have 'IS NULL/IS NOT NULL' predicates as well as conjunctive predicates.
# (IMPALA-642)
#
# HBase scan query with an 'IS NULL' predicate
select * from functional_hbase.alltypesagg
where bigint_col is null
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col IS NULL
row-size=84B cardinality=1.73K
====
# HBase scan query with projection and an 'IS NULL' predicate on one of the
# projected columns
select bigint_col, day from functional_hbase.alltypesagg
where bigint_col is null
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col IS NULL
row-size=12B cardinality=1.73K
====
# HBase scan query with 'IS NOT NULL' predicate
select * from functional_hbase.alltypesagg
where bigint_col is not null
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col IS NOT NULL
row-size=84B cardinality=1.72K
====
# HBase scan query with conjunctive predicates one of which is an 'IS NULL'
select * from functional_hbase.alltypesagg
where bigint_col is null and day = 1
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col IS NULL, `day` = 1
row-size=84B cardinality=1.73K
====
# HBase scan query with conjunctive predicates one of which is an 'IS NOT NULL'
select * from functional_hbase.alltypesagg
where bigint_col is not null and bool_col = true
---- PLAN
PLAN-ROOT SINK
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col IS NOT NULL, bool_col = TRUE
row-size=84B cardinality=1.72K
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE 3:7
HBASE KEYRANGE 7:<unbounded>
HBASE KEYRANGE <unbounded>:3
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
01:EXCHANGE [UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col IS NOT NULL, bool_col = TRUE
row-size=84B cardinality=1.72K
====
# HBase scan query with an aggregation and a single predicate
select count(*) from functional_hbase.alltypesagg
where bigint_col = 10
---- PLAN
PLAN-ROOT SINK
|
01:AGGREGATE [FINALIZE]
| output: count(*)
| row-size=8B cardinality=1
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col = 10
row-size=8B cardinality=1.73K
---- DISTRIBUTEDPLAN
PLAN-ROOT SINK
|
03:AGGREGATE [FINALIZE]
| output: count:merge(*)
| row-size=8B cardinality=1
|
02:EXCHANGE [UNPARTITIONED]
|
01:AGGREGATE
| output: count(*)
| row-size=8B cardinality=1
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: bigint_col = 10
row-size=8B cardinality=1.73K
====
# HBase scan query with an aggregation and conjunctive predicates
select count(*) from functional_hbase.alltypesagg
where bigint_col = 10 and day = 1
---- PLAN
PLAN-ROOT SINK
|
01:AGGREGATE [FINALIZE]
| output: count(*)
| row-size=8B cardinality=1
|
00:SCAN HBASE [functional_hbase.alltypesagg]
predicates: `day` = 1, bigint_col = 10
row-size=12B cardinality=1.73K
====
# IMPALA-1141: Simple joins to make sure cardinality estimates are right.
select a.id, b.id, c.id
from
functional_hbase.alltypessmall b,
functional_hbase.alltypessmall a,
functional_hbase.alltypessmall c
where
b.bool_col = false and
c.month = 4 and
a.int_col = b.int_col and
c.int_col = b.int_col
---- PLAN
PLAN-ROOT SINK
|
04:HASH JOIN [INNER JOIN]
| hash predicates: a.int_col = b.int_col
| row-size=29B cardinality=300
|
|--00:SCAN HBASE [functional_hbase.alltypessmall b]
| predicates: b.bool_col = FALSE
| row-size=9B cardinality=25
|
03:HASH JOIN [INNER JOIN]
| hash predicates: a.int_col = c.int_col
| row-size=20B cardinality=120
|
|--02:SCAN HBASE [functional_hbase.alltypessmall c]
| predicates: c.`month` = 4
| row-size=12B cardinality=12
|
01:SCAN HBASE [functional_hbase.alltypessmall a]
row-size=8B cardinality=50
====