Uh oh!
There was an error while loading. Please reload this page.
[SPARK-33803][SQL] Sort table properties by key in DESCRIBE TABLE command - #30799
[SPARK-33803][SQL] Sort table properties by key in DESCRIBE TABLE command#30799HyukjinKwon wants to merge 1 commit into
Conversation
HyukjinKwon
commented
Dec 16, 2020
@cloud-fan can you take a quick look? |
HyukjinKwon
commented
Dec 16, 2020
Thanks @dongjoon-hyun! It's super late in your time .. :-). |
dongjoon-hyun
commented
Dec 16, 2020
It's a catch-up before going to bed. :) |
SparkQA
commented
Dec 16, 2020
Kubernetes integration test starting |
SparkQA
commented
Dec 16, 2020
Kubernetes integration test status success |
SparkQA
commented
Dec 16, 2020
Test build #132873 has finished for PR 30799 at commit
|
cloud-fan
commented
Dec 16, 2020
thanks, merging to master/3.1! |
…mand ### What changes were proposed in this pull request? This PR proposes to sort table properties in DESCRIBE TABLE command. This is consistent with DSv2 command as well: https://github.com/apache/spark/blob/e3058ba17cb4512537953eb4ded884e24ee93ba2/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala#L63 This PR fixes the test case in Scala 2.13 build as well where the table properties have different order in the map. ### Why are the changes needed? To keep the deterministic and pretty output, and fix the tests in Scala 2.13 build. See https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-maven-hadoop-3.2-scala-2.13/49/testReport/junit/org.apache.spark.sql/SQLQueryTestSuite/describe_sql/ ``` describe.sql Expected "...spark_catalog, view.[query.out.col.2=c, view.referredTempFunctionsNames=[], view.catalogAndNamespace.part.1=default]]", but got "...spark_catalog, view.[catalogAndNamespace.part.1=default, view.query.out.col.2=c, view.referredTempFunctionsNames=[]]]" Result did not match for query #29 DESC FORMATTED v ``` ### Does this PR introduce _any_ user-facing change? Yes, it will change the text output from `DESCRIBE [EXTENDED|FORMATTED] table_name`. Now the table properties are sorted by its key. ### How was this patch tested? Related unittests were fixed accordingly. Closes#30799 from HyukjinKwon/SPARK-33803. Authored-by: HyukjinKwon <gurwls223@apache.org> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 7845865) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
| val tableProperties = properties.toSeq.sortBy(_._1) | ||
| .map(p => p._1 + "=" + p._2).mkString("[", ", ", "]") |
There was a problem hiding this comment.
Should we sort by entire strings (._1 and ._2)? For example, if you have key0 = b and key0 = a, you may get unstable output either [key0 = b, key0 = a] or [key0 = a, key0 = b]
There was a problem hiding this comment.
ah, sorry, we can guarantee uniqueness of keys.
What changes were proposed in this pull request?
This PR proposes to sort table properties in DESCRIBE TABLE command. This is consistent with DSv2 command as well:
spark/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DescribeTableExec.scala
Line 63 in e3058ba
This PR fixes the test case in Scala 2.13 build as well where the table properties have different order in the map.
Why are the changes needed?
To keep the deterministic and pretty output, and fix the tests in Scala 2.13 build.
See https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-maven-hadoop-3.2-scala-2.13/49/testReport/junit/org.apache.spark.sql/SQLQueryTestSuite/describe_sql/
Does this PR introduce any user-facing change?
Yes, it will change the text output from
DESCRIBE [EXTENDED|FORMATTED] table_name.Now the table properties are sorted by its key.
How was this patch tested?
Related unittests were fixed accordingly.