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



##########
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:
       @tsreaper the fix here just ignore WithItemNamespace. If the ns is not 
WithItemNamespace, and ns.getTable is null(it may be possible according to your 
former comment), the validator will still throw NPE exception. 
   I think it may be enough to  just ignore when getTable is null(this is  how 
the validator treat ns.getTable in other method), or it is better to throw a 
more helpful exception instead of NPE.




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