tsreaper commented on a change in pull request #17845:
URL: https://github.com/apache/flink/pull/17845#discussion_r769216817



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
##########
@@ -4711,6 +4711,11 @@ private void validateSnapshot(SqlNode node, 
SqlValidatorScope scope, SqlValidato
                         Static.RESOURCE.illegalExpressionForTemporal(
                                 dataType.getSqlTypeName().getName()));
             }
+            if (ns instanceof IdentifierNamespace && ns.resolve() instanceof 
WithItemNamespace) {
+                // If the snapshot is used over a CTE, then we don't have a 
concrete underlying
+                // table to operate on. This will be rechecked later in the 
planner rules.
+                return;

Review comment:
       I understand. If with this fix we still meet a case where `getTable()` 
is null then this is unexpected and we should take another look. So we should 
add a `Preconditions.notNull()` here with a message asking users to create a 
ticket.




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