spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gatorsmile <...@git.apache.org>
Subject [GitHub] spark pull request #15024: [SPARK-17470][SQL] unify path for data source tab...
Date Thu, 27 Oct 2016 07:38:00 GMT
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15024#discussion_r85280600
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala
---
    @@ -415,16 +422,34 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf:
Configurat
         }
     
         if (DDLUtils.isDatasourceTable(withStatsProps)) {
    -      val oldDef = client.getTable(db, withStatsProps.identifier.table)
    -      // Sets the `schema`, `partitionColumnNames` and `bucketSpec` from the old table
definition,
    -      // to retain the spark specific format if it is. Also add old data source properties
to table
    -      // properties, to retain the data source table format.
    -      val oldDataSourceProps = oldDef.properties.filter(_._1.startsWith(DATASOURCE_PREFIX))
    +      val oldTableDef = client.getTable(db, withStatsProps.identifier.table)
    +
    +      val oldLocation = getLocationFromRawTable(oldTableDef)
    +      // Only update the `locationUri` field if the location is really changed, because
this table
    +      // may be not Hive-compatible and can not set the `locationUri` field. We should
respect the
    +      // old `locationUri` even it's None.
    +      val newLocation = if (oldLocation == tableDefinition.storage.locationUri) {
    +        oldTableDef.storage.locationUri
    +      } else {
    +        tableDefinition.storage.locationUri
    +      }
    --- End diff --
    
    Just FYI, we do not have any test case to cover this. `ALTER TABLE SET LOCATION` for data
source tables is only tested in `DDLSuite` (when Hive support is not enabled). That means,
these code changes are not tested. Actually, this is not the only one. : (


---
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


Mime
View raw message