Files
impala/testdata/workloads/functional-query/queries/QueryTest/explain-level1.test
Alex Behm 6799c93922 Simplified/enhanced explain plans with a total of four explain levels.
There are now 4 explain levels summarized as follows:
- Level 0: MINIMAL
  Non-fragmented parallel plan only showing plan nodes with minimal attributes
- Level 1: STANDARD
  Non-fragmented parallel plan with some details in plan nodes
- Level 2: EXTENDED
  Non-fragmented parallel plan with full details in plan nodes including
  the table/column stats, row size, #hosts, cardinality,
  and estimated per-host memory requirement
- Level 3: VERBOSE
  Fragmented parallel plan with full details (like level 2)

This patch also includes several bugfixes related to plan costing and/or
testing of explain plans.

Change-Id: I622310f01d1b3d53ea1031adaf3b3ffdd94eba30
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1211
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
2014-01-10 19:17:59 -08:00

161 lines
4.4 KiB
Plaintext

====
---- QUERY
# Tests explaining a query (TPCDS-Q19)
explain
select
i_brand_id,
i_brand,
i_manufact_id,
i_manufact,
sum(ss_ext_sales_price) ext_price
from
tpcds.store_sales
join tpcds.item on (store_sales.ss_item_sk = item.i_item_sk)
join tpcds.customer on (store_sales.ss_customer_sk = customer.c_customer_sk)
join tpcds.customer_address on (customer.c_current_addr_sk = customer_address.ca_address_sk)
join tpcds.store on (store_sales.ss_store_sk = store.s_store_sk)
where
ss_date between '1999-11-01' and '1999-11-30'
and i_manager_id = 7
and substr(ca_zip, 1, 5) <> substr(s_zip, 1, 5)
group by
i_brand,
i_brand_id,
i_manufact_id,
i_manufact
order by
ext_price desc,
i_brand,
i_brand_id,
i_manufact_id,
i_manufact
limit 100
---- RESULTS
'Estimated Per-Host Requirements: Memory=130.33MB VCores=5'
''
'18: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'
'|'
'17: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'
'|'
'16:AGGREGATE [MERGE FINALIZE]'
'| output: SUM(SUM(ss_ext_sales_price))'
'| group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
'|'
'15:EXCHANGE [PARTITION=HASH(i_brand,i_brand_id,i_manufact_id,i_manufact)]'
'|'
'09:AGGREGATE'
'| output: SUM(ss_ext_sales_price)'
'| group by: i_brand, i_brand_id, i_manufact_id, i_manufact'
'|'
'08:HASH JOIN [INNER JOIN, BROADCAST]'
'| hash predicates: store_sales.ss_store_sk = store.s_store_sk'
'| other predicates: substr(ca_zip, 1, 5) != substr(s_zip, 1, 5)'
'|'
'|--14:EXCHANGE [BROADCAST]'
'| |'
'| 04:SCAN HDFS [tpcds.store]'
'| partitions=1/1 size=3.08KB'
'|'
'07:HASH JOIN [INNER JOIN, BROADCAST]'
'| hash predicates: customer.c_current_addr_sk = customer_address.ca_address_sk'
'|'
'|--13:EXCHANGE [BROADCAST]'
'| |'
'| 03:SCAN HDFS [tpcds.customer_address]'
'| partitions=1/1 size=5.25MB'
'|'
'06:HASH JOIN [INNER JOIN, BROADCAST]'
'| hash predicates: store_sales.ss_item_sk = item.i_item_sk'
'|'
'|--12:EXCHANGE [BROADCAST]'
'| |'
'| 01:SCAN HDFS [tpcds.item]'
'| partitions=1/1 size=4.82MB'
'| predicates: i_manager_id = 7'
'|'
'05:HASH JOIN [INNER JOIN, BROADCAST]'
'| hash predicates: customer.c_customer_sk = store_sales.ss_customer_sk'
'|'
'|--11:EXCHANGE [BROADCAST]'
'| |'
'| 00:SCAN HDFS [tpcds.store_sales]'
'| partitions=2/120 size=663.52KB'
'|'
'02:SCAN HDFS [tpcds.customer]'
' partitions=1/1 size=12.60MB'
====
---- QUERY
# Tests explaining an insert query
explain insert overwrite functional.alltypessmall (id, string_col)
partition (year, month)
select a.id, a.string_col, a.year, a.month from functional.alltypes a
left semi join functional.alltypesagg b on (a.id = b.id)
where a.year > 2009 and a.month = 4
union distinct
select id, string_col, year, month from functional.alltypes
---- RESULTS
'Estimated Per-Host Requirements: Memory=192.03MB VCores=3'
''
'WRITE TO HDFS [functional.alltypessmall, OVERWRITE=true, PARTITION-KEYS=(year,month)]'
'| partitions=96'
'|'
'05:AGGREGATE [FINALIZE]'
'| group by: id, string_col, year, month'
'|'
'08:EXCHANGE [PARTITION=UNPARTITIONED]'
'|'
'|--10:MERGE'
'| |'
'| 04:SCAN HDFS [functional.alltypes]'
'| partitions=24/24 size=956.90KB'
'|'
'09:MERGE'
'|'
'03:HASH JOIN [LEFT SEMI JOIN, PARTITIONED]'
'| hash predicates: a.id = b.id'
'|'
'|--07:EXCHANGE [PARTITION=HASH(b.id)]'
'| |'
'| 02:SCAN HDFS [functional.alltypesagg b]'
'| partitions=10/10 size=743.67KB'
'|'
'06:EXCHANGE [PARTITION=HASH(a.id)]'
'|'
'01:SCAN HDFS [functional.alltypes a]'
' partitions=1/24 size=19.71KB'
====
---- QUERY
# Tests explaining an insert query to/from an HBase table
explain insert into functional_hbase.alltypes
select a.* from functional_hbase.alltypessmall a
cross join functional.alltypessmall b
where a.year > 2009 and a.month = 4
union all
select * from functional_hbase.alltypessmall
---- RESULTS
'Estimated Per-Host Requirements: Memory=1.03GB VCores=3'
''
'WRITE TO HBASE table=functional_hbase.alltypes'
'|'
'06:EXCHANGE [PARTITION=UNPARTITIONED]'
'|'
'|--08:MERGE'
'| |'
'| 04:SCAN HBASE [functional_hbase.alltypessmall]'
'|'
'07:MERGE'
'|'
'03:CROSS JOIN [BROADCAST]'
'|'
'|--05:EXCHANGE [BROADCAST]'
'| |'
'| 02:SCAN HDFS [functional.alltypessmall b]'
'| partitions=4/4 size=6.32KB'
'|'
'01:SCAN HBASE [functional_hbase.alltypessmall a]'
' predicates: a.year > 2009, a.month = 4'
====