Skip to content

Commit

Permalink
Fix mysql range parse error when use table owner (#33874)
Browse files Browse the repository at this point in the history
* Fix mysql range parse error when use table owner

* Update release note
  • Loading branch information
strongduanmu authored Dec 2, 2024
1 parent f94cc0f commit 3c5a7b5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
1. SQL Parser: Fix mysql parse zone unreserved keyword error - [#33720](https://github.com/apache/shardingsphere/pull/33720)
1. Proxy: Fix BatchUpdateException when execute INSERT INTO ON DUPLICATE KEY UPDATE in proxy adapter - [#33796](https://github.com/apache/shardingsphere/pull/33796)
1. Infra: Fix the issue that ShardingSphere cannot connect to HiveServer2 using remote Hive Metastore Server - [#33837](https://github.com/apache/shardingsphere/pull/33837)
1. SQL Parser: Fix mysql range parse error when use table owner - [#33874](https://github.com/apache/shardingsphere/pull/33874)

### Change Logs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ customKeyword
| MAXVALUE
| BIT_XOR
| MYSQL_MAIN
| RANGE
| UTC_DATE
| UTC_TIME
| UTC_TIMESTAMP
Expand Down
24 changes: 24 additions & 0 deletions test/it/parser/src/main/resources/case/dml/select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9960,4 +9960,28 @@
<simple-table name="t_order" start-index="27" stop-index="33" />
</from>
</select>

<select sql-case-id="select_with_reserved_word_range_and_table_owner">
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<from start-index="14" stop-index="22">
<simple-table name="t_order" start-index="14" stop-index="22" alias="o"/>
</from>
<where start-index="24" stop-index="40">
<expr>
<binary-operation-expression text="o.range = 1" start-index="30" stop-index="40">
<left>
<column name="range" start-index="30" stop-index="36">
<owner name="o" start-index="30" stop-index="30"/>
</column>
</left>
<right>
<literal-expression start-index="40" stop-index="40" value="1" />
</right>
<operator>=</operator>
</binary-operation-expression>
</expr>
</where>
</select>
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,5 @@
<sql-case id="select_with_not_operator_number" value="SELECT NOT 0, NOT 1, NOT 2" db-types="MySQL" />
<sql-case id="select_with_not_operator_boolean" value="SELECT NOT TRUE, NOT FALSE" db-types="MySQL" />
<sql-case id="select_with_zone_keyword" value="SELECT order_id, zone FROM t_order" db-types="MySQL" />
<sql-case id="select_with_reserved_word_range_and_table_owner" value="SELECT * FROM t_order o WHERE o.range = 1" db-types="MySQL"/>
</sql-cases>

0 comments on commit 3c5a7b5

Please sign in to comment.