[
https://issues.apache.org/jira/browse/IMPALA-14916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18088222#comment-18088222
]
Stamatis Zampetakis commented on IMPALA-14916:
----------------------------------------------
Thanks for supporting the idea [~stigahuang]! Apologies for the late reply I
just seen your message. There are many examples in the Gerrit request but for
convenient I also attach one for a simple SQL query below:
{noformat}
$IMPALA_HOME/bin/impala-shell.sh -Q planner=CALCITE -Q
enable_explain_calcite=true -d tpcds_parquet
{noformat}
{code:sql}
EXPLAIN SELECT
d.d_year,
SUM(ss.ss_ext_sales_price) AS total_sales,
COUNT(*) AS sale_count
FROM store_sales ss
JOIN date_dim d
ON ss.ss_sold_date_sk = d.d_date_sk
WHERE d.d_year = 2001
GROUP BY d.d_year;
{code}
{noformat}
+----------------------------------------------------------------------------------------------------------------------------+
| Explain String
|
+----------------------------------------------------------------------------------------------------------------------------+
| Max Per-Host Resource Reservation: Memory=79.44MB Threads=6
|
| Per-Host Resource Estimates: Memory=312MB
|
| WARNING: The following tables are missing relevant table and/or column
statistics. |
| tpcds_parquet.date_dim, tpcds_parquet.store_sales
|
|
|
| ImpalaAggRel(group=[{0}], TOTAL_SALES=[SUM($1)], SALE_COUNT=[COUNT()])
|
| ImpalaProjectRel(D_YEAR=[$3], ss_ext_sales_price=[$0])
|
| ImpalaJoinRel(condition=[=($1, $2)], joinType=[inner])
|
| ImpalaProjectRel(ss_ext_sales_price=[$14], ss_sold_date_sk=[$22])
|
| ImpalaFilterRel(condition=[IS NOT NULL($22)])
|
| ImpalaHdfsScanRel(table=[[tpcds_parquet, store_sales]])
|
| ImpalaProjectRel(d_date_sk=[$0], d_year=[$6])
|
| ImpalaFilterRel(condition=[AND(=($6, 2001), IS NOT NULL($0))])
|
| ImpalaHdfsScanRel(table=[[tpcds_parquet, date_dim]])
|
| PLAN-ROOT SINK
|
| |
|
| 07:EXCHANGE [UNPARTITIONED]
|
| |
|
| 06:AGGREGATE [FINALIZE]
|
| | output: sum:merge(tpcds_parquet.store_sales.ss_ext_sales_price),
count:merge() |
| | group by: tpcds_parquet.date_dim.d_year
|
| | row-size=28B cardinality=1
|
| |
|
| 05:EXCHANGE [HASH(tpcds_parquet.date_dim.d_year)]
|
| |
|
| 03:AGGREGATE [STREAMING]
|
| | output: sum(tpcds_parquet.store_sales.ss_ext_sales_price), count()
|
| | group by: tpcds_parquet.date_dim.d_year
|
| | row-size=28B cardinality=3
|
| |
|
| 02:HASH JOIN [INNER JOIN, BROADCAST]
|
| | hash predicates: tpcds_parquet.store_sales.ss_sold_date_sk =
tpcds_parquet.date_dim.d_date_sk |
| | runtime filters: RF000 <- tpcds_parquet.date_dim.d_date_sk, RF001 <-
tpcds_parquet.date_dim.d_date_sk |
| | row-size=16B cardinality=10.12M
|
| |
|
| |--04:EXCHANGE [BROADCAST]
|
| | |
|
| | 01:SCAN HDFS [tpcds_parquet.date_dim]
|
| | HDFS partitions=1/1 files=1 size=2.15MB
|
| | predicates: tpcds_parquet.date_dim.d_year = 2001,
tpcds_parquet.date_dim.d_date_sk IS NOT NULL |
| | row-size=8B cardinality=5.40K
|
| |
|
| 00:SCAN HDFS [tpcds_parquet.store_sales]
|
| partition predicates: tpcds_parquet.store_sales.ss_sold_date_sk IS NOT
NULL |
| HDFS partitions=1823/1824 files=1823 size=194.20MB
|
| runtime filters: RF001 -> tpcds_parquet.store_sales.ss_sold_date_sk, RF000
-> tpcds_parquet.store_sales.ss_sold_date_sk |
| row-size=8B cardinality=10.12M
|
+----------------------------------------------------------------------------------------------------------------------------+
{noformat}
> Display Calcite plan in EXPLAIN output
> --------------------------------------
>
> Key: IMPALA-14916
> URL: https://issues.apache.org/jira/browse/IMPALA-14916
> Project: IMPALA
> Issue Type: Sub-task
> Reporter: Stamatis Zampetakis
> Assignee: Stamatis Zampetakis
> Priority: Major
>
> For performance analysis, debugging, and testing purposes it is useful to be
> able to display the Calcite plan in the EXPLAIN output.
> However, printing it always may be undesirable and noisy so we need a way to
> control when it is displayed or not. There are a few alternatives:
> * Dedicated command (EXPLAIN CALCITE)
> * New explain level (TExplainLevel.CALCITE)
> * New query option (e.g., ENABLE_EXPLAIN_CALCITE)
> If we treat the Calcite plan as additional info to be printed along with all
> the existing content of the EXPLAIN then the new option approach seems
> better. On the other hand, if we opt to display exclusively the Calcite plan
> with nothing more then a new explain level or command would make more sense.
> However, the explain levels so far are rather cumulative so to that respect a
> level that displays only the Calcite plan does not fit well in that model.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]