libenchao commented on code in PR #2938:
URL: https://github.com/apache/calcite/pull/2938#discussion_r1002626396


##########
core/src/main/java/org/apache/calcite/sql/pretty/SqlPrettyWriter.java:
##########
@@ -398,10 +398,14 @@ public void setWindowDeclListNewline(boolean 
windowDeclListNewline) {
     return (frame == null)
         || (frame.frameType == FrameTypeEnum.SELECT)
         || (frame.frameType == FrameTypeEnum.ORDER_BY)
-        || (frame.frameType == FrameTypeEnum.WITH)
+        || (frame.frameType == FrameTypeEnum.WITH_BODY)

Review Comment:
   I'm not sure about this, as I said above, I'm confused about `inQuery` now, 
could you explain your understanding of this method?  



##########
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:
   > IMHO, SET_QUERY should not be a EXPRESSION.
   
   Then you can add `SET_QUERY` to `SqlKind.EXPRESSION`, and you do not need to 
add this condition `!writer.inWithBody()` here anymore.



-- 
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-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to