lmhmhl commented on issue #8883: URL: https://github.com/apache/shardingsphere/issues/8883#issuecomment-756773053
Hi @tristaZero , thank u for your comment and patience, I have debugged the code and found that the error is caused in `org.apache.calcite.sql.validate.IdentifierNamespace` class, in method `resolveImpl `, there has a line of code as `SqlNameMatcher nameMatcher = this.validator.catalogReader.nameMatcher();` , the ` caseSensitive` variable in `nameMatcher` is `false`, so It will throw exception any the end of method as `throw this.validator.newValidationError(id, Static.RESOURCE.objectNotFound(id.getComponent(0).toString())); ` <img width="899" alt="Screen Shot 2021-01-08 at 9 53 21 PM" src="https://user-images.githubusercontent.com/24718258/104023969-5df75c80-51fd-11eb-84f8-d058d4109e4a.png"> ``` private SqlValidatorNamespace resolveImpl(SqlIdentifier id) { SqlNameMatcher nameMatcher = this.validator.catalogReader.nameMatcher(); ResolvedImpl resolved = new ResolvedImpl(); List names = SqlIdentifier.toStar(id.names); try { this.parentScope.resolveTable(names, nameMatcher, Path.EMPTY, resolved); } catch (CyclicDefinitionException var12) { if (var12.depth == 1) { throw this.validator.newValidationError(id, Static.RESOURCE.cyclicDefinition(id.toString(), SqlIdentifier.getString(var12.path))); } throw new CyclicDefinitionException(var12.depth - 1, var12.path); } Resolve previousResolve = null; if (resolved.count() == 1) { Resolve resolve = previousResolve = resolved.only(); if (resolve.remainingNames.isEmpty()) { return resolve.namespace; } if (!nameMatcher.isCaseSensitive()) { throw this.validator.newValidationError(id, Static.RESOURCE.objectNotFoundWithin((String)resolve.remainingNames.get(0), SqlIdentifier.getString(resolve.path.stepNames()))); } } if (nameMatcher.isCaseSensitive()) { SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); this.parentScope.resolveTable(names, liberalMatcher, Path.EMPTY, resolved); if (resolved.count() == 1) { Resolve resolve = resolved.only(); if (!resolve.remainingNames.isEmpty() && previousResolve != null) { throw this.validator.newValidationError(id, Static.RESOURCE.objectNotFoundWithin((String)resolve.remainingNames.get(0), SqlIdentifier.getString(resolve.path.stepNames()))); } int i = previousResolve == null ? 0 : previousResolve.path.stepCount(); int offset = resolve.path.stepCount() + resolve.remainingNames.size() - names.size(); List<String> prefix = resolve.path.stepNames().subList(0, offset + i); String next = (String)resolve.path.stepNames().get(i + offset); if (prefix.isEmpty()) { throw this.validator.newValidationError(id, Static.RESOURCE.objectNotFoundDidYouMean((String)names.get(i), next)); } throw this.validator.newValidationError(id, Static.RESOURCE.objectNotFoundWithinDidYouMean((String)names.get(i), SqlIdentifier.getString(prefix), next)); } } throw this.validator.newValidationError(id, Static.RESOURCE.objectNotFound(id.getComponent(0).toString())); } ``` The content of ExecutionContext of CalciteRowExecutor is as follows: <img width="1241" alt="Screen Shot 2021-01-08 at 8 32 01 PM" src="https://user-images.githubusercontent.com/24718258/104024196-b3cc0480-51fd-11eb-9f81-ea0b38a85f13.png"> ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
