You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "sohardforaname (via GitHub)" <gi...@apache.org> on 2023/03/23 09:56:10 UTC
[GitHub] [doris] sohardforaname opened a new pull request, #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
sohardforaname opened a new pull request, #18062:
URL: https://github.com/apache/doris/pull/18062
# Proposed changes
Issue Number: close #xxx
## Problem summary
sql like:
(SELECT K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, K11 FROM test WHERE K1>0) UNION ALL (SELECT 1, 2, 3, 4, 3.14, 'HELLO', 'WORLD', 0.0, 1.1, CAST('1989-03-21' AS DATE), CAST('1989-03-21 13:00:00' AS DATETIME)) UNION ALL (SELECT K1, K2, K3, K4, K5, K6, K7, K8, K9, K10, K11 FROM baseall WHERE K3>0) ORDER BY K1, K2, K3, K4
cannot be parsed by nereids, we fix it.
## Checklist(Required)
* [ ] Does it affect the original behavior
* [ ] Has unit tests been added
* [ ] Has document been added or modified
* [ ] Does it need to update dependencies
* [ ] Is this PR support rollback (If NO, please explain WHY)
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1489656493
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] englefly commented on a diff in pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "englefly (via GitHub)" <gi...@apache.org>.
englefly commented on code in PR #18062:
URL: https://github.com/apache/doris/pull/18062#discussion_r1151848699
##########
regression-test/suites/nereids_p0/join/test_join.groovy:
##########
@@ -398,12 +398,12 @@ suite("test_join", "nereids_p0") {
sql"""select ${s} from ${tbName1} a left outer join ${tbName2} b on a.k1 = b.k1
left outer join ${tbName3} c on a.k2 = c.k2 order by 1, 2, 3, 4, 5 limit 65535"""
}
- sql"""select a.k1 k1, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a full outer join ${tbName2} b
- on a.k1 = b.k1 and a.k2 > b.k2 order by isnull(k1), 1, 2, 3, 4, 5 limit 65535"""
- sql"""select a.k1 k1, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a left outer join ${tbName2} b
+ sql"""select a.k1 k, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a full outer join ${tbName2} b
+ on a.k1 = b.k1 and a.k2 > b.k2 order by isnull(k), 1, 2, 3, 4, 5 limit 65535"""
+ sql"""select a.k1 k, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a left outer join ${tbName2} b
on a.k1 = b.k1 and a.k2 > b.k2 union (select a.k1, a.k2, a.k3, b.k1, b.k2, b.k3
from ${tbName1} a right outer join ${tbName2} b on a.k1 = b.k1 and a.k2 > b.k2)
- order by isnull(k1), 1, 2, 3, 4, 5 limit 65535"""
+ order by isnull(k), 1, 2, 3, 4, 5 limit 65535"""
Review Comment:
why change this case? The test purpose of using k or k1 are different.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1489645332
PR approved by at least one committer and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1489645355
PR approved by anyone and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on a diff in pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on code in PR #18062:
URL: https://github.com/apache/doris/pull/18062#discussion_r1151876998
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSetOperation.java:
##########
@@ -114,12 +114,13 @@ public List<NamedExpression> buildNewOutputs(List<Expression> leftCastExpression
ImmutableList.Builder<NamedExpression> newOutputs = new Builder<>();
for (Expression expression : leftCastExpressions) {
if (expression instanceof Cast) {
+ Cast cast = ((Cast) expression);
newOutputs.add(new SlotReference(
- ((Cast) expression).child().toSql(), expression.getDataType(),
- ((Cast) expression).child().nullable()));
+ cast.child().toSql(), expression.getDataType(),
+ cast.child().nullable()));
} else if (expression instanceof Slot) {
- newOutputs.add(new SlotReference(
- expression.toSql(), expression.getDataType(), expression.nullable()));
+ Slot slot = ((Slot) expression);
Review Comment:
no
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1491457505
PR approved by at least one committer and no changes requested.
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morrySnow commented on a diff in pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #18062:
URL: https://github.com/apache/doris/pull/18062#discussion_r1149206219
##########
regression-test/suites/nereids_p0/join/test_join.groovy:
##########
@@ -398,12 +398,12 @@ suite("test_join", "nereids_p0") {
sql"""select ${s} from ${tbName1} a left outer join ${tbName2} b on a.k1 = b.k1
left outer join ${tbName3} c on a.k2 = c.k2 order by 1, 2, 3, 4, 5 limit 65535"""
}
- sql"""select a.k1 k1, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a full outer join ${tbName2} b
- on a.k1 = b.k1 and a.k2 > b.k2 order by isnull(k1), 1, 2, 3, 4, 5 limit 65535"""
- sql"""select a.k1 k1, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a left outer join ${tbName2} b
+ sql"""select a.k1 k, a.k2, a.k3, b.k1, b.k2, b.k3 from ${tbName1} a full outer join ${tbName2} b
+ on a.k1 = b.k1 and a.k2 > b.k2 order by isnull(k), 1, 2, 3, 4, 5 limit 65535"""
Review Comment:
should not change regression test
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] englefly commented on a diff in pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "englefly (via GitHub)" <gi...@apache.org>.
englefly commented on code in PR #18062:
URL: https://github.com/apache/doris/pull/18062#discussion_r1151838376
##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -56,15 +56,17 @@ planType
;
// -----------------Query-----------------
+// add queryOrganization for parse (q1) union (q2) union (q3) order by keys, otherwise 'order' will be recognized to be
+// identifier.
query
: {!doris_legacy_SQL_syntax}? cte? queryTerm queryOrganization
- | {doris_legacy_SQL_syntax}? queryTerm
+ | {doris_legacy_SQL_syntax}? queryTerm queryOrganization
;
queryTerm
: queryPrimary #queryTermDefault
| left=queryTerm operator=(UNION | EXCEPT | INTERSECT)
- setQuantifier? right=queryTerm #setOperation
+ setQuantifier? right=queryTerm #setOperation
Review Comment:
it seems that in the edit version the comments are not aligned
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalSetOperation.java:
##########
@@ -114,12 +114,13 @@ public List<NamedExpression> buildNewOutputs(List<Expression> leftCastExpression
ImmutableList.Builder<NamedExpression> newOutputs = new Builder<>();
for (Expression expression : leftCastExpressions) {
if (expression instanceof Cast) {
+ Cast cast = ((Cast) expression);
newOutputs.add(new SlotReference(
- ((Cast) expression).child().toSql(), expression.getDataType(),
- ((Cast) expression).child().nullable()));
+ cast.child().toSql(), expression.getDataType(),
+ cast.child().nullable()));
} else if (expression instanceof Slot) {
- newOutputs.add(new SlotReference(
- expression.toSql(), expression.getDataType(), expression.nullable()));
+ Slot slot = ((Slot) expression);
Review Comment:
is there any diff?
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1488587583
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1484432394
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1486308823
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1487994175
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1482288630
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #18062:
URL: https://github.com/apache/doris/pull/18062#issuecomment-1485086367
run buildall
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morrySnow merged pull request #18062: [Fix](Nereids)fix nereids is failed to parse union with query covered parenthesis
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow merged PR #18062:
URL: https://github.com/apache/doris/pull/18062
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org