Uh oh!
There was an error while loading. Please reload this page.
[SPARK-30940][SQL] Remove attributeId in auto-generated arguments when Explain SQL query - #27685
[SPARK-30940][SQL] Remove attributeId in auto-generated arguments when Explain SQL query#27685Eric5553 wants to merge 4 commits into
Conversation
SparkQA
commented
Feb 24, 2020
Test build #118876 has finished for PR 27685 at commit
|
SparkQA
commented
Feb 24, 2020
Test build #118880 has finished for PR 27685 at commit
|
SparkQA
commented
Feb 28, 2020
Test build #119063 has finished for PR 27685 at commit
|
Eric5553
commented
Feb 28, 2020
@cloud-fan Would you please help review this? Thanks so much! |
There was a problem hiding this comment.
It's still useful to have the attr id as the name can be duplicated
scala> sql("select 1 as a, 2 as a").explain
== Physical Plan ==
*(1) Project [1 AS a#53, 2 AS a#54]
+- Scan OneRowRelation[]
I think we should only remove the attr id from the auto-generated alias name. e.g. this should be [max(val)#x]
There was a problem hiding this comment.
I see. Thanks for the review :-)
The common modification in AttributeReference will also remove the # in [max(val)#x]. I'm trying to pin point to the exact creation place of auto-generated AttributeReference name.
There was a problem hiding this comment.
@cloud-fan I've re-implemented to only remove the auto-generated Attrids I think. Would you please help review again? Thanks so much!
SparkQA
commented
Mar 2, 2020
Test build #119179 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 2, 2020
Test build #119178 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 3, 2020
Test build #119198 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 3, 2020
Test build #119203 has finished for PR 27685 at commit
|
Eric5553
commented
Mar 3, 2020
retest this please |
SparkQA
commented
Mar 3, 2020
Test build #119220 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 9, 2020
Test build #119547 has finished for PR 27685 at commit
|
Eric5553
commented
Mar 9, 2020
cc @cloud-fan@gatorsmile@maropu@maryannxue , thanks! |
Uh oh!
There was an error while loading. Please reload this page.
| -- !query output | ||
| org.apache.spark.sql.AnalysisException | ||
| grouping expressions sequence is empty, and 'spark_catalog.default.test_having.`a`' is not an aggregate function. Wrap '(min(spark_catalog.default.test_having.`a`) AS `min(a#x)`, max(spark_catalog.default.test_having.`a`) AS `max(a#x)`)' in windowing function(s) or wrap 'spark_catalog.default.test_having.`a`' in first() (or first_value) if you don't care which value you get.; | ||
| grouping expressions sequence is empty, and 'spark_catalog.default.test_having.`a`' is not an aggregate function. Wrap '(min(spark_catalog.default.test_having.`a`) AS `min(a)`, max(spark_catalog.default.test_having.`a`) AS `max(a)`)' in windowing function(s) or wrap 'spark_catalog.default.test_having.`a`' in first() (or first_value) if you don't care which value you get.; |
There was a problem hiding this comment.
We need to hide ids even in error messages, too?
There was a problem hiding this comment.
I think the flatArgument/flatArgumentsString is tightly bind with toString of Expression/AggregateExpression, which will commonly affect all of them. I'll try more to eliminate the impact, thanks!
There was a problem hiding this comment.
The error message explicitly called map(_.sql) instead of default toString. The Alias.sql is using name field which has already been formatted by flatArguments when constructing Alias. So this is also following the flatArgument framework.
As the error message is intended to suggest user with a sql snippet, maybe it's better to not includ #exprId anyway? Thanks.
| flatArguments.toSeq, "(", ", ", ")", SQLConf.get.maxToStringFields) | ||
| flatArgumentStrings.toSeq, "(", ", ", ")", SQLConf.get.maxToStringFields) | ||
| def argumentString: String = toString |
There was a problem hiding this comment.
is it possible to only add one method? I'm worried about adding to many methods to the framework.
There was a problem hiding this comment.
IMO, the argumentString is needed because AttributeReference already overwrite toString, thus we need the new abstract string function to switch to non-exprid format. For flatArgumentStrings, it only have two callers. I refactored the toAggString of AggregateFunction, then we don't need to add the method flatArgumentStrings in Expression but just implement it within toString. See commit b74c500.
SparkQA
commented
Mar 9, 2020
Test build #119570 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 9, 2020
Test build #119573 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 10, 2020
Test build #119597 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 10, 2020
Test build #119607 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 17, 2020
Test build #119916 has finished for PR 27685 at commit
|
SparkQA
commented
Mar 17, 2020
Test build #119928 has finished for PR 27685 at commit
|
Eric5553
commented
Mar 17, 2020
@cloud-fan Would you please help review the latest change? Thanks so much :-) |
Eric5553
commented
Mar 25, 2020
@cloud-fan@gatorsmile@maryannxue Would you please help review this PR? Thanks so much :-) |
maropu
commented
Apr 9, 2020
@Eric5553 Could you resolve the conflict? |
Eric5553
commented
Apr 9, 2020
Updated. Thanks so much for helping maintain the PR ! @maropu |
SparkQA
commented
Apr 9, 2020
Test build #121037 has finished for PR 27685 at commit
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
What changes were proposed in this pull request?
When EXPLAIN sql query, the auto-generated argument alias shouldn't include expr/attribute id. This will provide better readability of Explain results. This is a follow-up to address #27368 (comment).
Before
After
Why are the changes needed?
Provide better readability for Explain result
Does this PR introduce any user-facing change?
Update Explain result to a better format
How was this patch tested?
Update existing tests