-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14023][CORE][SQL] Don't reference 'field' in StructField errors for clarity in exceptions #23373
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
Conversation
|
Is it related to |
| throw new IllegalArgumentException( | ||
| s"""Nonexistent field(s): ${nonExistFields.mkString(", ")}. | ||
| |Available fields: ${fieldNames.mkString(", ")}""".stripMargin) | ||
| s"""${nonExistFields.mkString(", ")} do not exist. |
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.
nonExistFields can contain only one element, right? Maybe do/does?
|
Test build #100401 has finished for PR 23373 at commit
|
|
I think the issue is that these exceptions could pop up in several places, including anywhere you'd use a dataframe with columns. It probably applies to lots of places. I can change the tag here but won't matter for anything really |
|
Test build #100404 has finished for PR 23373 at commit
|
| s"""Field "$name" does not exist. | ||
| |Available fields: ${fieldNames.mkString(", ")}""".stripMargin)) | ||
| s""""$name" does not exist. | ||
| |Available: ${fieldNames.mkString("\"", "\", \"", "\"")}""".stripMargin)) |
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.
Can we keep the original form instead of adding additional " here?
scala> val s = org.apache.spark.sql.types.StructType.fromDDL("`\"` INT")
s: org.apache.spark.sql.types.StructType = StructType(StructField(",IntegerType,true))
scala> s("a")
java.lang.IllegalArgumentException: "a" does not exist.
Available: """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.
Sure, I'll remove quotes around all versions of this exception.
|
Mostly looks good except the additional cc @cloud-fan , @gatorsmile |
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.
+1, LGTM (Pending Jenkins). Thanks!
|
Test build #100413 has finished for PR 23373 at commit
|
|
Merged to master. |
…s for clarity in exceptions ## What changes were proposed in this pull request? Variation of apache#20500 I cheated by not referencing fields or columns at all as this exception propagates in contexts where both would be applicable. ## How was this patch tested? Existing tests Closes apache#23373 from srowen/SPARK-14023.2. Authored-by: Sean Owen <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…s for clarity in exceptions ## What changes were proposed in this pull request? Variation of apache#20500 I cheated by not referencing fields or columns at all as this exception propagates in contexts where both would be applicable. ## How was this patch tested? Existing tests Closes apache#23373 from srowen/SPARK-14023.2. Authored-by: Sean Owen <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
Variation of #20500
I cheated by not referencing fields or columns at all as this exception propagates in contexts where both would be applicable.
How was this patch tested?
Existing tests