-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-39354][SQL] Ensure show Table or view not found even if there are dataTypeMismatchError related to Filter at the same time
#36746
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LuciferYang
commented
Jun 2, 2022
| |SELECT (t.c AND t.d) c | ||
| |FROM t | ||
| |GROUP BY t.c | ||
| |GROUP BY t.c, t.d |
Contributor
Author
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.
without t.d, the error message is
expression 't.d' is neither present in the group by, nor is it an aggregate function. Add to group by or wrap in first() (or first_value) if you don't care which value you get.
Contributor
Author
|
Try to fix SPARK-39354, if acceptable, I will update the pr description |
Member
Table or view not found first even if there are dataTypeMismatchError at the same time
Table or view not found first even if there are dataTypeMismatchError at the same timeTable or view not found even if there are dataTypeMismatchError at the same time
Table or view not found even if there are dataTypeMismatchError at the same timeTable or view not found even if there are dataTypeMismatchError at the same time
Table or view not found even if there are dataTypeMismatchError at the same timeTable or view not found even if there are dataTypeMismatchError at the same time
Table or view not found even if there are dataTypeMismatchError at the same timeTable or view not found even if there are dataTypeMismatchError for Filter at the same time
Table or view not found even if there are dataTypeMismatchError for Filter at the same timeTable or view not found even if there are dataTypeMismatchError related to Filter at the same time
Contributor
Author
done |
Table or view not found even if there are dataTypeMismatchError related to Filter at the same timeTable or view not found even if there are dataTypeMismatchError related to Filter at the same time
MaxGekk
approved these changes
Jun 2, 2022
Member
|
+1, LGTM. Merging to master/3.3. |
MaxGekk
pushed a commit
that referenced
this pull request
Jun 2, 2022
…e are `dataTypeMismatchError` related to `Filter` at the same time ### What changes were proposed in this pull request? After SPARK-38118, `dataTypeMismatchError` related to `Filter` will be checked and throw in `RemoveTempResolvedColumn`, this will cause compatibility issue with exception message presentation. For example, the following case: ``` spark.sql("create table t1(user_id int, auct_end_dt date) using parquet;") spark.sql("select * from t1 join t2 on t1.user_id = t2.user_id where t1.auct_end_dt >= Date_sub('2020-12-27', 90)").show ``` The expected message is ``` Table or view not found: t2 ``` But the actual message is ``` org.apache.spark.sql.AnalysisException: cannot resolve 'date_sub('2020-12-27', 90)' due to data type mismatch: argument 1 requires date type, however, ''2020-12-27'' is of string type.; line 1 pos 76 ``` For forward compatibility, this pr change to only records `DATA_TYPE_MISMATCH_ERROR_MESSAGE` in the `RemoveTempResolvedColumn` check process , and move `failAnalysis` to `CheckAnalysis#checkAnalysis` ### Why are the changes needed? Fix analysis exception message compatibility. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass Github Actions and add a new test case Closes #36746 from LuciferYang/SPARK-39354. Authored-by: yangjie01 <[email protected]> Signed-off-by: Max Gekk <[email protected]> (cherry picked from commit 89fdb8a) Signed-off-by: Max Gekk <[email protected]>
Contributor
Author
cloud-fan
added a commit
that referenced
this pull request
Jun 16, 2022
### What changes were proposed in this pull request? This is a followup of #35404 and #36746 , to simplify the error handling of `TempResolvedColumn`. The idea is: 1. The rule `ResolveAggregationFunctions` in the main resolution batch creates `TempResolvedColumn` and only removes it if the aggregate expression is fully resolved. It either strips `TempResolvedColumn` if it's inside aggregate function or group expression, or restores `TempResolvedColumn` to `UnresolvedAttribute` otherwise, hoping other rules can resolve it. 2. The rule `RemoveTempResolvedColumn` in a latter batch can still hit `TempResolvedColumn` if the aggregate expression is unresolved (due to input type mismatch for example, e.g. `avg(bool_col)`, `date_add(int_group_col, 1)`). At this stage, there is no way to restore `TempResolvedColumn` to `UnresolvedAttribute` and resolve it differently. The query will fail and we should blindly strip `TempResolvedColumn` to provide better error message. ### Why are the changes needed? code cleanup ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? existing tests Closes #36809 from cloud-fan/error. Lead-authored-by: Wenchen Fan <[email protected]> Co-authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
After SPARK-38118,
dataTypeMismatchErrorrelated toFilterwill be checked and throw inRemoveTempResolvedColumn, this will cause compatibility issue with exception message presentation.For example, the following case:
The expected message is
But the actual message is
For forward compatibility, this pr change to only records
DATA_TYPE_MISMATCH_ERROR_MESSAGEin theRemoveTempResolvedColumncheck process , and movefailAnalysistoCheckAnalysis#checkAnalysisWhy are the changes needed?
Fix analysis exception message compatibility.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Pass Github Actions and add a new test case