Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mysql range parse error when use table owner #33874

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>