-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add performance warning for MAP_FILTER #25772
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
Conversation
2a1e70c
to
5de645b
Compare
presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/ExpressionAnalyzer.java
Outdated
Show resolved
Hide resolved
4b18f30
to
d8e1fff
Compare
presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/ExpressionAnalyzer.java
Outdated
Show resolved
Hide resolved
presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/ExpressionAnalyzer.java
Outdated
Show resolved
Hide resolved
d8e1fff
to
5005482
Compare
5005482
to
745e16f
Compare
presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/ExpressionAnalyzer.java
Outdated
Show resolved
Hide resolved
745e16f
to
d318cda
Compare
arguments.stream() | ||
.skip(1).filter(arg -> { | ||
String base = arg.getBase(); | ||
return "function".equals(base) || "lambda".equals(base); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"function".equals(base)
Do we have this use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
if (!argumentTypes.isEmpty() && "map".equals(arguments.get(0).getBase())) { | ||
arguments.stream() | ||
.skip(1).filter(arg -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be a problem if there is only one argument?
String base = arg.getBase(); | ||
return "function".equals(base) || "lambda".equals(base); | ||
}).findFirst().ifPresent(arg -> { | ||
String warningMessage = createWarningMessage(node, "Lambdas on large maps are expensive, consider using map_subset"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to also print out the specific function which triggers this warning?
e27fa6f
to
c038d9a
Compare
c038d9a
to
abe607f
Compare
Saved that user @abhinavmuk04 is from Meta |
Description
Add performance warning for MAP_FILTER
Motivation and Context
Partly due to the lack of builtins and partly due to not being familiar, users use lambdas on training tables. We should add a performance warning in the presto analyzer things like MAP_FILTER.
Impact
This will help improve user understanding, as well as prevent issues with performance
Test Plan
Units tests, looking for warnings. Amended tests ensuring new behavior is updated. Removed one obsolete test case
Contributor checklist