Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query parsing fails for queries with UNNEST #148

Open
sridivakar opened this issue Aug 24, 2023 · 0 comments
Open

Query parsing fails for queries with UNNEST #148

sridivakar opened this issue Aug 24, 2023 · 0 comments

Comments

@sridivakar
Copy link

sridivakar commented Aug 24, 2023

Tried to address this by adding UNNEST to reservable keywords, but it did not help.

import com.google.zetasql.LanguageOptions;
.
.

LanguageOptions languageOptions = new LanguageOptions();
.
.

languageOptions.enableReservableKeyword("UNNEST");

Here is the stacktrace, while parsing BQ sql with UNNEST :

[main] ERROR com.google.zetasql.toolkit.antipattern.parser.Main - Query parsing failed for query: SELECT * FROM `bq_antipattern.antipattern_output_table` , unnest(recommendation);
java.lang.NullPointerException: Cannot invoke "com.google.zetasql.parser.ASTNodes$ASTPathExpression.getNames()" because the return value of "com.google.zetasql.parser.ASTNodes$ASTTablePathExpression.getPathExpr()" is null
	at com.google.zetasql.toolkit.antipattern.parser.visitors.IdentifyCTEsEvalMultipleTimesVisitor.visit(IdentifyCTEsEvalMultipleTimesVisitor.java:94)
	at com.google.zetasql.parser.ASTNodes$ASTTablePathExpression.accept(ASTNodes.java:1450)
	at com.google.zetasql.parser.ParseTreeVisitor.descend(ParseTreeVisitor.java:45)
	at com.google.zetasql.parser.ASTNodes$ASTJoin.acceptChildren(ASTNodes.java:2651)
	at com.google.zetasql.parser.ParseTreeVisitor.defaultVisit(ParseTreeVisitor.java:36)
	at com.google.zetasql.parser.ParseTreeVisitor.visit(ParseTreeVisitor.java:162)
	at com.google.zetasql.parser.ASTNodes$ASTJoin.accept(ASTNodes.java:2642)
	at com.google.zetasql.parser.ParseTreeVisitor.descend(ParseTreeVisitor.java:45)
	at com.google.zetasql.parser.ASTNodes$ASTFromClause.acceptChildren(ASTNodes.java:1518)
	at com.google.zetasql.parser.ParseTreeVisitor.defaultVisit(ParseTreeVisitor.java:36)
	at com.google.zetasql.parser.ParseTreeVisitor.visit(ParseTreeVisitor.java:94)
	at com.google.zetasql.parser.ASTNodes$ASTFromClause.accept(ASTNodes.java:1512)
	at com.google.zetasql.parser.ParseTreeVisitor.descend(ParseTreeVisitor.java:45)
	at com.google.zetasql.parser.ASTNodes$ASTSelect.acceptChildren(ASTNodes.java:617)
	at com.google.zetasql.parser.ParseTreeVisitor.defaultVisit(ParseTreeVisitor.java:36)
	at com.google.zetasql.parser.ParseTreeVisitor.visit(ParseTreeVisitor.java:62)
	at com.google.zetasql.parser.ASTNodes$ASTSelect.accept(ASTNodes.java:607)
	at com.google.zetasql.parser.ParseTreeVisitor.descend(ParseTreeVisitor.java:45)
	at com.google.zetasql.parser.ASTNodes$ASTQuery.acceptChildren(ASTNodes.java:409)
	at com.google.zetasql.parser.ParseTreeVisitor.defaultVisit(ParseTreeVisitor.java:36)
	at com.google.zetasql.parser.ParseTreeVisitor.visit(ParseTreeVisitor.java:58)
	at com.google.zetasql.parser.ASTNodes$ASTQuery.accept(ASTNodes.java:402)
	at com.google.zetasql.parser.ParseTreeVisitor.descend(ParseTreeVisitor.java:45)
	at com.google.zetasql.parser.ASTNodes$ASTQueryStatement.acceptChildren(ASTNodes.java:224)
	at com.google.zetasql.parser.ParseTreeVisitor.defaultVisit(ParseTreeVisitor.java:36)
	at com.google.zetasql.parser.ParseTreeVisitor.visit(ParseTreeVisitor.java:54)
	at com.google.zetasql.parser.ASTNodes$ASTQueryStatement.accept(ASTNodes.java:218)
	at com.google.zetasql.toolkit.antipattern.parser.IdentifyCTEsEvalMultipleTimes.run(IdentifyCTEsEvalMultipleTimes.java:33)
	at com.google.zetasql.toolkit.antipattern.parser.Main$3.<init>(Main.java:152)
	at com.google.zetasql.toolkit.antipattern.parser.Main.getRecommendations(Main.java:150)
	at com.google.zetasql.toolkit.antipattern.parser.Main.main(Main.java:78)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant