This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 001ded1087c Add tests for explain plan (#27371)
001ded1087c is described below
commit 001ded1087cb0afbded23529a4d92e4167ed0091
Author: boyjoy1127 <[email protected]>
AuthorDate: Sat Jul 22 22:17:27 2023 +0800
Add tests for explain plan (#27371)
* feat: support explain plan statement.
* feat: support explain plan statement.
* feat: support explain plan statement.
* refactor: support explain plan statement.
* feat: add explain plan.
* test: add more test on explain SQL.
---
.../parser/src/main/resources/case/dal/explain.xml | 60 +++++++++++++++++++++-
.../main/resources/sql/supported/dal/explain.xml | 4 +-
2 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/test/it/parser/src/main/resources/case/dal/explain.xml
b/test/it/parser/src/main/resources/case/dal/explain.xml
index 260003f9c61..c432132ffac 100644
--- a/test/it/parser/src/main/resources/case/dal/explain.xml
+++ b/test/it/parser/src/main/resources/case/dal/explain.xml
@@ -363,7 +363,7 @@
</select>
</describe>
- <describe sql-case-id="explain_select_alias_as_keyword">
+ <describe sql-case-id="explain_for_select_alias_as_keyword">
<select>
<from>
<simple-table name="t_order_item" alias="length"
start-index="53" stop-index="71" />
@@ -391,4 +391,62 @@
</select>
</describe>
+ <describe sql-case-id="explain_for_select_with_binding_tables">
+ <select>
+ <from>
+ <join-table join-type="INNER">
+ <left>
+ <simple-table name="t_order" alias="o"
start-index="33" stop-index="41" />
+ </left>
+ <right>
+ <simple-table name="t_order_item" alias="i"
start-index="48" stop-index="61" />
+ </right>
+ <using-columns name="order_id" start-index="69"
stop-index="76" />
+ </join-table>
+ </from>
+ <projections start-index="24" stop-index="26">
+ <shorthand-projection start-index="24" stop-index="26">
+ <owner name="i" start-index="24" stop-index="24" />
+ </shorthand-projection>
+ </projections>
+ <where start-index="79" stop-index="99">
+ <expr>
+ <binary-operation-expression start-index="85"
stop-index="99">
+ <left>
+ <column name="order_id" start-index="85"
stop-index="94">
+ <owner name="o" start-index="85"
stop-index="85" />
+ </column>
+ </left>
+ <operator>=</operator>
+ <right>
+ <literal-expression value="10" start-index="98"
stop-index="99" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+ </describe>
+ <describe sql-case-id="explain_for_select_with_analyze">
+ <select>
+ <projections start-index="24" stop-index="24">
+ <shorthand-projection start-index="24" stop-index="24" />
+ </projections>
+ <from>
+ <simple-table name="t_order" start-index="31" stop-index="37"
/>
+ </from>
+ <where start-index="39" stop-index="56">
+ <expr>
+ <binary-operation-expression start-index="45"
stop-index="56">
+ <left>
+ <column name="order_id" start-index="45"
stop-index="52" />
+ </left>
+ <operator>></operator>
+ <right>
+ <literal-expression value="8" start-index="56"
stop-index="56" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+ </describe>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/explain.xml
b/test/it/parser/src/main/resources/sql/supported/dal/explain.xml
index 045ffb55635..8587a0666de 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/explain.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/explain.xml
@@ -43,5 +43,7 @@
<sql-case id="explain_create_materialized_view_with_data" value="EXPLAIN
(ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) CREATE MATERIALIZED VIEW
matview_schema.mv_withdata2 (a) AS SELECT generate_series(1, 10) WITH DATA;"
db-types="PostgreSQL" />
<sql-case id="explain_create_materialized_view_with_no_data"
value="EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) CREATE
MATERIALIZED VIEW matview_schema.mv_nodata2 (a) AS SELECT generate_series(1,
10) WITH NO DATA;" db-types="PostgreSQL" />
<sql-case id="explain_performance" value="EXPLAIN PERFORMANCE SELECT 1"
db-types="openGauss" />
- <sql-case id="explain_select_alias_as_keyword" value="EXPLAIN PLAN FOR
SELECT length.item_id password FROM t_order_item length where length.item_id =
1;" db-types="Oracle" />
+ <sql-case id="explain_for_select_alias_as_keyword" value="EXPLAIN PLAN FOR
SELECT length.item_id password FROM t_order_item length where length.item_id =
1;" db-types="Oracle" />
+ <sql-case id="explain_for_select_with_binding_tables" value="EXPLAIN PLAN
FOR SELECT i.* FROM t_order o JOIN t_order_item i USING(order_id) WHERE
o.order_id = 10" db-types="Oracle" />
+ <sql-case id="explain_for_select_with_analyze" value="EXPLAIN PLAN FOR
SELECT * FROM t_order WHERE order_id > 8" db-types="Oracle" />
</sql-cases>