Skip to content

Conversation

@lvshaokang
Copy link
Contributor

What changes were proposed in this pull request?

Migrate the following errors in QueryCompilationErrors:

  • invalidFunctionArgumentsError
  • invalidFunctionArgumentNumberError
  • functionAcceptsOnlyOneArgumentError
  • secondArgumentNotDoubleLiteralError
  • functionCannotProcessInputError
  • v2FunctionInvalidInputTypeLengthError
  • secondArgumentInFunctionIsNotBooleanLiteralError

Why are the changes needed?

To follow the error class framework and improve test coverage.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

build/sbt "test:testOnly *QueryCompilationErrorsSuite"

@LuciferYang
Copy link
Contributor

cc @MaxGekk

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

# Conflicts:
#	sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
"sqlState" : "22023"
},
"INVALID_FUNCTION_ARGUMENTS" : {
"message" : [ "Invalid <invalidType> of arguments for function <functionName>. <message>" ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use sub-classes here, see an example in #36307

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaxGekk Thanks. I will be use sub-classes to correct it later.

@MaxGekk
Copy link
Member

MaxGekk commented May 1, 2022

@lvshaokang Could you resolve conflicts, please.

lvshaokang added 5 commits May 1, 2022 23:01
# Conflicts:
#	sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
# Conflicts:
#	core/src/main/resources/error/error-classes.json
#	sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
@lvshaokang
Copy link
Contributor Author

@MaxGekk PTAL.I have resolved conflicts,thanks.

"sqlState" : "22023"
},
"INVALID_FUNCTION_ARGUMENTS" : {
"message" : [ "The function arguments invalid: " ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I can see, every sub-class repeats function name. I would propose to add the function name to the base class, like:

  "message" : [ "Arguments of the <funcName> function are invalid: " ],

"message" : [ "The fraction of sec must be zero. Valid range is [0, 60]. If necessary set <config> to false to bypass this error. " ],
"sqlState" : "22023"
},
"INVALID_FUNCTION_ARGUMENTS" : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use the existing error class INVALID_PARAMETER_VALUE?

# Conflicts:
#	core/src/main/resources/error/error-classes.json
#	sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala
#	sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/aggregate/FirstLastTestSuite.scala
#	sql/core/src/test/resources/sql-tests/results/udaf.sql.out
#	sql/core/src/test/resources/sql-tests/results/udf/udf-udaf.sql.out
#	sql/core/src/test/scala/org/apache/spark/sql/errors/QueryCompilationErrorsSuite.scala
#	sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala
@lvshaokang
Copy link
Contributor Author

@MaxGekk Sry.I recently had time to complete this issue.Please take a look this pr.I unifyed the error class message and moved the INVALID_PARAMETER_VALUE to INVALID_FUNCTION_ARGUMENTS , because of i think parameter value belong to funcation arguments scope.

# Conflicts:
#	sql/core/src/test/resources/sql-tests/results/postgreSQL/text.sql.out
#	sql/core/src/test/resources/sql-tests/results/regexp-functions.sql.out
@github-actions
Copy link

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Nov 28, 2022
@github-actions github-actions bot closed this Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants