-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-25418][SQL] The metadata of DataSource table should not include Hive-generated storage properties. #22410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ import scala.util.control.NonFatal | |
| import org.apache.hadoop.conf.Configuration | ||
| import org.apache.hadoop.fs.{FileSystem, Path} | ||
| import org.apache.hadoop.hive.ql.metadata.HiveException | ||
| import org.apache.hadoop.hive.serde.serdeConstants.SERIALIZATION_FORMAT | ||
| import org.apache.thrift.TException | ||
|
|
||
| import org.apache.spark.{SparkConf, SparkException} | ||
|
|
@@ -806,6 +807,8 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat | |
| updateLocationInStorageProps(table, newPath = None).copy( | ||
| locationUri = tableLocation.map(CatalogUtils.stringToURI(_))) | ||
| } | ||
| val storageWithoutHiveGeneratedProperties = storageWithLocation.copy( | ||
| properties = storageWithLocation.properties.filterKeys(!HIVE_GENERATED_STORAGE_PROPERTIES(_))) | ||
| val partitionProvider = table.properties.get(TABLE_PARTITION_PROVIDER) | ||
|
|
||
| val schemaFromTableProps = getSchemaFromTableProperties(table) | ||
|
|
@@ -814,7 +817,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat | |
|
|
||
| table.copy( | ||
| provider = Some(provider), | ||
| storage = storageWithLocation, | ||
| storage = storageWithoutHiveGeneratedProperties, | ||
| schema = reorderedSchema, | ||
| partitionColumnNames = partColumnNames, | ||
| bucketSpec = getBucketSpecFromTableProperties(table), | ||
|
|
@@ -1309,6 +1312,8 @@ object HiveExternalCatalog { | |
|
|
||
| val CREATED_SPARK_VERSION = SPARK_SQL_PREFIX + "create.version" | ||
|
|
||
| val HIVE_GENERATED_STORAGE_PROPERTIES = Set(SERIALIZATION_FORMAT) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ueshin . The title means
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually the hive-generated storage property I think we should exclude for now is only this one, but we might have some more in the future, so I'd say "properties" and we will add them to this set in the case. WDYT?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can add more in the future. Basically, these properties are useless to Spark data source tables.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got it, @ueshin and @gatorsmile . |
||
|
|
||
| // When storing data source tables in hive metastore, we need to set data schema to empty if the | ||
| // schema is hive-incompatible. However we need a hack to preserve existing behavior. Before | ||
| // Spark 2.0, we do not set a default serde here (this was done in Hive), and so if the user | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we do this in
HiveClientImpl? IIRC we filter out some table props there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
HiveClientImpl, we don't know the table is Hive table or DataSource table yet. Can we remove the props even for Hive tables?