You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ch...@apache.org on 2023/08/10 11:12:18 UTC

[shardingsphere] branch master updated: Support Oracle PREDICTION_DETAILS function parse (#28017)

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

chengzhang 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 1169264f8fc Support Oracle PREDICTION_DETAILS function parse (#28017)
1169264f8fc is described below

commit 1169264f8fce64a47777a2666447e58c1ad0ca32
Author: Zichao <57...@users.noreply.github.com>
AuthorDate: Thu Aug 10 23:12:08 2023 +1200

    Support Oracle PREDICTION_DETAILS function parse (#28017)
---
 .../src/main/antlr4/imports/oracle/BaseRule.g4     |  2 +-
 .../main/resources/case/dml/select-expression.xml  | 23 ++++++++++++++++++++++
 .../sql/supported/dml/select-expression.xml        |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4 b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4
index 53d92557450..b00b9035a71 100644
--- a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4
+++ b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4
@@ -793,7 +793,7 @@ featureFunction
 
 featureFunctionName
     : FEATURE_COMPARE | FEATURE_DETAILS | FEATURE_SET | FEATURE_ID | FEATURE_VALUE | CLUSTER_DETAILS | CLUSTER_DISTANCE | CLUSTER_ID | CLUSTER_PROBABILITY | CLUSTER_SET
-    | PREDICTION_PROBABILITY | PREDICTION_SET | PREDICTION_BOUNDS | PREDICTION
+    | PREDICTION_PROBABILITY | PREDICTION_SET | PREDICTION_BOUNDS | PREDICTION | PREDICTION_DETAILS
     ;
 
 cost_matrix_clause
diff --git a/test/it/parser/src/main/resources/case/dml/select-expression.xml b/test/it/parser/src/main/resources/case/dml/select-expression.xml
index 27271350e73..e4ca1a5df40 100644
--- a/test/it/parser/src/main/resources/case/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-expression.xml
@@ -2888,4 +2888,27 @@
             </expr>
         </where>
     </select>
+    <select sql-case-id="select_prediction_details_function">
+        <projections start-index="7" stop-index="51">
+            <expression-projection start-index="7" stop-index="51" text="PREDICTION_DETAILS(DT_SH_Clas_sample using *)">
+                <function function-name="PREDICTION_DETAILS" start-index="7" stop-index="51" text="PREDICTION_DETAILS(DT_SH_Clas_sample using *)" />
+            </expression-projection>
+        </projections>
+        <from>
+            <simple-table name="mining_data_apply_v" start-index="58" stop-index="76" />
+        </from>
+        <where start-index="78" stop-index="105">
+            <expr>
+                <binary-operation-expression start-index="84" stop-index="105">
+                    <left>
+                        <column start-index="84" stop-index="93" name="occupation" />
+                    </left>
+                    <operator>=</operator>
+                    <right>
+                        <literal-expression value="TechSup" start-index="97" stop-index="105" />
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+    </select>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
index 2046b99d4c7..c8327f68a6e 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
@@ -121,4 +121,5 @@
     <sql-case id="select_cursor_function" value="SELECT CURSOR(SELECT salary, commission_pct FROM employees e WHERE e.department_id = d.department_id) FROM departments d;" db-types="Oracle" />
     <sql-case id="select_prediction_bounds_function" value="SELECT cust_id FROM mining_data_apply_v WHERE PREDICTION_BOUNDS(glmr_sh_regr_sample,0.98 USING *).LOWER = 24;" db-types="Oracle" />
     <sql-case id="select_prediction_function" value="SELECT cust_gender FROM mining_data_apply_v WHERE PREDICTION (nb_sh_clas_sample COST MODEL AUTO USING cust_marital_status, aeducation, household_size) = 1;" db-types="Oracle" />
+    <sql-case id="select_prediction_details_function" value="SELECT PREDICTION_DETAILS(DT_SH_Clas_sample using *) FROM mining_data_apply_v WHERE occupation = 'TechSup'" db-types="Oracle" />
 </sql-cases>