-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add deprecated function warning #2446
Conversation
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.
Thanks! This is a good start, but I have some comments about the approach.
...o-main/src/main/java/io/prestosql/sql/planner/sanity/warnings/DeprecatedFunctionWarning.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
...o-main/src/main/java/io/prestosql/sql/planner/sanity/warnings/DeprecatedFunctionWarning.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/io/prestosql/spi/connector/StandardWarningCode.java
Outdated
Show resolved
Hide resolved
Deprecated Function | ||
------------------- | ||
|
||
The ``@Deprecated`` annotation can be used to mark a function as deprecated |
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.
deprecated. It should
------------------- | ||
|
||
The ``@Deprecated`` annotation can be used to mark a function as deprecated | ||
and should no longer be used. Presto will generates a warning whenever a SQL |
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.
Presto generates
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.
and SQL statement
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.
and SQL statement
You mean a SQL statement
?
-The ``@Deprecated`` annotation can be used to mark a function as deprecated
-and should no longer be used. Presto will generates a warning whenever a SQL
+The ``@Deprecated`` annotation can be used to mark a function as deprecated.
+It should no longer be used. Presto generates a warning whenever a SQL statement
Thank you for that contribution. This is great. In terms of rolling this out to users it might make sense to do the following:
|
Also .. I review the doc based on request from @martint |
presto-tests/src/test/java/io/prestosql/execution/TestDeprecatedFunctionWarning.java
Outdated
Show resolved
Hide resolved
presto-tests/src/test/java/io/prestosql/execution/TestDeprecatedFunctionWarning.java
Outdated
Show resolved
Hide resolved
------------------- | ||
|
||
The ``@Deprecated`` annotation can be used to mark a function as deprecated. | ||
It should no longer be used. Presto generates a warning whenever a SQL statement |
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.
This is a little ambiguous. It's not clear whether it refers to the function or the annotation. Maybe rephrase as:
The
@Deprecated
annotation can be used to mark a function as deprecated and to indicate that it should no longer be used.
@mosabua, do you have any suggestions?
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.
haha.. that was my suggestion .. I thought it is clear as one sentence.
Maybe we use
The @Deprecated
annotation has to be used on any function that should no longer be used. The annotation causes Presto to generate a warning whenever...
presto-main/src/main/java/io/prestosql/SystemSessionProperties.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/operator/scalar/JsonFunctions.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/sql/analyzer/FeaturesConfig.java
Outdated
Show resolved
Hide resolved
presto-tests/src/test/java/io/prestosql/execution/TestUDFPluginDeprecatedUDFPlugin.java
Outdated
Show resolved
Hide resolved
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.
Looks good -- just one minor thing I missed before. Can you squash the commits? I'll merge it once you do that.
presto-testing/src/main/java/io/prestosql/testing/DistributedQueryRunner.java
Outdated
Show resolved
Hide resolved
Merged, thanks! |
Generate a warning when a query is using a
@Deprecated
function.This works for annotated
Scalar
,Parametric Scalar
,Aggregation
,Window
functions.Both built-in UDFs and UDFs from plugin are supported.
Doesn't work for classes that are directly implements
SqlFunction
without using annotation.This feature can be enabled by the feature flag
analyzer.query-diagnosis-warning-enabled
orenable_query_diagnosis_warning
session. Default is not enabled.I have two questions:
Supersedes #1006