You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by yang0228 <gi...@git.apache.org> on 2016/03/03 08:34:49 UTC
[GitHub] spark pull request: [SPARK-10562][SQL] support mixed case partitio...
Github user yang0228 commented on a diff in the pull request:
https://github.com/apache/spark/pull/9226#discussion_r54844658
--- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
@@ -218,25 +233,19 @@ private[hive] class HiveMetastoreCatalog(val client: ClientInterface, hive: Hive
}
}
- val metastorePartitionColumns = userSpecifiedSchema.map { schema =>
- val fields = partitionColumns.map(col => schema(col))
- fields.map { field =>
- HiveColumn(
- name = field.name,
- hiveType = HiveMetastoreTypes.toMetastoreType(field.dataType),
- comment = "")
- }.toSeq
- }.getOrElse {
- if (partitionColumns.length > 0) {
- // The table does not have a specified schema, which means that the schema will be inferred
- // when we load the table. So, we are not expecting partition columns and we will discover
- // partitions when we load the table. However, if there are specified partition columns,
- // we simply ignore them and provide a warning message.
- logWarning(
- s"The schema and partitions of table $tableIdent will be inferred when it is loaded. " +
- s"Specified partition columns (${partitionColumns.mkString(",")}) will be ignored.")
+ if (userSpecifiedSchema.isDefined && partitionColumns.length > 0) {
+ tableProperties.put("spark.sql.sources.schema.numPartCols", partitionColumns.length.toString)
+ partitionColumns.zipWithIndex.foreach { case (partCol, index) =>
+ tableProperties.put(s"spark.sql.sources.schema.partCol.$index", partCol)
}
- Seq.empty[HiveColumn]
+ } else {
+ // The table does not have a specified schema, which means that the schema will be inferred
+ // when we load the table. So, we are not expecting partition columns and we will discover
+ // partitions when we load the table. However, if there are specified partition columns,
+ // we simply ignore them and provide a warning message.
+ logWarning(
+ s"The schema and partitions of table $tableIdent will be inferred when it is loaded. " +
+ s"Specified partition columns (${partitionColumns.mkString(",")}) will be ignored.")
--- End diff --
Can you explain the change at line 293 "partitionColumns = Nil"?
When running "df.write.partitionBy("X").mode(SaveMode.Overwrite).saveAsTable(tableName) "(df generated with HiveContext) in spark 1.6, what I get in hive is a not-partitioned table. I've seen this line was "partitionColumns = partitionColumns" in spark1.5.2, which assigns the partition column.
---
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