": Extracts sc...
Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/13025#discussion_r62698532
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
@@ -489,9 +486,83 @@ private[sql] object DDLUtils {
case _ =>
})
}
+
def isTablePartitioned(table: CatalogTable): Boolean = {
- table.partitionColumns.size > 0 ||
+ table.partitionColumns.nonEmpty ||
table.properties.contains("spark.sql.sources.schema.numPartCols")
}
-}
+ def getSchemaFromTableProperties(metadata: CatalogTable): Option[StructType] = {
+ getSchemaFromTableProperties(metadata.properties)
+ }
+
+ // A persisted data source table may not store its schema in the catalog. In this case, its schema
+ // will be inferred at runtime when the table is referenced.
+ def getSchemaFromTableProperties(props: Map[String, String]): Option[StructType] = {
+ require(isDatasourceTable(props))
+
+ val schemaParts = for {
+ numParts <- props.get("spark.sql.sources.schema.numParts").toSeq
+ index <- 0 until numParts.toInt
+ } yield props.getOrElse(
+ s"spark.sql.sources.schema.part.$index",
+ throw new AnalysisException(
+ s"Corrupted schema in catalog: $numParts parts expected, but part $index is missing."
+ )
+ )
+
+ if (schemaParts.isEmpty) {
+ None
+ } else {
+ Some(DataType.fromJson(schemaParts.mkString).asInstanceOf[StructType])
+ }
+ }
--- End diff --
There was a time when we only used `spark.sql.sources.schema`. Let's check this first and then check `spark.sql.sources.schema.numParts`. You can take a look at `HiveMetastoreCatalog`'s `cachedDataSourceTables`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-14127][SQL] "DESC
": Extracts sc...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/13025#issuecomment-218140818
**[Test build #58231 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58231/consoleFull)** for PR 13025 at commit [`2eccb6e`](https://github.com/apache/spark/commit/2eccb6e1dbcd47e89cbf5fcd5a79f3a65cee0672).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-14127][SQL] "DESC
": Extracts sc...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/13025#issuecomment-218140790
Merged build finished. Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-14127][SQL] "DESC
": Extracts sc...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/13025#issuecomment-218140575
**[Test build #58232 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58232/consoleFull)** for PR 13025 at commit [`54e2618`](https://github.com/apache/spark/commit/54e2618e441d7defe6de436cffe607b0ea24f46f).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-14127][SQL] "DESC
": Extracts sc...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/13025#issuecomment-218141035
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/58231/
Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-14127][SQL] "DESC
": Extracts sc...
Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/13025#discussion_r62699825
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
@@ -489,9 +486,83 @@ private[sql] object DDLUtils {
case _ =>
})
}
+
def isTablePartitioned(table: CatalogTable): Boolean = {
- table.partitionColumns.size > 0 ||
+ table.partitionColumns.nonEmpty ||
table.properties.contains("spark.sql.sources.schema.numPartCols")
}
-}
+ def getSchemaFromTableProperties(metadata: CatalogTable): Option[StructType] = {
+ getSchemaFromTableProperties(metadata.properties)
+ }
+
+ // A persisted data source table may not store its schema in the catalog. In this case, its schema
+ // will be inferred at runtime when the table is referenced.
+ def getSchemaFromTableProperties(props: Map[String, String]): Option[StructType] = {
+ require(isDatasourceTable(props))
+
+ val schemaParts = for {
+ numParts <- props.get("spark.sql.sources.schema.numParts").toSeq
+ index <- 0 until numParts.toInt
+ } yield props.getOrElse(
+ s"spark.sql.sources.schema.part.$index",
+ throw new AnalysisException(
+ s"Corrupted schema in catalog: $numParts parts expected, but part $index is missing."
+ )
+ )
+
+ if (schemaParts.isEmpty) {
+ None
+ } else {
+ Some(DataType.fromJson(schemaParts.mkString).asInstanceOf[StructType])
+ }
+ }
--- End diff --
I will make a commit to handle `spark.sql.sources.schema`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-14127][SQL] "DESC
": Extracts sc...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/13025#issuecomment-218124867
**[Test build #58232 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/58232/consoleFull)** for PR 13025 at commit [`54e2618`](https://github.com/apache/spark/commit/54e2618e441d7defe6de436cffe607b0ea24f46f).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org