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 2bbda186675 Support prediction_set function (#27989)
2bbda186675 is described below

commit 2bbda1866751251b860c229c47f4085f558fbf07
Author: Zichao <[email protected]>
AuthorDate: Wed Aug 9 20:37:53 2023 +1200

    Support prediction_set function (#27989)
---
 .../src/main/antlr4/imports/oracle/BaseRule.g4     |  4 ++--
 .../main/resources/case/dml/select-expression.xml  | 24 ++++++++++++++++++++++
 .../sql/supported/dml/select-expression.xml        |  1 +
 3 files changed, 27 insertions(+), 2 deletions(-)

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 f70e6869cd4..e2f6a122395 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
@@ -784,11 +784,11 @@ setFunction
 
 featureFunction
     : featureFunctionName LP_ (schemaName DOT_)? modelName (COMMA_ featureId)? 
(COMMA_ numberLiterals (COMMA_ numberLiterals)?)?
-    (DESC | ASC | ABS)? miningAttributeClause (AND miningAttributeClause)? RP_
+    (DESC | ASC | ABS)? (COST MODEL (AUTO)?)? miningAttributeClause (AND 
miningAttributeClause)? RP_
     ;
 
 featureFunctionName
-    : FEATURE_COMPARE | FEATURE_DETAILS | FEATURE_SET | FEATURE_ID | 
FEATURE_VALUE | CLUSTER_DETAILS | CLUSTER_DISTANCE | CLUSTER_ID | 
CLUSTER_PROBABILITY | CLUSTER_SET | PREDICTION_PROBABILITY
+    : FEATURE_COMPARE | FEATURE_DETAILS | FEATURE_SET | FEATURE_ID | 
FEATURE_VALUE | CLUSTER_DETAILS | CLUSTER_DISTANCE | CLUSTER_ID | 
CLUSTER_PROBABILITY | CLUSTER_SET | PREDICTION_PROBABILITY | PREDICTION_SET
     ;
 
 miningAttributeClause
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 44ea9fe7ba8..ce4179b8bf1 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
@@ -2769,4 +2769,28 @@
             </expr>
         </where>
     </select>
+    
+    <select sql-case-id="select_prediction_set_function">
+        <projections start-index="7" stop-index="63">
+            <expression-projection start-index="7" stop-index="63" 
text="PREDICTION_SET(dt_sh_clas_sample COST MODEL USING *)" alias="pset">
+                <function function-name="PREDICTION_SET" start-index="7" 
stop-index="63" text="PREDICTION_SET(dt_sh_clas_sample COST MODEL USING *)" 
alias="pset" />
+            </expression-projection>
+        </projections>
+        <from>
+            <simple-table start-index="70" stop-index="88" 
name="mining_data_apply_v" />
+        </from>
+        <where start-index="90" stop-index="111">
+            <expr>
+                <binary-operation-expression start-index="96" stop-index="111">
+                    <left>
+                        <column name="cust_id" start-index="96" 
stop-index="102" />
+                    </left>
+                    <operator>=</operator>
+                    <right>
+                        <literal-expression value="100011" start-index="106" 
stop-index="111" />
+                    </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 e5e31570faa..7ca31124b5c 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
@@ -117,4 +117,5 @@
     <sql-case id="select_expr_dot_expr" value="SELECT 
DBURIType('/HR/DEPARTMENTS').getXML() FROM DUAL;" db-types="Oracle" />
     <sql-case id="select_arrow_symbol_in_function" value="SELECT 
DECODE(DBMS_COMPRESSION.GET_COMPRESSION_TYPE(ownname => 'HR'), 'No 
Compression') compression_type FROM DUAL;" db-types="Oracle" />
     <sql-case id="select_prediction_probability_function" value="SELECT 
PREDICTION_PROBABILITY(dt_sh_clas_sample, 1 USING *) cust_card_prob FROM 
mining_data_apply_v WHERE cust_id = 101488;" db-types="Oracle" />
+    <sql-case id="select_prediction_set_function" value="SELECT 
PREDICTION_SET(dt_sh_clas_sample COST MODEL USING *) pset FROM 
mining_data_apply_v WHERE cust_id = 100011" db-types="Oracle" />
 </sql-cases>

Reply via email to