mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
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
This commit is contained in:
@@ -726,7 +726,7 @@ timestamp, bigint
|
||||
# Test NULLs in aggregate functions
|
||||
select count(NULL), min(NULL), max(NULL), sum(NULL), avg(NULL) from alltypesagg
|
||||
---- TYPES
|
||||
bigint, NULL, NULL, NULL, double
|
||||
bigint, boolean, boolean, bigint, double
|
||||
---- RESULTS
|
||||
0,NULL,NULL,NULL,NULL
|
||||
====
|
||||
@@ -734,7 +734,7 @@ bigint, NULL, NULL, NULL, double
|
||||
# Test ignored distinct in MIN and MAX with NULLs
|
||||
select min(distinct NULL), max(distinct NULL) from alltypesagg
|
||||
---- TYPES
|
||||
NULL, NULL
|
||||
boolean, boolean
|
||||
---- RESULTS
|
||||
NULL,NULL
|
||||
====
|
||||
@@ -821,7 +821,7 @@ int, string
|
||||
---- QUERY
|
||||
# Test group_concat with column delimiter
|
||||
# Will cause all columns save first to be duplicated
|
||||
select day, group_concat(string_col, string_col)
|
||||
select day, group_concat(trim(string_col), trim(string_col))
|
||||
from alltypesagg
|
||||
where id % 200 = day
|
||||
group by day
|
||||
|
||||
@@ -34,21 +34,21 @@ limit 100
|
||||
'Estimated Per-Host Requirements: Memory=144.66MB VCores=5'
|
||||
''
|
||||
'19:TOP-N [LIMIT=100]'
|
||||
'| order by: SUM(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'| order by: sum(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'|'
|
||||
'18:EXCHANGE [PARTITION=UNPARTITIONED]'
|
||||
'|'
|
||||
'10:TOP-N [LIMIT=100]'
|
||||
'| order by: SUM(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'| order by: sum(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'|'
|
||||
'17:AGGREGATE [MERGE FINALIZE]'
|
||||
'| output: SUM(SUM(ss_ext_sales_price))'
|
||||
'| output: sum(sum(ss_ext_sales_price))'
|
||||
'| group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
|
||||
'|'
|
||||
'16:EXCHANGE [PARTITION=HASH(i_brand,i_brand_id,i_manufact_id,i_manufact)]'
|
||||
'|'
|
||||
'09:AGGREGATE'
|
||||
'| output: SUM(ss_ext_sales_price)'
|
||||
'| output: sum(ss_ext_sales_price)'
|
||||
'| group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
|
||||
'|'
|
||||
'08:HASH JOIN [INNER JOIN, BROADCAST]'
|
||||
@@ -160,4 +160,4 @@ select * from functional_hbase.alltypessmall
|
||||
'|'
|
||||
'01:SCAN HBASE [functional_hbase.alltypessmall a]'
|
||||
' predicates: a.year > 2009, a.month = 4'
|
||||
====
|
||||
====
|
||||
|
||||
@@ -34,7 +34,7 @@ limit 100
|
||||
'Estimated Per-Host Requirements: Memory=144.66MB VCores=5'
|
||||
''
|
||||
'19:TOP-N [LIMIT=100]'
|
||||
'| order by: SUM(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'| order by: sum(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'| hosts=3 per-host-mem=unavailable'
|
||||
'| tuple-ids=5 row-size=48B cardinality=100'
|
||||
'|'
|
||||
@@ -43,12 +43,12 @@ limit 100
|
||||
'| tuple-ids=5 row-size=48B cardinality=100'
|
||||
'|'
|
||||
'10:TOP-N [LIMIT=100]'
|
||||
'| order by: SUM(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'| order by: sum(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
'| hosts=3 per-host-mem=4.69KB'
|
||||
'| tuple-ids=5 row-size=48B cardinality=100'
|
||||
'|'
|
||||
'17:AGGREGATE [MERGE FINALIZE]'
|
||||
'| output: SUM(SUM(ss_ext_sales_price))'
|
||||
'| output: sum(sum(ss_ext_sales_price))'
|
||||
'| group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
|
||||
'| hosts=3 per-host-mem=10.00MB'
|
||||
'| tuple-ids=5 row-size=48B cardinality=87208'
|
||||
@@ -58,7 +58,7 @@ limit 100
|
||||
'| tuple-ids=5 row-size=48B cardinality=87208'
|
||||
'|'
|
||||
'09:AGGREGATE'
|
||||
'| output: SUM(ss_ext_sales_price)'
|
||||
'| output: sum(ss_ext_sales_price)'
|
||||
'| group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
|
||||
'| hosts=3 per-host-mem=10.00MB'
|
||||
'| tuple-ids=5 row-size=48B cardinality=87208'
|
||||
@@ -260,4 +260,4 @@ select * from functional_hbase.alltypessmall
|
||||
' column stats: all'
|
||||
' hosts=100 per-host-mem=1.00GB'
|
||||
' tuple-ids=0 row-size=97B cardinality=4'
|
||||
====
|
||||
====
|
||||
|
||||
@@ -35,7 +35,7 @@ limit 100
|
||||
''
|
||||
'F07:PLAN FRAGMENT [PARTITION=UNPARTITIONED]'
|
||||
' 19:TOP-N [LIMIT=100]'
|
||||
' | order by: SUM(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
' | order by: sum(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
' | hosts=3 per-host-mem=unavailable'
|
||||
' | tuple-ids=5 row-size=48B cardinality=100'
|
||||
' |'
|
||||
@@ -46,12 +46,12 @@ limit 100
|
||||
'F06:PLAN FRAGMENT [PARTITION=HASH(i_brand,i_brand_id,i_manufact_id,i_manufact)]'
|
||||
' DATASTREAM SINK [FRAGMENT=F07, EXCHANGE=18, PARTITION=UNPARTITIONED]'
|
||||
' 10:TOP-N [LIMIT=100]'
|
||||
' | order by: SUM(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
' | order by: sum(ss_ext_sales_price) DESC, i_brand ASC, i_brand_id ASC, i_manufact_id ASC, i_manufact ASC'
|
||||
' | hosts=3 per-host-mem=4.69KB'
|
||||
' | tuple-ids=5 row-size=48B cardinality=100'
|
||||
' |'
|
||||
' 17:AGGREGATE [MERGE FINALIZE]'
|
||||
' | output: SUM(SUM(ss_ext_sales_price))'
|
||||
' | output: sum(sum(ss_ext_sales_price))'
|
||||
' | group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
|
||||
' | hosts=3 per-host-mem=10.00MB'
|
||||
' | tuple-ids=5 row-size=48B cardinality=87208'
|
||||
@@ -63,7 +63,7 @@ limit 100
|
||||
'F02:PLAN FRAGMENT [PARTITION=HASH(customer_address.ca_address_sk)]'
|
||||
' DATASTREAM SINK [FRAGMENT=F06, EXCHANGE=16, PARTITION=HASH(i_brand,i_brand_id,i_manufact_id,i_manufact)]'
|
||||
' 09:AGGREGATE'
|
||||
' | output: SUM(ss_ext_sales_price)'
|
||||
' | output: sum(ss_ext_sales_price)'
|
||||
' | group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
|
||||
' | hosts=3 per-host-mem=10.00MB'
|
||||
' | tuple-ids=5 row-size=48B cardinality=87208'
|
||||
@@ -291,4 +291,4 @@ select * from functional_hbase.alltypessmall
|
||||
' column stats: all'
|
||||
' hosts=3 per-host-mem=32.00MB'
|
||||
' tuple-ids=1 row-size=0B cardinality=100'
|
||||
====
|
||||
====
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
====
|
||||
---- QUERY
|
||||
select udf_test.trim('HelloWorld')
|
||||
---- RESULTS
|
||||
'HelloWorld'
|
||||
---- TYPES
|
||||
STRING
|
||||
====
|
||||
---- QUERY
|
||||
select udf_test.hive_pi()
|
||||
---- RESULTS
|
||||
3.141592653589793
|
||||
|
||||
@@ -6,6 +6,7 @@ drop function if exists udf_test.hive_floor(double);
|
||||
drop function if exists udf_test.hive_mod(int, int);
|
||||
drop function if exists udf_test.hive_bin(bigint);
|
||||
drop function if exists udf_test.hive_lower(string);
|
||||
drop function if exists udf_test.hive_trim(string);
|
||||
|
||||
drop function if exists udf_test.identity(boolean);
|
||||
drop function if exists udf_test.identity(tinyint);
|
||||
|
||||
Reference in New Issue
Block a user