NobiGo commented on code in PR #4158:
URL: https://github.com/apache/calcite/pull/4158#discussion_r1925210078


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -4431,6 +4431,24 @@ private void validateModality(SqlNode query) {
       default:
         break;
       }
+    } else if (query.getKind() == SqlKind.WITH) {
+      // The modality of With clause depends on its body
+      // For example:
+      // SQL:
+      //      WITH
+      //               STREMTABLE AS
+      //      SELECT
+      //                STREAM * FROM KAFKA.MOCKTABLE
+      //      SELET * FROM STREMTABLE
+      // The modality should be RELATION.
+      // SQL:
+      //      WITH
+      //               STREMTABLE AS
+      //      SELECT
+      //                STREAM * FROM KAFKA.MOCKTABLE
+      //      SELET STREAM * FROM STREMTABLE
+      // The modality should be STREAM.
+      validateModality(((SqlWith) query).body);

Review Comment:
   I came up with an execution plan based on SQL. The first SQL generated plan 
is a regular TableScan, and the second SQl generated plan is a Stream 
TableScan. So I think it is up to its body.



-- 
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