l4wei commented on code in PR #2938:
URL: https://github.com/apache/calcite/pull/2938#discussion_r996599562
##########
core/src/main/java/org/apache/calcite/sql/SqlCall.java:
##########
@@ -118,7 +118,7 @@ public int operandCount() {
final SqlDialect dialect = writer.getDialect();
if (leftPrec > operator.getLeftPrec()
|| (operator.getRightPrec() <= rightPrec && (rightPrec != 0))
- || writer.isAlwaysUseParentheses() && isA(SqlKind.EXPRESSION)) {
+ || writer.isAlwaysUseParentheses() && isA(SqlKind.EXPRESSION) &&
!writer.inWithBody()) {
Review Comment:
Yes, it's very strange that `SqlKind.EXPRESSION` contains UNION, and
according to declaration of `SqlKind.EXPRESSION`, it should contains
`SELECT/ORDER_BY/WITH/JOIN` etc, and not contains `UNION`, but when i debug,
something is different, you can not find `SELECT/ORDER_BY/WITH/JOIN` in
`SqlKind.EXPRESSION`, and `UNION` will appear. Let's back to the topic, might
putting `inWithBody()` into `SqlWriter#isAlwaysUseParentheses ` will be better?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]