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

Planning failure when lambda appears in select and group by clause #7140

Closed
martint opened this issue Jan 19, 2017 · 1 comment
Closed

Planning failure when lambda appears in select and group by clause #7140

martint opened this issue Jan 19, 2017 · 1 comment
Assignees
Labels

Comments

@martint
Copy link
Contributor

martint commented Jan 19, 2017

SELECT filter(v, x -> true)
FROM (VALUES null) t(v)
GROUP BY filter(v, x -> true)

fails with:

java.lang.IllegalArgumentException: Invalid node. Expression dependencies ([field]) not in source plan output ([filter, $hashvalue])
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker.checkDependencies(ValidateDependenciesChecker.java:645)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker.access$100(ValidateDependenciesChecker.java:80)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker$Visitor.visitProject(ValidateDependenciesChecker.java:260)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker$Visitor.visitProject(ValidateDependenciesChecker.java:94)
	at com.facebook.presto.sql.planner.plan.ProjectNode.accept(ProjectNode.java:92)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker$Visitor.visitOutput(ValidateDependenciesChecker.java:303)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker$Visitor.visitOutput(ValidateDependenciesChecker.java:94)
	at com.facebook.presto.sql.planner.plan.OutputNode.accept(OutputNode.java:82)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker.validate(ValidateDependenciesChecker.java:91)
	at com.facebook.presto.sql.planner.sanity.ValidateDependenciesChecker.validate(ValidateDependenciesChecker.java:86)
	at com.facebook.presto.sql.planner.sanity.PlanSanityChecker.lambda$validate$0(PlanSanityChecker.java:44)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at com.facebook.presto.sql.planner.sanity.PlanSanityChecker.validate(PlanSanityChecker.java:44)
	at com.facebook.presto.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:127)
	at com.facebook.presto.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:111)
	at com.facebook.presto.execution.SqlQueryExecution.doAnalyzeQuery(SqlQueryExecution.java:297)
	at com.facebook.presto.execution.SqlQueryExecution.analyzeQuery(SqlQueryExecution.java:276)
	at com.facebook.presto.execution.SqlQueryExecution.start(SqlQueryExecution.java:234)
	at com.facebook.presto.execution.QueuedExecution.lambda$start$1(QueuedExecution.java:63)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
@wenleix
Copy link
Contributor

wenleix commented Jun 25, 2017

The reason is the TranslationMap fails to recognize the lambda expression in https://github.com/prestodb/presto/blob/master/presto-main/src/main/java/com/facebook/presto/sql/planner/TranslationMap.java#L119, because the node is

"filter"(CAST("expr_2" AS array(unknown)), ("expr") -> true)

while the one in expressionToSymbol is

"filter"(CAST("expr_2" AS array(unknown)), ("expr_0") -> true)

There seems to be some inconsistent behavior in rewriting expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants