Skip to content

Commit

Permalink
Remove no longer necessary quoting check for TVFs and procedures. Closes
Browse files Browse the repository at this point in the history
 #79.
  • Loading branch information
Pablo Paglilla committed Jul 23, 2024
1 parent b449bde commit cb57af1
Showing 1 changed file with 0 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ public AnalyzedStatement next() {
this.validateSingleAssignment((ASTSingleAssignment) parsedStatement);
}

this.validateProcedureAndTVFReferences(parsedStatement);

if (this.reachedComplexScriptStatement || this.isScriptStatement(parsedStatement)) {
return new AnalyzedStatement(parsedStatement, Optional.empty());
}
Expand Down Expand Up @@ -326,51 +324,5 @@ private void applyCatalogMutation(ResolvedStatement statement) {
statement.accept(catalogUpdaterVisitor);
}

private void validateProcedureAndTVFReferences(ASTStatement parsedStatement) {
parsedStatement.accept(
new ParseTreeVisitor() {

public void visit(ASTCallStatement callStatement) {
List<String> procedureNames =
callStatement.getProcedureName().getNames().stream()
.map(ASTIdentifier::getIdString)
.collect(Collectors.toList());

if (procedureNames.size() > 1) {
String foundProcedureName =
procedureNames.stream()
.map(name -> "`" + name + "`")
.collect(Collectors.joining("."));
String expectedProcedureName = "`" + String.join(".", procedureNames) + "`";

String message =
String.format(
"Procedures in CALL statements should be fully quoted. Expected %s, found %s.",
expectedProcedureName, foundProcedureName);
throw new AnalysisException(message);
}
}

public void visit(ASTTVF astTvf) {
List<String> tvfNames =
astTvf.getName().getNames().stream()
.map(ASTIdentifier::getIdString)
.collect(Collectors.toList());
if (tvfNames.size() > 1) {
String foundTvfName =
tvfNames.stream()
.map(name -> "`" + name + "`")
.collect(Collectors.joining("."));
String expectedTvfName = "`" + String.join(".", tvfNames) + "`";

String message =
String.format(
"TVF calls should be fully quoted. Expected %s, found %s.",
expectedTvfName, foundTvfName);
throw new AnalysisException(message);
}
}
});
}
}
}

0 comments on commit cb57af1

Please sign in to comment.