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


##########
core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java:
##########
@@ -135,6 +135,14 @@ class JdbcAdapterTest {
             + "WHERE \"product_id\" = 1");
   }
 
+  @Test void testFilterUnionIncludingWithPlan() {

Review Comment:
   I do no see any `filter` in the query, maybe we should rename the method 
name?



##########
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) {

Review Comment:
   remove one space



##########
core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java:
##########
@@ -135,6 +135,14 @@ class JdbcAdapterTest {
             + "WHERE \"product_id\" = 1");
   }
 
+  @Test void testFilterUnionIncludingWithPlan() {
+    CalciteAssert.model(FoodmartSchema.FOODMART_MODEL)
+        .query("  ( with a as (select * from \"sales_fact_1997\")  select * 
from a)\n"

Review Comment:
   It is better to re-beautify the format, e.g. remove inappropriate spaces



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