godfreyhe commented on a change in pull request #17845:
URL: https://github.com/apache/flink/pull/17845#discussion_r770345473
##########
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:
@wenlong88 and @tsreaper Currently, The table will not be null, because
the namespace for snapshot will always be IdentifierNamespace (snapshot must be
with a table name, view name or the CTE name).`ns.resolve()` will check
`whether resolvedNamespace is null`. But I'm also fine with we add `notNull`
check to protect the future change. cc @YuvalItzchakov
--
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]