-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-41409][CORE][SQL] Rename _LEGACY_ERROR_TEMP_1043 to WRONG_NUM_ARGS.WITHOUT_SUGGESTION
#38940
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
Changes from 7 commits
a131087
a8f8246
e8b70cd
f3534c8
4984065
381b886
53abc82
fe811b8
0cfc968
4a19124
fbc7809
a6302e6
57bf670
9967415
e13a7e0
e258ce7
1cacfc1
2a8dd0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -649,10 +649,10 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase { | |
|
|
||
| def invalidFunctionArgumentNumberError( | ||
| validParametersCount: Seq[Int], name: String, actualNumber: Int): Throwable = { | ||
| if (validParametersCount.length == 0) { | ||
| if (validParametersCount.isEmpty) { | ||
| new AnalysisException( | ||
| errorClass = "_LEGACY_ERROR_TEMP_1043", | ||
| messageParameters = Map("name" -> name)) | ||
| errorClass = "INVALID_FUNCTION_ARGS", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MaxGekk This should be an internal exception?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may be triggered by the user action, such as |
||
| messageParameters = Map("name" -> toSQLId(name))) | ||
| } else { | ||
| val expectedNumberOfParameters = if (validParametersCount.length == 1) { | ||
| validParametersCount.head.toString | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -638,10 +638,16 @@ class UDFSuite extends QueryTest with SharedSparkSession { | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| test("SPARK-28521 error message for CAST(parameter types contains DataType)") { | ||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move this test to |
||||||||||||||||||||||||||
| val e = intercept[AnalysisException] { | ||||||||||||||||||||||||||
| spark.sql("SELECT CAST(1)") | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| assert(e.getMessage.contains("Invalid arguments for function cast")) | ||||||||||||||||||||||||||
| checkError( | ||||||||||||||||||||||||||
| exception = intercept[AnalysisException] { | ||||||||||||||||||||||||||
| sql("SELECT CAST(1)") | ||||||||||||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala Lines 137 to 144 in 37453ad
In this scenario, the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have any suggestions on the calculation way of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code above is not correct actually in some cases. One more example is Lines 3156 to 3159 in a3a755d
|
||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| errorClass = "INVALID_FUNCTION_ARGS", | ||||||||||||||||||||||||||
| parameters = Map( | ||||||||||||||||||||||||||
| "name" -> "`cast`" | ||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||
| context = ExpectedContext("", "", 7, 13, "CAST(1)") | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| test("only one case class parameter") { | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.
How about to introduce sub-classes of
WRONG_NUM_ARGS:And declare in the common message template that