Files
impala/testdata/workloads/functional-planner/queries/PlannerTest/topn.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

136 lines
2.6 KiB
Plaintext

select name, zip
from functional.testtbl
order by name
limit 1
---- PLAN
01:TOP-N [LIMIT=1]
| order by: name ASC
|
00:SCAN HDFS [functional.testtbl]
partitions=1/1 size=0B
---- DISTRIBUTEDPLAN
03:TOP-N [LIMIT=1]
| order by: name ASC
|
02:EXCHANGE [PARTITION=UNPARTITIONED]
|
01:TOP-N [LIMIT=1]
| order by: name ASC
|
00:SCAN HDFS [functional.testtbl]
partitions=1/1 size=0B
====
select zip, count(*)
from functional.testtbl
where name like 'm%'
group by 1
order by 2 desc
limit 10
---- PLAN
02:TOP-N [LIMIT=10]
| order by: count(*) DESC
|
01:AGGREGATE [FINALIZE]
| output: count(*)
| group by: zip
|
00:SCAN HDFS [functional.testtbl]
partitions=1/1 size=0B
predicates: name LIKE 'm%'
---- DISTRIBUTEDPLAN
06:TOP-N [LIMIT=10]
| order by: count(*) DESC
|
05:EXCHANGE [PARTITION=UNPARTITIONED]
|
02:TOP-N [LIMIT=10]
| order by: count(*) DESC
|
04:AGGREGATE [MERGE FINALIZE]
| output: sum(count(*))
| group by: zip
|
03:EXCHANGE [PARTITION=HASH(zip)]
|
01:AGGREGATE
| output: count(*)
| group by: zip
|
00:SCAN HDFS [functional.testtbl]
partitions=1/1 size=0B
predicates: name LIKE 'm%'
====
select int_col, sum(float_col)
from functional_hbase.alltypessmall
where id < 5
group by 1
order by 2
limit 4
---- PLAN
02:TOP-N [LIMIT=4]
| order by: sum(float_col) ASC
|
01:AGGREGATE [FINALIZE]
| output: sum(float_col)
| group by: int_col
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
---- DISTRIBUTEDPLAN
06:TOP-N [LIMIT=4]
| order by: sum(float_col) ASC
|
05:EXCHANGE [PARTITION=UNPARTITIONED]
|
02:TOP-N [LIMIT=4]
| order by: sum(float_col) ASC
|
04:AGGREGATE [MERGE FINALIZE]
| output: sum(sum(float_col))
| group by: int_col
|
03:EXCHANGE [PARTITION=HASH(int_col)]
|
01:AGGREGATE
| output: sum(float_col)
| group by: int_col
|
00:SCAN HBASE [functional_hbase.alltypessmall]
predicates: id < 5
====
select int_col, sum(float_col), min(float_col)
from functional_hbase.alltypessmall
group by 1
order by 2,3 desc
limit 0
---- PLAN
02:TOP-N [LIMIT=0]
| order by: sum(float_col) ASC, min(float_col) DESC
|
01:AGGREGATE [FINALIZE]
| output: sum(float_col), min(float_col)
| group by: int_col
|
00:SCAN HBASE [functional_hbase.alltypessmall]
---- DISTRIBUTEDPLAN
06:TOP-N [LIMIT=0]
| order by: sum(float_col) ASC, min(float_col) DESC
|
05:EXCHANGE [PARTITION=UNPARTITIONED]
|
02:TOP-N [LIMIT=0]
| order by: sum(float_col) ASC, min(float_col) DESC
|
04:AGGREGATE [MERGE FINALIZE]
| output: sum(sum(float_col)), min(min(float_col))
| group by: int_col
|
03:EXCHANGE [PARTITION=HASH(int_col)]
|
01:AGGREGATE
| output: sum(float_col), min(float_col)
| group by: int_col
|
00:SCAN HBASE [functional_hbase.alltypessmall]
====