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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -4021,19 +4021,30 @@ private void validateModality(SqlNode query) {
       default:
         break;
       }
+    } else if (query.getKind() == SqlKind.WITH) {
+      SqlWith with = (SqlWith) query;
+      for (SqlNode item : with.withList) {
+        SqlNode operand = ((SqlWithItem) item).query;
+        validateModality(operand, modality);
+      }
+      validateModality(with.body, modality);
     } else {
       assert query.isA(SqlKind.SET_QUERY);
       final SqlCall call = (SqlCall) query;
       for (SqlNode operand : call.getOperandList()) {
-        if (deduceModality(operand) != modality) {
-          throw newValidationError(operand,
-              Static.RESOURCE.streamSetOpInconsistentInputs());
-        }
-        validateModality(operand);
+        validateModality(operand, modality);
       }
     }
   }
 
+  private  void validateModality(SqlNode operand, SqlModality modality) {
+    if (deduceModality(operand) != modality) {
+      throw newValidationError(operand,
+          Static.RESOURCE.streamSetOpInconsistentInputs());

Review Comment:
   I don't agree, you actually enlarged the scope of this code: it is only used 
for set query before, but now it also handles with query.



##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -4021,19 +4021,30 @@ private void validateModality(SqlNode query) {
       default:
         break;
       }
+    } else if (query.getKind() == SqlKind.WITH) {

Review Comment:
   It's a nice-to-have, not a must-have request, I'm ok 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to