-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-41109][SQL] Rename the error class _LEGACY_ERROR_TEMP_1216 to INVALID_LIKE_PATTERN #38615
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
[SPARK-41109][SQL] Rename the error class _LEGACY_ERROR_TEMP_1216 to INVALID_LIKE_PATTERN #38615
Conversation
…INVALID_LIKE_PATTERN
…INVALID_LIKE_PATTERN
| }, | ||
| "INVALID_LIKE_PATTERN" : { | ||
| "message" : [ | ||
| "The pattern '<pattern>' is invalid, <message>." |
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.
It would be nice to avoid the message but it is useful in this case. @cloud-fan @srielau WDYT?
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 always the same message? If so we could map it.
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.
Actually, the message comes from Spark's code, see:
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
Line 50 in 70ec696
| def fail(message: String) = throw QueryCompilationErrors.invalidPatternError(pattern, message) |
and there are just 2 messages:
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
Line 59 in 70ec696
case _ => fail(s"the escape character is not allowed to precede '$c'") spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/StringUtils.scala
Line 61 in 70ec696
case c if c == escapeChar => fail("it is not allowed to end with the escape character")
@panbingkun Could you place the messages to the JSON files instead of leaving them in the source code, please.
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.
Done
srielau
left a comment
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.
A comment on mapping the message.
| }, | ||
| "INVALID_LIKE_PATTERN" : { | ||
| "message" : [ | ||
| "The pattern '<pattern>' is invalid, <message>." |
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 always the same message? If so we could map it.
|
Can one of the admins verify this patch? |
…INVALID_LIKE_PATTERN
|
+1, LGTM. Merging to master. |
|
Hi, @MaxGekk . It seems that this PR didn't passed CI properly. Could you check once more? |
|
I made a PR. |
|
|
||
| import org.apache.spark.{AccumulatorSuite, SparkException} | ||
| import org.apache.spark.scheduler.{SparkListener, SparkListenerJobStart} | ||
| import org.apache.spark.sql.catalyst.expressions.Cast._ |
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 addition was the root cause of Scala style check failure.
| "The pattern <pattern> is invalid." | ||
| ], | ||
| "subClass" : { | ||
| "ESC_IN_THE_MIDDLE" : { |
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.
sub class order is wrong, should be ESC_AT_THE_END then ESC_IN_THE_MIDDLE
#38658 for fix this
…INVALID_LIKE_PATTERN ### What changes were proposed in this pull request? In the PR, I propose to rename the legacy error class _LEGACY_ERROR_TEMP_1216 to INVALID_LIKE_PATTERN. ### Why are the changes needed? Proper names of error classes should improve user experience with Spark SQL. ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? By running the affected test suites: > $ build/sbt "sql/testOnly *SQLQuerySuite" > $ PYSPARK_PYTHON=python3 build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite -- -z strings.sql" Closes apache#38615 from panbingkun/error_classes_invalid_like_pattern. Authored-by: panbingkun <pbk1982@gmail.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
In the PR, I propose to rename the legacy error class _LEGACY_ERROR_TEMP_1216 to INVALID_LIKE_PATTERN.
Why are the changes needed?
Proper names of error classes should improve user experience with Spark SQL.
Does this PR introduce any user-facing change?
Yes.
How was this patch tested?
By running the affected test suites: