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 39aa5843891 Support prediction_probability function (#27984)
39aa5843891 is described below
commit 39aa58438911be454ea3eca7451bd0a9315095d3
Author: Zichao <[email protected]>
AuthorDate: Tue Aug 8 19:58:56 2023 +1200
Support prediction_probability function (#27984)
---
.../src/main/antlr4/imports/oracle/BaseRule.g4 | 6 +-----
.../main/resources/case/dml/select-expression.xml | 24 ++++++++++++++++++++++
.../sql/supported/dml/select-expression.xml | 1 +
3 files changed, 26 insertions(+), 5 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 c04563e5749..f70e6869cd4 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
@@ -788,7 +788,7 @@ featureFunction
;
featureFunctionName
- : FEATURE_COMPARE | FEATURE_DETAILS | FEATURE_SET | FEATURE_ID |
FEATURE_VALUE | CLUSTER_DETAILS | CLUSTER_DISTANCE | CLUSTER_ID |
CLUSTER_PROBABILITY | CLUSTER_SET
+ : FEATURE_COMPARE | FEATURE_DETAILS | FEATURE_SET | FEATURE_ID |
FEATURE_VALUE | CLUSTER_DETAILS | CLUSTER_DISTANCE | CLUSTER_ID |
CLUSTER_PROBABILITY | CLUSTER_SET | PREDICTION_PROBABILITY
;
miningAttributeClause
@@ -1778,10 +1778,6 @@ attributeValue
: identifier
;
-profileName
- : identifier
- ;
-
joinGroupName
: identifier
;
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 f25b136a918..44ea9fe7ba8 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
@@ -2745,4 +2745,28 @@
<simple-table start-index="110" stop-index="113" name="DUAL" />
</from>
</select>
+
+ <select sql-case-id="select_prediction_probability_function">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73"
text="PREDICTION_PROBABILITY(dt_sh_clas_sample, 1 USING *)"
alias="cust_card_prob">
+ <function start-index="7" stop-index="73"
function-name="PREDICTION_PROBABILITY" alias="cust_card_prob"
text="PREDICTION_PROBABILITY(dt_sh_clas_sample, 1 USING *)" />
+ </expression-projection>
+ </projections>
+ <from>
+ <simple-table start-index="80" stop-index="98"
name="mining_data_apply_v" />
+ </from>
+ <where start-index="100" stop-index="121">
+ <expr>
+ <binary-operation-expression start-index="106"
stop-index="121">
+ <left>
+ <column name="cust_id" start-index="106"
stop-index="112" />
+ </left>
+ <operator>=</operator>
+ <right>
+ <literal-expression start-index="116" stop-index="121"
value="101488" />
+ </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 60df36f1ab7..e5e31570faa 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
@@ -116,4 +116,5 @@
<sql-case id="select_collect_expression" value="SELECT
CAST(COLLECT(warehouse_name ORDER BY warehouse_name) AS warehouse_name_t)
"Warehouses" FROM warehouses;" db-types="Oracle" />
<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-cases>