[SPARK-37013][CORE][SQL][FOLLOWUP] Use the new error framework to throw error in FormatString #34454
[SPARK-37013][CORE][SQL][FOLLOWUP] Use the new error framework to throw error in FormatString #34454LuciferYang wants to merge 3 commits intoapache:masterfrom
FormatString #34454Conversation
cc @cloud-fan , follow your advice in #34313 |
| @@ -1685,7 +1685,7 @@ case class ParseUrl(children: Seq[Expression], failOnError: Boolean = SQLConf.ge | |||
| case class FormatString(children: Expression*) extends Expression with ImplicitCastInputTypes { | |||
|
|
|||
| require(children.nonEmpty, s"$prettyName() should take at least 1 argument") | |||
There was a problem hiding this comment.
@cloud-fan this pr only change the newly added code, If also need to change line 1687, please let me know.
| "IF_PARTITION_NOT_EXISTS_UNSUPPORTED" : { | ||
| "message" : [ "Cannot write, IF NOT EXISTS is not supported for table: %s" ] | ||
| }, | ||
| "ILLEGAL_FORMAT_ARGUMENT_INDEX" : { |
There was a problem hiding this comment.
Shall we have a unified error class for illegal format string? cc @karenfeng
There was a problem hiding this comment.
There are a couple different ways for a string to have an illegal format, right? I'm not sure how to unify them all, but we can definitely have a more generic class here to represent that a string cannot contain a given substring, eg:
"ILLEGAL_SUBSTRING" : {
"message" : [ "%s cannot contain %s." ]
}
There was a problem hiding this comment.
@cloud-fan, does this LGTY? I don't have any more concerns.
FormatString FormatString
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #144803 has finished for PR 34454 at commit
|
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM.
Gentle ping @karenfeng once more for @cloud-fan 's comment, https://github.com/apache/spark/pull/34454/files#r740014071
|
|
|
@jerqi thanks~already update the pr description |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #145079 has finished for PR 34454 at commit
|
|
Anything else needs to be changed? |
|
Gentle ping @karenfeng once more |
|
Sorry I missed the ping. Merging to master, thanks! |
|
thanks all ~ |
…of forbidding %0$ usage in format_string ### What changes were proposed in this pull request? Adds a legacy flag `spark.sql.legacy.allowZeroIndexInFormatString` for the breaking change introduced in #34313 and #34454 (followup). The flag is disabled by default. But when it is enabled, restore the pre-change behavior that allows the 0 based index in `format_string`. ### Why are the changes needed? The original commit is a breaking change, and breaking changes should be encouraged to add a flag to turn it off for smooth migration between versions. ### Does this PR introduce _any_ user-facing change? With the default value of the conf, there is no user-facing difference. If users turn this conf on, they can restore the pre-change behavior. ### How was this patch tested? Through unit tests. Closes #36101 from anchovYu/flags-format-string-java. Authored-by: Xinyi Yu <xinyi.yu@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…of forbidding %0$ usage in format_string ### What changes were proposed in this pull request? Adds a legacy flag `spark.sql.legacy.allowZeroIndexInFormatString` for the breaking change introduced in #34313 and #34454 (followup). The flag is disabled by default. But when it is enabled, restore the pre-change behavior that allows the 0 based index in `format_string`. ### Why are the changes needed? The original commit is a breaking change, and breaking changes should be encouraged to add a flag to turn it off for smooth migration between versions. ### Does this PR introduce _any_ user-facing change? With the default value of the conf, there is no user-facing difference. If users turn this conf on, they can restore the pre-change behavior. ### How was this patch tested? Through unit tests. Closes #36101 from anchovYu/flags-format-string-java. Authored-by: Xinyi Yu <xinyi.yu@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit b7af2b3) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
What changes were proposed in this pull request?
This is a followup of #34313. The main change of this pr is change to use the new error framework to throw error when
pattern.contains("%0$")is true.Why are the changes needed?
Use the new error framework to throw error
Does this PR introduce any user-facing change?
No
How was this patch tested?
Pass the Jenkins or GitHub Action