Files
impala/testdata/workloads/functional-planner/queries/PlannerTest/hbase.test
Nong Li 0d2919fe7f Refactor scalar and aggregate function analysis and execution.
This patch cleans up analysis and execution of scalar and aggregate functions
so that there is no difference between how builtins and user functions are
handled. The only difference is that the catalog is populated with the builtins
all the time.

The BE always gets a TFunction object and just executes it (builtins will have
an empty hdfs file location).

This removes the opcode registry and all of the functionality is subsumed by
the catalog, most of which was already duplicated there anyway.

This also introduces the concept of a system database; databases that the
user cannot modify and is populated automatically on startup.

Change-Id: Iaa3f84dad0a1a57691f5c7d8df7305faf01d70ed
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1386
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1577
2014-02-18 18:40:08 -08:00

498 lines
14 KiB
Plaintext

# full scan of string typed row-key
select * from functional_hbase.stringids
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
====
# 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
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 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
00:SCAN HBASE [functional_hbase.stringids]
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 5:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id > '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 5\0
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 5\0:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 5\0
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id >= '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 5
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 5:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 5
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id < '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
stop key: 5
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:5
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
stop key: 5
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id <= '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
stop key: 5\0
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
stop key: 5\0
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id > '4' and id < '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 4\0
stop key: 5
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 4\0:5
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 4\0
stop key: 5
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id >= '4' and id < '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 4:5
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id > '4' and id <= '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 4\0
stop key: 5\0
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 4\0:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 4\0
stop key: 5\0
predicates: tinyint_col = 5
====
select * from functional_hbase.stringids
where id >= '4' and id <= '5'
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5\0
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 4:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5\0
predicates: tinyint_col = 5
====
# with aggregation
select int_col, count(*)
from functional_hbase.alltypessmall
where id < 5
group by 1
---- PLAN
01:AGGREGATE [FINALIZE]
| output: count(*)
| group by: int_col
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
04:EXCHANGE [PARTITION=UNPARTITIONED]
|
03:AGGREGATE [MERGE FINALIZE]
| output: sum(count(*))
| group by: int_col
|
02:EXCHANGE [PARTITION=HASH(int_col)]
|
01:AGGREGATE
| output: count(*)
| group by: int_col
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
====
# predicates on string columns against a constant string are converted to HBase filters
select * from functional_hbase.alltypessmall where string_col = '4'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
====
# test all comparison ops
select * from functional_hbase.alltypessmall where string_col != '4'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col NOT_EQUAL '4'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col NOT_EQUAL '4'
====
select * from functional_hbase.alltypessmall where string_col < '4'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS '4'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS '4'
====
select * from functional_hbase.alltypessmall where string_col > '4'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER '4'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER '4'
====
select * from functional_hbase.alltypessmall where string_col <= '4'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS_OR_EQUAL '4'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col LESS_OR_EQUAL '4'
====
select * from functional_hbase.alltypessmall where string_col >= '4'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER_OR_EQUAL '4'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col GREATER_OR_EQUAL '4'
====
# test multiple filters
select * from functional_hbase.alltypessmall
where string_col >= '4' and string_col != '2' and date_string_col = '04/03/09'
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters:
d:date_string_col EQUAL '04/03/09'
d:string_col GREATER_OR_EQUAL '4'
d:string_col NOT_EQUAL '2'
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters:
d:date_string_col EQUAL '04/03/09'
d:string_col GREATER_OR_EQUAL '4'
d:string_col NOT_EQUAL '2'
====
# mix of predicates and functional_hbase. filters
select * from functional_hbase.alltypessmall where string_col = '4' and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5
====
# 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
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 4:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5
====
# 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
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: CAST(string_col AS INT) >= 4
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: CAST(string_col AS INT) >= 4
====
# non-const comparisons cannot be turned into filters
select * from functional_hbase.alltypessmall where string_col >= date_string_col
---- PLAN
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: string_col >= date_string_col
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: string_col >= date_string_col
====
# IMP-1188 - row key predicate is a constant expr.
select * from functional_hbase.stringids
where id = concat('', '5')
and tinyint_col = 5
---- PLAN
00:SCAN HBASE [functional_hbase.stringids]
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 5:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 5
stop key: 5\0
predicates: tinyint_col = 5
====
# 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
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60202 4:5\0
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
start key: 4
stop key: 5\0
hbase filters: d:string_col EQUAL '4'
predicates: tinyint_col = 5
====
# IMP-1188 - row key predicate is null.
select * from functional_hbase.stringids where id = null
---- PLAN
empty scan node
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
empty scan node
====
# IMP-1188 - row key lower bound is bigger than upper bound.
select * from functional_hbase.stringids where id > 'b' and id < 'a'
---- PLAN
empty scan node
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
empty scan node
====
# 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
00:SCAN HBASE [functional_hbase.stringids]
predicates: CAST(id AS INT) < 5
---- SCANRANGELOCATIONS
NODE 0:
HBASE KEYRANGE port=60201 <unbounded>:3
HBASE KEYRANGE port=60202 3:7
HBASE KEYRANGE port=60203 7:<unbounded>
---- DISTRIBUTEDPLAN
01:EXCHANGE [PARTITION=UNPARTITIONED]
|
00:SCAN HBASE [functional_hbase.stringids]
predicates: CAST(id AS INT) < 5
====