cloud-fan commented on a change in pull request #35204:
URL: https://github.com/apache/spark/pull/35204#discussion_r785683230
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala
##########
@@ -82,8 +86,32 @@ case class ShowCreateTableExec(
private def showTablePartitioning(table: Table, builder: StringBuilder):
Unit = {
if (!table.partitioning.isEmpty) {
val transforms = new ArrayBuffer[String]
- table.partitioning.foreach(t => transforms += t.describe())
- builder ++= s"PARTITIONED BY ${transforms.mkString("(", ", ", ")")}\n"
+ var bucketSpec = Option.empty[BucketSpec]
+ table.partitioning.map {
+ case BucketTransform(numBuckets, col, sortCol) =>
+ if (sortCol.isEmpty) {
+ bucketSpec = Some(BucketSpec(numBuckets,
col.map(_.fieldNames.mkString(".")), Nil))
+ } else {
+ bucketSpec = Some(BucketSpec(numBuckets,
col.map(_.fieldNames.mkString(".")),
+ sortCol.map(_.fieldNames.mkString("."))))
+ }
+ case t =>
+ transforms += t.describe()
+ }
+ if (transforms.nonEmpty) {
+ builder ++= s"PARTITIONED BY ${transforms.mkString("(", ", ", ")")}\n"
+ }
+
+ // compatible with v1
+ bucketSpec.map { bucket =>
+ if (bucket.bucketColumnNames.nonEmpty) {
Review comment:
nit: we can turn this if into an assert, as this can never happen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]