[ 
https://issues.apache.org/jira/browse/SPARK-19257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15832935#comment-15832935
 ] 

Song Jun edited comment on SPARK-19257 at 1/22/17 11:22 AM:
------------------------------------------------------------

I found it that `CatalogTablePartition` and `CatalogTable` use the same class 
`CatalogTableStorageFormat`.
if we change CatalogTableStorageFormat 's locationUri from `String` to `URI`, 
this will failed in `CatalogTablePartition` because table partition location 
can have whitespace, such as `2014-01-01 00%3A00%3A00`, while this is not a 
legal URI (no encoded whitespace) 

a)should we seperate the CatalogTableStorageFormat from CatalogTablePartition 
and CatalogTable?

b)or we just check if the ` locationUri: String` is illegal when make a DDL 
command, such as ` alter table set location xx` or `create table t options 
(path xx) `

Hive's implement is like b) :
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java#L1553
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java#L3732

HIVE-0.12 the table's location method's paramenter Type is URI, after that 
version change to Path
https://github.com/apache/hive/blob/branch-0.12/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java#L501

this is the same issue in hive: 
https://issues.apache.org/jira/browse/HIVE-6185

[~cloud_fan] [~smilegator]


was (Author: windpiger):
I found it that `CatalogTablePartition` and `CatalogTable` use the same class 
`CatalogTableStorageFormat`.
if we change CatalogTableStorageFormat 's locationUri from `String` to `URI`, 
this will failed in `CatalogTablePartition` because table partition location 
can have whitespace, such as `2014-01-01 00%3A00%3A00`, while this is not a 
legal URI (no encoded whitespace) 

a)should we seperate the CatalogTableStorageFormat from CatalogTablePartition 
and CatalogTable?

b)or we just check if the ` locationUri: String` is illegal when make a DDL 
command, such as ` alter table set location xx` or `create table t options 
(path xx) `

Hive's implement is like b) :
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java#L1553
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java#L3732

[~cloud_fan] [~smilegator]

> The type of CatalogStorageFormat.locationUri should be java.net.URI instead 
> of String
> -------------------------------------------------------------------------------------
>
>                 Key: SPARK-19257
>                 URL: https://issues.apache.org/jira/browse/SPARK-19257
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Wenchen Fan
>
> Currently we treat `CatalogStorageFormat.locationUri` as URI string and 
> always convert it to path by `new Path(new URI(locationUri))`
> It will be safer if we can make the type of 
> `CatalogStorageFormat.locationUri` java.net.URI. We should finish the TODO in 
> https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala#L50-L52



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to