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

Added support for STRRIGHT alias in Doris (#31508) #33393

Merged
merged 6 commits into from
Oct 27, 2024
Merged
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
@@ -14,6 +14,7 @@
1. Agent: Simplify the use of Agent's Docker Image - [#33356](https://github.com/apache/shardingsphere/pull/33356)
1. Add arguments not null check when creating RouteUnit - [#33382](https://github.com/apache/shardingsphere/pull/33382)
1. Add index columns not empty judgement for IndexColumnTokenGenerator - [#33384](https://github.com/apache/shardingsphere/pull/33384)
1. SQL Parser: Support parsing Doris STRRIGHT - [#33393](https://github.com/apache/shardingsphere/pull/33393)

### Bug Fixes

Original file line number Diff line number Diff line change
@@ -471,6 +471,9 @@ identifierKeywordsUnambiguous
| STORAGE
| STREAM
| STRING
// DORIS ADDED BEGIN
| STRRIGHT
// DORIS ADDED END
| SUBCLASS_ORIGIN
// | SUBDATE
| SUBJECT
@@ -1207,7 +1210,11 @@ regularFunctionName
| DATABASE | SCHEMA | LEFT | RIGHT | DATE | DAY | GEOMETRYCOLLECTION | REPEAT
| LINESTRING | MULTILINESTRING | MULTIPOINT | MULTIPOLYGON | POINT | POLYGON
| TIME | TIMESTAMP | TIMESTAMP_ADD | TIMESTAMP_DIFF | DATE | CURRENT_TIMESTAMP
| CURRENT_DATE | CURRENT_TIME | UTC_TIMESTAMP | identifier
| CURRENT_DATE | CURRENT_TIME | UTC_TIMESTAMP
// DORIS ADDED BEGIN
| STRRIGHT
// DORIS ADDED END
| identifier
;

matchExpression
Original file line number Diff line number Diff line change
@@ -1073,7 +1073,7 @@ INSTANCE
: I N S T A N C E
;

// DORIS ADDED BEOIM
// DORIS ADDED BEGIN
INSTR
: I N S T R
;
@@ -2558,6 +2558,12 @@ STRING
: S T R I N G
;

// DORIS ADDED BEGIN
STRRIGHT
: S T R R I G H T
;
// DORIS ADDED END

SUBCLASS_ORIGIN
: S U B C L A S S UL_ O R I G I N
;
Original file line number Diff line number Diff line change
@@ -2967,7 +2967,7 @@
</projections>
</select>

<select sql-case-id="select_right">
<select sql-case-id="select_right" db-types="MySQL, Doris">
<projections start-index="7" stop-index="27">
<expression-projection start-index="7" stop-index="27" text="RIGHT('foobarbar', 4)">
<expr>
@@ -4247,4 +4247,20 @@
</expression-projection>
</projections>
</select>
<select sql-case-id="select_strright" db-types="Doris">
<projections start-index="7" stop-index="29">
<expression-projection start-index="7" stop-index="29" text="STRRIGHT('foobarbar',4)">
<expr>
<function function-name="STRRIGHT" text="STRRIGHT('foobarbar',4)" start-index="7" stop-index="29">
<parameter>
<literal-expression value="foobarbar" start-index="16" stop-index="26" />
</parameter>
<parameter>
<literal-expression value="4" start-index="28" stop-index="28" />
</parameter>
</function>
</expr>
</expression-projection>
</projections>
</select>
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@
<sql-case id="select_repeat" value="SELECT REPEAT('MySQL', 3)" db-types="MySQL" />
<sql-case id="select_replace" value="SELECT REPLACE('www.mysql.com', 'w', 'Ww')" db-types="MySQL" />
<sql-case id="select_reverse" value="SELECT REVERSE('abc')" db-types="MySQL" />
<sql-case id="select_right" value="SELECT RIGHT('foobarbar', 4)" db-types="MySQL" />
<sql-case id="select_right" value="SELECT RIGHT('foobarbar', 4)" db-types="MySQL, Doris" />
<sql-case id="select_roles_graphml" value="SELECT ROLES_GRAPHML()" db-types="MySQL" />
<sql-case id="select_round" value="SELECT ROUND(1.58)" db-types="MySQL" />
<sql-case id="select_row_count" value="SELECT ROW_COUNT()" db-types="MySQL" />
@@ -246,4 +246,5 @@
<sql-case id="select_st_crosses" value="SELECT ST_Crosses(ST_GeomFromText('POINT(1 1)'), ST_GeomFromText('POINT(2 2)'))" db-types="MySQL,Doris" />
<sql-case id="select_bitxor" value="SELECT BITXOR(3,5)" db-types="Doris" />
<sql-case id="select_instr" value="SELECT INSTR('foobar','bar')" db-types="Doris" />
<sql-case id="select_strright" value="SELECT STRRIGHT('foobarbar',4)" db-types="Doris" />
</sql-cases>