You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "lushaorong (via GitHub)" <gi...@apache.org> on 2024/08/19 15:57:06 UTC
[PR] Improve the parsing of methods in MySQL [shardingsphere]
lushaorong opened a new pull request, #32599:
URL: https://github.com/apache/shardingsphere/pull/32599
Fixes #31558.
Changes proposed in this pull request:
- Improve the parsing of methods in MySQL
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have self-reviewed the commit code.
- [x] I have (or in comment I request) added corresponding labels for the pull request.
- [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [x] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "lushaorong (via GitHub)" <gi...@apache.org>.
lushaorong commented on PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599#issuecomment-2309313609
> Hi @lushaorong, could you please check if Doris supports these statements? If so, please submit another PR.
I can try it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "lushaorong (via GitHub)" <gi...@apache.org>.
lushaorong commented on code in PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599#discussion_r1722601778
##########
test/it/parser/src/main/resources/case/dml/select-special-function.xml:
##########
@@ -3020,4 +3020,168 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_md5">
+ <projections start-index="7" stop-index="20">
+ <expression-projection start-index="7" stop-index="20" text="MD5('testing')">
+ <expr>
+ <function function-name="MD5" text="MD5('testing')" start-index="7" stop-index="20">
+ <parameter>
+ <literal-expression value="testing" start-index="11" stop-index="19" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_member_of">
+ <projections start-index="7" stop-index="49">
+ <expression-projection start-index="7" stop-index="49" text="'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')">
+ <expr>
+ <binary-operation-expression start-index="7" stop-index="49">
+ <left>
+ <literal-expression value="ab" start-index="7" stop-index="10" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text="'[23, "abc", 17, "ab", 10]'" start-index="22" stop-index="48" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_microsecond">
+ <projections start-index="7" stop-index="36">
+ <expression-projection start-index="7" stop-index="36" text="MICROSECOND('12:00:00.123456')">
+ <expr>
+ <function function-name="MICROSECOND" text="MICROSECOND('12:00:00.123456')" start-index="7" stop-index="36">
+ <parameter>
+ <literal-expression value="12:00:00.123456" start-index="19" stop-index="35" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mid">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MID('foobarbar' from 4)" start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MID" start-index="7" stop-index="29" text="MID('foobarbar' from 4)" >
+ <parameter>
+ <literal-expression value="foobarbar" start-index="11" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="28" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_minute">
+ <projections start-index="7" stop-index="35">
+ <expression-projection start-index="7" stop-index="35" text="MINUTE('2008-02-03 10:05:03')">
+ <expr>
+ <function function-name="MINUTE" text="MINUTE('2008-02-03 10:05:03')" start-index="7" stop-index="35">
+ <parameter>
+ <literal-expression value="2008-02-03 10:05:03" start-index="14" stop-index="34" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mod">
+ <projections start-index="7" stop-index="18">
+ <expression-projection start-index="7" stop-index="18" text="MOD(234, 10)">
+ <expr>
+ <function function-name="MOD" text="MOD(234, 10)" start-index="7" stop-index="18">
+ <parameter>
+ <literal-expression value="234" start-index="11" stop-index="13" />
+ </parameter>
+ <parameter>
+ <literal-expression value="10" start-index="16" stop-index="17" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_month">
+ <projections start-index="7" stop-index="25">
+ <expression-projection start-index="7" stop-index="25" text="MONTH('2008-02-03')">
+ <expr>
+ <function function-name="MONTH" text="MONTH('2008-02-03')" start-index="7" stop-index="25">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="13" stop-index="24" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_monthname">
+ <projections start-index="7" stop-index="29">
+ <expression-projection start-index="7" stop-index="29" text="MONTHNAME('2008-02-03')">
+ <expr>
+ <function function-name="MONTHNAME" text="MONTHNAME('2008-02-03')" start-index="7" stop-index="29">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="17" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multilinestring">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" start-index="7" stop-index="73">
+ <parameter>
+ <literal-expression value="MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))" start-index="23" stop-index="72" />
Review Comment:
> Should MultiLineString also be parsed as a function?
`MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))` is the string parameter of st_geomfromtext. How should I proceed with this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599#issuecomment-2309187762
Hi @lushaorong, could you please check if Doris supports these statements? If so, please submit another PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599#discussion_r1726434087
##########
test/it/parser/src/main/resources/case/dml/select-special-function.xml:
##########
@@ -3020,4 +3020,168 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_md5">
+ <projections start-index="7" stop-index="20">
+ <expression-projection start-index="7" stop-index="20" text="MD5('testing')">
+ <expr>
+ <function function-name="MD5" text="MD5('testing')" start-index="7" stop-index="20">
+ <parameter>
+ <literal-expression value="testing" start-index="11" stop-index="19" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_member_of">
+ <projections start-index="7" stop-index="49">
+ <expression-projection start-index="7" stop-index="49" text="'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')">
+ <expr>
+ <binary-operation-expression start-index="7" stop-index="49">
+ <left>
+ <literal-expression value="ab" start-index="7" stop-index="10" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text="'[23, "abc", 17, "ab", 10]'" start-index="22" stop-index="48" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_microsecond">
+ <projections start-index="7" stop-index="36">
+ <expression-projection start-index="7" stop-index="36" text="MICROSECOND('12:00:00.123456')">
+ <expr>
+ <function function-name="MICROSECOND" text="MICROSECOND('12:00:00.123456')" start-index="7" stop-index="36">
+ <parameter>
+ <literal-expression value="12:00:00.123456" start-index="19" stop-index="35" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mid">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MID('foobarbar' from 4)" start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MID" start-index="7" stop-index="29" text="MID('foobarbar' from 4)" >
+ <parameter>
+ <literal-expression value="foobarbar" start-index="11" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="28" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_minute">
+ <projections start-index="7" stop-index="35">
+ <expression-projection start-index="7" stop-index="35" text="MINUTE('2008-02-03 10:05:03')">
+ <expr>
+ <function function-name="MINUTE" text="MINUTE('2008-02-03 10:05:03')" start-index="7" stop-index="35">
+ <parameter>
+ <literal-expression value="2008-02-03 10:05:03" start-index="14" stop-index="34" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mod">
+ <projections start-index="7" stop-index="18">
+ <expression-projection start-index="7" stop-index="18" text="MOD(234, 10)">
+ <expr>
+ <function function-name="MOD" text="MOD(234, 10)" start-index="7" stop-index="18">
+ <parameter>
+ <literal-expression value="234" start-index="11" stop-index="13" />
+ </parameter>
+ <parameter>
+ <literal-expression value="10" start-index="16" stop-index="17" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_month">
+ <projections start-index="7" stop-index="25">
+ <expression-projection start-index="7" stop-index="25" text="MONTH('2008-02-03')">
+ <expr>
+ <function function-name="MONTH" text="MONTH('2008-02-03')" start-index="7" stop-index="25">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="13" stop-index="24" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_monthname">
+ <projections start-index="7" stop-index="29">
+ <expression-projection start-index="7" stop-index="29" text="MONTHNAME('2008-02-03')">
+ <expr>
+ <function function-name="MONTHNAME" text="MONTHNAME('2008-02-03')" start-index="7" stop-index="29">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="17" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multilinestring">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" start-index="7" stop-index="73">
+ <parameter>
+ <literal-expression value="MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))" start-index="23" stop-index="72" />
Review Comment:
> 
>
>  `(0 0, 1 1, 2 2)` cannot be parse to `literal-expression`
It looks great.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "lushaorong (via GitHub)" <gi...@apache.org>.
lushaorong commented on code in PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599#discussion_r1724464200
##########
test/it/parser/src/main/resources/case/dml/select-special-function.xml:
##########
@@ -3020,4 +3020,168 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_md5">
+ <projections start-index="7" stop-index="20">
+ <expression-projection start-index="7" stop-index="20" text="MD5('testing')">
+ <expr>
+ <function function-name="MD5" text="MD5('testing')" start-index="7" stop-index="20">
+ <parameter>
+ <literal-expression value="testing" start-index="11" stop-index="19" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_member_of">
+ <projections start-index="7" stop-index="49">
+ <expression-projection start-index="7" stop-index="49" text="'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')">
+ <expr>
+ <binary-operation-expression start-index="7" stop-index="49">
+ <left>
+ <literal-expression value="ab" start-index="7" stop-index="10" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text="'[23, "abc", 17, "ab", 10]'" start-index="22" stop-index="48" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_microsecond">
+ <projections start-index="7" stop-index="36">
+ <expression-projection start-index="7" stop-index="36" text="MICROSECOND('12:00:00.123456')">
+ <expr>
+ <function function-name="MICROSECOND" text="MICROSECOND('12:00:00.123456')" start-index="7" stop-index="36">
+ <parameter>
+ <literal-expression value="12:00:00.123456" start-index="19" stop-index="35" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mid">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MID('foobarbar' from 4)" start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MID" start-index="7" stop-index="29" text="MID('foobarbar' from 4)" >
+ <parameter>
+ <literal-expression value="foobarbar" start-index="11" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="28" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_minute">
+ <projections start-index="7" stop-index="35">
+ <expression-projection start-index="7" stop-index="35" text="MINUTE('2008-02-03 10:05:03')">
+ <expr>
+ <function function-name="MINUTE" text="MINUTE('2008-02-03 10:05:03')" start-index="7" stop-index="35">
+ <parameter>
+ <literal-expression value="2008-02-03 10:05:03" start-index="14" stop-index="34" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mod">
+ <projections start-index="7" stop-index="18">
+ <expression-projection start-index="7" stop-index="18" text="MOD(234, 10)">
+ <expr>
+ <function function-name="MOD" text="MOD(234, 10)" start-index="7" stop-index="18">
+ <parameter>
+ <literal-expression value="234" start-index="11" stop-index="13" />
+ </parameter>
+ <parameter>
+ <literal-expression value="10" start-index="16" stop-index="17" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_month">
+ <projections start-index="7" stop-index="25">
+ <expression-projection start-index="7" stop-index="25" text="MONTH('2008-02-03')">
+ <expr>
+ <function function-name="MONTH" text="MONTH('2008-02-03')" start-index="7" stop-index="25">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="13" stop-index="24" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_monthname">
+ <projections start-index="7" stop-index="29">
+ <expression-projection start-index="7" stop-index="29" text="MONTHNAME('2008-02-03')">
+ <expr>
+ <function function-name="MONTHNAME" text="MONTHNAME('2008-02-03')" start-index="7" stop-index="29">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="17" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multilinestring">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" start-index="7" stop-index="73">
+ <parameter>
+ <literal-expression value="MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))" start-index="23" stop-index="72" />
Review Comment:


`(0 0, 1 1, 2 2)` cannot be parse to `literal-expression`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve the parsing of methods in MySQL [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #32599:
URL: https://github.com/apache/shardingsphere/pull/32599#discussion_r1722530820
##########
test/it/parser/src/main/resources/case/dml/select-special-function.xml:
##########
@@ -3020,4 +3020,168 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_md5">
+ <projections start-index="7" stop-index="20">
+ <expression-projection start-index="7" stop-index="20" text="MD5('testing')">
+ <expr>
+ <function function-name="MD5" text="MD5('testing')" start-index="7" stop-index="20">
+ <parameter>
+ <literal-expression value="testing" start-index="11" stop-index="19" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_member_of">
+ <projections start-index="7" stop-index="49">
+ <expression-projection start-index="7" stop-index="49" text="'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')">
+ <expr>
+ <binary-operation-expression start-index="7" stop-index="49">
+ <left>
+ <literal-expression value="ab" start-index="7" stop-index="10" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text="'[23, "abc", 17, "ab", 10]'" start-index="22" stop-index="48" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_microsecond">
+ <projections start-index="7" stop-index="36">
+ <expression-projection start-index="7" stop-index="36" text="MICROSECOND('12:00:00.123456')">
+ <expr>
+ <function function-name="MICROSECOND" text="MICROSECOND('12:00:00.123456')" start-index="7" stop-index="36">
+ <parameter>
+ <literal-expression value="12:00:00.123456" start-index="19" stop-index="35" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mid">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MID('foobarbar' from 4)" start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MID" start-index="7" stop-index="29" text="MID('foobarbar' from 4)" >
+ <parameter>
+ <literal-expression value="foobarbar" start-index="11" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="28" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_minute">
+ <projections start-index="7" stop-index="35">
+ <expression-projection start-index="7" stop-index="35" text="MINUTE('2008-02-03 10:05:03')">
+ <expr>
+ <function function-name="MINUTE" text="MINUTE('2008-02-03 10:05:03')" start-index="7" stop-index="35">
+ <parameter>
+ <literal-expression value="2008-02-03 10:05:03" start-index="14" stop-index="34" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mod">
+ <projections start-index="7" stop-index="18">
+ <expression-projection start-index="7" stop-index="18" text="MOD(234, 10)">
+ <expr>
+ <function function-name="MOD" text="MOD(234, 10)" start-index="7" stop-index="18">
+ <parameter>
+ <literal-expression value="234" start-index="11" stop-index="13" />
+ </parameter>
+ <parameter>
+ <literal-expression value="10" start-index="16" stop-index="17" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_month">
+ <projections start-index="7" stop-index="25">
+ <expression-projection start-index="7" stop-index="25" text="MONTH('2008-02-03')">
+ <expr>
+ <function function-name="MONTH" text="MONTH('2008-02-03')" start-index="7" stop-index="25">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="13" stop-index="24" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_monthname">
+ <projections start-index="7" stop-index="29">
+ <expression-projection start-index="7" stop-index="29" text="MONTHNAME('2008-02-03')">
+ <expr>
+ <function function-name="MONTHNAME" text="MONTHNAME('2008-02-03')" start-index="7" stop-index="29">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="17" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multilinestring">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" start-index="7" stop-index="73">
+ <parameter>
+ <literal-expression value="MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))" start-index="23" stop-index="72" />
Review Comment:
Should MultiLineString also be parsed as a function?
##########
test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml:
##########
@@ -180,4 +180,16 @@
<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" />
+ <sql-case id="select_md5" value="SELECT MD5('testing')" db-types="MySQL" />
+ <sql-case id="select_member_of" value="SELECT 'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')" db-types="MySQL" />
+ <sql-case id="select_microsecond" value="SELECT MICROSECOND('12:00:00.123456')" db-types="MySQL" />
+ <sql-case id="select_mid" value="SELECT MID('foobarbar' from 4)" db-types="MySQL" />
+ <sql-case id="select_minute" value="SELECT MINUTE('2008-02-03 10:05:03')" db-types="MySQL" />
+ <sql-case id="select_mod" value="SELECT MOD(234, 10)" db-types="MySQL" />
+ <sql-case id="select_month" value="SELECT MONTH('2008-02-03')" db-types="MySQL" />
+ <sql-case id="select_monthname" value="SELECT MONTHNAME('2008-02-03')" db-types="MySQL" />
+ <sql-case id="select_multilinestring" value="SELECT ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" db-types="MySQL" />
+ <sql-case id="select_multipoint" value="SELECT ST_GeomFromText('MultiPoint((1 2), (3 4), (5 6))')" db-types="MySQL" />
+ <sql-case id="select_multipolygon" value="SELECT ST_GeomFromText('MultiPolygon(((0 0, 1 0, 1 1, 0 1, 0 0)),((2 2, 3 2, 3 3, 2 3, 2 2)))')" db-types="MySQL" />
+
Review Comment:
Please remove useless blank line.
##########
test/it/parser/src/main/resources/case/dml/select-special-function.xml:
##########
@@ -3020,4 +3020,168 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_md5">
+ <projections start-index="7" stop-index="20">
+ <expression-projection start-index="7" stop-index="20" text="MD5('testing')">
+ <expr>
+ <function function-name="MD5" text="MD5('testing')" start-index="7" stop-index="20">
+ <parameter>
+ <literal-expression value="testing" start-index="11" stop-index="19" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_member_of">
+ <projections start-index="7" stop-index="49">
+ <expression-projection start-index="7" stop-index="49" text="'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')">
+ <expr>
+ <binary-operation-expression start-index="7" stop-index="49">
+ <left>
+ <literal-expression value="ab" start-index="7" stop-index="10" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text="'[23, "abc", 17, "ab", 10]'" start-index="22" stop-index="48" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_microsecond">
+ <projections start-index="7" stop-index="36">
+ <expression-projection start-index="7" stop-index="36" text="MICROSECOND('12:00:00.123456')">
+ <expr>
+ <function function-name="MICROSECOND" text="MICROSECOND('12:00:00.123456')" start-index="7" stop-index="36">
+ <parameter>
+ <literal-expression value="12:00:00.123456" start-index="19" stop-index="35" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mid">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MID('foobarbar' from 4)" start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MID" start-index="7" stop-index="29" text="MID('foobarbar' from 4)" >
+ <parameter>
+ <literal-expression value="foobarbar" start-index="11" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="28" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_minute">
+ <projections start-index="7" stop-index="35">
+ <expression-projection start-index="7" stop-index="35" text="MINUTE('2008-02-03 10:05:03')">
+ <expr>
+ <function function-name="MINUTE" text="MINUTE('2008-02-03 10:05:03')" start-index="7" stop-index="35">
+ <parameter>
+ <literal-expression value="2008-02-03 10:05:03" start-index="14" stop-index="34" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mod">
+ <projections start-index="7" stop-index="18">
+ <expression-projection start-index="7" stop-index="18" text="MOD(234, 10)">
+ <expr>
+ <function function-name="MOD" text="MOD(234, 10)" start-index="7" stop-index="18">
+ <parameter>
+ <literal-expression value="234" start-index="11" stop-index="13" />
+ </parameter>
+ <parameter>
+ <literal-expression value="10" start-index="16" stop-index="17" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_month">
+ <projections start-index="7" stop-index="25">
+ <expression-projection start-index="7" stop-index="25" text="MONTH('2008-02-03')">
+ <expr>
+ <function function-name="MONTH" text="MONTH('2008-02-03')" start-index="7" stop-index="25">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="13" stop-index="24" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_monthname">
+ <projections start-index="7" stop-index="29">
+ <expression-projection start-index="7" stop-index="29" text="MONTHNAME('2008-02-03')">
+ <expr>
+ <function function-name="MONTHNAME" text="MONTHNAME('2008-02-03')" start-index="7" stop-index="29">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="17" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multilinestring">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" start-index="7" stop-index="73">
+ <parameter>
+ <literal-expression value="MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))" start-index="23" stop-index="72" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multipoint">
+ <projections start-index="7" stop-index="56">
+ <expression-projection start-index="7" stop-index="56" text="ST_GeomFromText('MultiPoint((1 2), (3 4), (5 6))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiPoint((1 2), (3 4), (5 6))')" start-index="7" stop-index="56">
+ <parameter>
+ <literal-expression value="MultiPoint((1 2), (3 4), (5 6))" start-index="23" stop-index="55" />
Review Comment:
Should MultiPoint also be parsed as a function?
##########
test/it/parser/src/main/resources/case/dml/select-special-function.xml:
##########
@@ -3020,4 +3020,168 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_md5">
+ <projections start-index="7" stop-index="20">
+ <expression-projection start-index="7" stop-index="20" text="MD5('testing')">
+ <expr>
+ <function function-name="MD5" text="MD5('testing')" start-index="7" stop-index="20">
+ <parameter>
+ <literal-expression value="testing" start-index="11" stop-index="19" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_member_of">
+ <projections start-index="7" stop-index="49">
+ <expression-projection start-index="7" stop-index="49" text="'ab' MEMBER OF('[23, "abc", 17, "ab", 10]')">
+ <expr>
+ <binary-operation-expression start-index="7" stop-index="49">
+ <left>
+ <literal-expression value="ab" start-index="7" stop-index="10" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text="'[23, "abc", 17, "ab", 10]'" start-index="22" stop-index="48" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_microsecond">
+ <projections start-index="7" stop-index="36">
+ <expression-projection start-index="7" stop-index="36" text="MICROSECOND('12:00:00.123456')">
+ <expr>
+ <function function-name="MICROSECOND" text="MICROSECOND('12:00:00.123456')" start-index="7" stop-index="36">
+ <parameter>
+ <literal-expression value="12:00:00.123456" start-index="19" stop-index="35" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mid">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MID('foobarbar' from 4)" start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MID" start-index="7" stop-index="29" text="MID('foobarbar' from 4)" >
+ <parameter>
+ <literal-expression value="foobarbar" start-index="11" stop-index="21" />
+ </parameter>
+ <parameter>
+ <literal-expression value="4" start-index="28" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_minute">
+ <projections start-index="7" stop-index="35">
+ <expression-projection start-index="7" stop-index="35" text="MINUTE('2008-02-03 10:05:03')">
+ <expr>
+ <function function-name="MINUTE" text="MINUTE('2008-02-03 10:05:03')" start-index="7" stop-index="35">
+ <parameter>
+ <literal-expression value="2008-02-03 10:05:03" start-index="14" stop-index="34" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mod">
+ <projections start-index="7" stop-index="18">
+ <expression-projection start-index="7" stop-index="18" text="MOD(234, 10)">
+ <expr>
+ <function function-name="MOD" text="MOD(234, 10)" start-index="7" stop-index="18">
+ <parameter>
+ <literal-expression value="234" start-index="11" stop-index="13" />
+ </parameter>
+ <parameter>
+ <literal-expression value="10" start-index="16" stop-index="17" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_month">
+ <projections start-index="7" stop-index="25">
+ <expression-projection start-index="7" stop-index="25" text="MONTH('2008-02-03')">
+ <expr>
+ <function function-name="MONTH" text="MONTH('2008-02-03')" start-index="7" stop-index="25">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="13" stop-index="24" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_monthname">
+ <projections start-index="7" stop-index="29">
+ <expression-projection start-index="7" stop-index="29" text="MONTHNAME('2008-02-03')">
+ <expr>
+ <function function-name="MONTHNAME" text="MONTHNAME('2008-02-03')" start-index="7" stop-index="29">
+ <parameter>
+ <literal-expression value="2008-02-03" start-index="17" stop-index="28" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multilinestring">
+ <projections start-index="7" stop-index="73">
+ <expression-projection start-index="7" stop-index="73" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))')" start-index="7" stop-index="73">
+ <parameter>
+ <literal-expression value="MultiLineString((0 0, 1 1, 2 2),(3 3, 4 4, 5 5))" start-index="23" stop-index="72" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multipoint">
+ <projections start-index="7" stop-index="56">
+ <expression-projection start-index="7" stop-index="56" text="ST_GeomFromText('MultiPoint((1 2), (3 4), (5 6))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiPoint((1 2), (3 4), (5 6))')" start-index="7" stop-index="56">
+ <parameter>
+ <literal-expression value="MultiPoint((1 2), (3 4), (5 6))" start-index="23" stop-index="55" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_multipolygon">
+ <projections start-index="7" stop-index="94">
+ <expression-projection start-index="7" stop-index="94" text="ST_GeomFromText('MultiPolygon(((0 0, 1 0, 1 1, 0 1, 0 0)),((2 2, 3 2, 3 3, 2 3, 2 2)))')">
+ <expr>
+ <function function-name="ST_GeomFromText" text="ST_GeomFromText('MultiPolygon(((0 0, 1 0, 1 1, 0 1, 0 0)),((2 2, 3 2, 3 3, 2 3, 2 2)))')" start-index="7" stop-index="94">
+ <parameter>
+ <literal-expression value="MultiPolygon(((0 0, 1 0, 1 1, 0 1, 0 0)),((2 2, 3 2, 3 3, 2 3, 2 2)))" start-index="23" stop-index="93" />
Review Comment:
Should MultiPolygon also be parsed as a function?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org