You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zi...@apache.org on 2023/07/23 10:24:52 UTC

[shardingsphere] branch master updated: Add rules for explain plan (#27385)

This is an automated email from the ASF dual-hosted git repository.

zichaowang 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 8f8aa647602 Add rules for explain plan (#27385)
8f8aa647602 is described below

commit 8f8aa64760206c91e5c84e21066064aa92ecdf31
Author: boyjoy1127 <10...@users.noreply.github.com>
AuthorDate: Sun Jul 23 18:24:46 2023 +0800

    Add rules for explain plan (#27385)
    
    * 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.
    
    * test: add more test on explain SQL.
---
 .../parser/src/main/resources/case/dal/explain.xml | 32 ++++++++++++++++++++++
 .../main/resources/sql/supported/dal/explain.xml   |  2 ++
 2 files changed, 34 insertions(+)

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 c432132ffac..1dc45a0345d 100644
--- a/test/it/parser/src/main/resources/case/dal/explain.xml
+++ b/test/it/parser/src/main/resources/case/dal/explain.xml
@@ -449,4 +449,36 @@
             </where>
         </select>
     </describe>
+    
+    <describe sql-case-id="explain_for_update_without_condition">
+        <update>
+            <table start-index="24" stop-index="30">
+                <simple-table name="t_order" start-index="24" stop-index="30" />
+            </table>
+            <set start-index="32" stop-index="54">
+                <assignment start-index="32" stop-index="54">
+                    <column name="status" start-index="36" stop-index="41" />
+                    <assignment-value>
+                        <literal-expression value="finished" start-index="45" stop-index="54" />
+                    </assignment-value>
+                </assignment>
+            </set>
+        </update>
+    </describe>
+    
+    <describe sql-case-id="explain_for_update">
+        <update>
+            <table start-index="8" stop-index="14">
+                <simple-table name="t_order" start-index="24" stop-index="30" />
+            </table>
+            <set start-index="32" stop-index="41" literal-stop-index="41">
+                <assignment start-index="36" stop-index="41" literal-stop-index="41">
+                    <column name="id" start-index="36" stop-index="37" />
+                    <assignment-value>
+                        <literal-expression value="1" start-index="41" stop-index="41" />
+                    </assignment-value>
+                </assignment>
+            </set>
+        </update>
+    </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 8587a0666de..7308d9e5f65 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
@@ -46,4 +46,6 @@
     <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-case id="explain_for_update_without_condition" value="EXPLAIN PLAN FOR UPDATE t_order SET status = 'finished'" db-types="Oracle" />
+    <sql-case id="explain_for_update" value="EXPLAIN PLAN FOR UPDATE t_order SET id = 1" db-types="Oracle" />
 </sql-cases>