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


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -4431,6 +4431,14 @@ private void validateModality(SqlNode query) {
       default:
         break;
       }
+    } else if (query.getKind() == SqlKind.WITH) {
+    // The modality of With clause depends on its body

Review Comment:
   SQL1 [With List is STREAM]:
   `WITH STREAMTABLE AS (SELECT STREAM * FROM KAFKA.MOCKTABLE) SELECT * FROM 
STREAMTABLE`
   The Plan is :
   `"PLAN=EnumerableTableScan(table=[[KAFKA, MOCKTABLE]])\n\n"`
   SQL2: [With Body is STREAM and With List is STREAM]:
   `WITH STREAMTABLE AS (SELECT STREAM * FROM KAFKA.MOCKTABLE) SELECT STREAM * 
FROM STREAMTABLE`
   The Plan is:
   ```
   EnumerableInterpreter
        BindableTableScan(table=[[KAFKA, MOCKTABLE, (STREAM)]])
   ```
   SQL3:[With Body is STREAM]
   `WITH STREAMTABLE AS (SELECT * FROM KAFKA.MOCKTABLE) SELECT STREAM * FROM 
STREAMTABLE`
   The Plan is:
   ```
   EnumerableInterpreter
        BindableTableScan(table=[[KAFKA, MOCKTABLE, (STREAM)]])
   ```
   These SQL  are tested in KafkaAdapterTest. According to this, we only check 
the Body is enough. WDYT?
   Maybe I can add these unit tests in KafkaAdapterTest.



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