herunkang2018 commented on code in PR #3201:
URL: https://github.com/apache/calcite/pull/3201#discussion_r1195779642


##########
core/src/main/java/org/apache/calcite/sql/validate/IdentifierNamespace.java:
##########
@@ -258,6 +258,9 @@ public SqlIdentifier getId() {
   }
 
   @Override public @Nullable SqlValidatorTable getTable() {
+    if (resolvedNamespace == null) {
+      validator.validateNamespace(this, validator.unknownType);
+    }
     return resolvedNamespace == null ? null : resolve().getTable();

Review Comment:
   The reason why test cases failed in `SqlAdvisorTest` is that, there is table 
not found in catalog, so `resolvedNamespace` is still null, for example:
   > select a.empno, b.deptno from ^dummy a, sales.dummy b
   
   The table `dummy` is not found in catalog, so when validate 
`IdentifierNamespace` of `dummy`, it throws validation error in 
`IdentifierNamespace.resolveImpl`, but outter 
`SqlAdvisorValidator.validateWhereClause` catches it and **ignores** it, note 
that this is different from the behaviour of `SqlValidatorImpl`, which is just 
throws exception here. So in this case, the program continues executing and 
`resolvedNamespace` is still null. 



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