spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "xubo245 (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-23039) Fix the bug in alter table set location.
Date Sat, 13 Jan 2018 13:57:00 GMT

     [ https://issues.apache.org/jira/browse/SPARK-23039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

xubo245 updated SPARK-23039:
----------------------------
    Description: 
TOBO work: Fix the bug in alter table set location.   
org.apache.spark.sql.execution.command.DDLSuite#testSetLocation

{code:java}
    // TODO(gatorsmile): fix the bug in alter table set location.
   //    if (isUsingHiveMetastore) {
    //    assert(storageFormat.properties.get("path") === expected)
    //   }
{code}

Analysis:

because user add locationUri and erase path by 
{code:java}
 newPath = None
{code}
in org.apache.spark.sql.hive.HiveExternalCatalog#restoreDataSourceTable:

{code:java}
val storageWithLocation = {
      val tableLocation = getLocationFromStorageProps(table)
      // We pass None as `newPath` here, to remove the path option in storage properties.
      updateLocationInStorageProps(table, newPath = None).copy(
        locationUri = tableLocation.map(CatalogUtils.stringToURI(_)))
    }
{code}

=>
newPath = None



  was:
TOBO work: Fix the bug in alter table set location.   
org.apache.spark.sql.execution.command.DDLSuite#testSetLocation

{code:java}
    // TODO(gatorsmile): fix the bug in alter table set location.
   //    if (isUsingHiveMetastore) {
    //    assert(storageFormat.properties.get("path") === expected)
    //   }
{code}

Analysis:

because user add locationUri and erase path by 
{code:java}
 newPath = None
{code}
in org.apache.spark.sql.hive.HiveExternalCatalog#restoreDataSourceTable:

{code:java}
val storageWithLocation = {
      val tableLocation = getLocationFromStorageProps(table)
      // We pass None as `newPath` here, to remove the path option in storage properties.
      updateLocationInStorageProps(table, newPath = None).copy(
        locationUri = tableLocation.map(CatalogUtils.stringToURI(_)))
    }
{code}

because " We pass None as `newPath` here, to remove the path option in storage properties."

And locationUri is obtain from path in storage properties

{code:java}
  private def getLocationFromStorageProps(table: CatalogTable): Option[String] = {
    CaseInsensitiveMap(table.storage.properties).get("path")
  }
{code}

So we can use locationUri instead path



>  Fix the bug in alter table set location.
> -----------------------------------------
>
>                 Key: SPARK-23039
>                 URL: https://issues.apache.org/jira/browse/SPARK-23039
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.2.1
>            Reporter: xubo245
>            Priority: Critical
>
> TOBO work: Fix the bug in alter table set location.   
> org.apache.spark.sql.execution.command.DDLSuite#testSetLocation
> {code:java}
>     // TODO(gatorsmile): fix the bug in alter table set location.
>    //    if (isUsingHiveMetastore) {
>     //    assert(storageFormat.properties.get("path") === expected)
>     //   }
> {code}
> Analysis:
> because user add locationUri and erase path by 
> {code:java}
>  newPath = None
> {code}
> in org.apache.spark.sql.hive.HiveExternalCatalog#restoreDataSourceTable:
> {code:java}
> val storageWithLocation = {
>       val tableLocation = getLocationFromStorageProps(table)
>       // We pass None as `newPath` here, to remove the path option in storage properties.
>       updateLocationInStorageProps(table, newPath = None).copy(
>         locationUri = tableLocation.map(CatalogUtils.stringToURI(_)))
>     }
> {code}
> =>
> newPath = None



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message