Skip to content
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-41131][SQL] Improve error message for UNRESOLVED_MAP_KEY.WITHOUT_SUGGESTION #38646

Closed
wants to merge 7 commits into from

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Nov 14, 2022

What changes were proposed in this pull request?

This PR proposes to improve error message for UNRESOLVED_MAP_KEY.WITHOUT_SUGGESTION.

Why are the changes needed?

Printing the single quotes in error message as an example would more helpful for users, and we don't need 'please' in the error message. See https://spark.apache.org/error-message-guidelines.html more detail.

Does this PR introduce any user-facing change?

Minor error message improvement.

From

Cannot resolve column `col1` as a map key. If the key is a string literal, please add single quotes around it.

To

Cannot resolve column `col1` as a map key. If the key is a string literal, add single quotes '' around it.

How was this patch tested?

The existing CI should pass.

@github-actions github-actions bot added the CORE label Nov 14, 2022
@itholic
Copy link
Contributor Author

itholic commented Nov 14, 2022

cc @srielau @MaxGekk

@@ -1044,7 +1044,7 @@
},
"UNRESOLVED_MAP_KEY" : {
"message" : [
"Cannot resolve column <objectName> as a map key. If the key is a string literal, please add single quotes around it."
"Cannot resolve column <objectName> as a map key. If the key is a string literal, add single quotes around it: '<object_name>'."
Copy link
Member

Choose a reason for hiding this comment

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

  1. I don't see that we pass object_name. Maybe, objectName?
  2. We quite objectName by back ticks, and how it will looks like '`a`'?

Copy link
Contributor Author

@itholic itholic Nov 14, 2022

Choose a reason for hiding this comment

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

Oh... I see.

Just updated the PR description.

Maybe we can just remove the example in the error message since the printing message like '`a`' could confuse ??

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can just remove the example in the error message

ok. Let's remove the example. You can show which quotes to add:

      "Cannot resolve column <objectName> as a map key. If the key is a string literal, add the single quotes '' around it."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Just updated!

@MaxGekk
Copy link
Member

MaxGekk commented Nov 23, 2022

+1, LGTM. Merging to master.
Thank you, @itholic.

@MaxGekk MaxGekk closed this in b77ced5 Nov 23, 2022
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
…OUT_SUGGESTION`

### What changes were proposed in this pull request?

This PR proposes to improve error message for `UNRESOLVED_MAP_KEY.WITHOUT_SUGGESTION`.

### Why are the changes needed?

Printing the single quotes in error message as an example would more helpful for users, and we don't need 'please' in the error message. See https://spark.apache.org/error-message-guidelines.html more detail.

### Does this PR introduce _any_ user-facing change?

Minor error message improvement.

From
```
Cannot resolve column `col1` as a map key. If the key is a string literal, please add single quotes around it.
```

To
```
Cannot resolve column `col1` as a map key. If the key is a string literal, add single quotes '' around it.
```

### How was this patch tested?

The existing CI should pass.

Closes apache#38646 from itholic/SPARK-41131.

Authored-by: itholic <haejoon.lee@databricks.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
…OUT_SUGGESTION`

### What changes were proposed in this pull request?

This PR proposes to improve error message for `UNRESOLVED_MAP_KEY.WITHOUT_SUGGESTION`.

### Why are the changes needed?

Printing the single quotes in error message as an example would more helpful for users, and we don't need 'please' in the error message. See https://spark.apache.org/error-message-guidelines.html more detail.

### Does this PR introduce _any_ user-facing change?

Minor error message improvement.

From
```
Cannot resolve column `col1` as a map key. If the key is a string literal, please add single quotes around it.
```

To
```
Cannot resolve column `col1` as a map key. If the key is a string literal, add single quotes '' around it.
```

### How was this patch tested?

The existing CI should pass.

Closes apache#38646 from itholic/SPARK-41131.

Authored-by: itholic <haejoon.lee@databricks.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
@itholic itholic deleted the SPARK-41131 branch April 22, 2023 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants