[GitHub] [spark] yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add ALTER TABLE SET OWNER syntax

2020-01-17 Thread GitBox
yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add 
ALTER TABLE SET OWNER syntax
URL: https://github.com/apache/spark/pull/27249#discussion_r367943749
 
 

 ##
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
 ##
 @@ -569,7 +570,11 @@ private[hive] class HiveClientImpl(
 
   override def createTable(table: CatalogTable, ignoreIfExists: Boolean): Unit 
= withHiveState {
 verifyColumnDataType(table.dataSchema)
-client.createTable(toHiveTable(table, Some(userName)), ignoreIfExists)
+val ownerType =
+  table.properties.getOrElse(TableCatalog.PROP_OWNER_TYPE, 
PrincipalType.USER.name())
 
 Review comment:
   the hive catalog's ownership is decided by this class as Database does,  
it's simpler. For v2 commands, we have to do injection in our plans because we 
are not the catalog developer. As if we are, we also only need to inject 
ownership in that catalog's `createTable `


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [spark] yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add ALTER TABLE SET OWNER syntax

2020-01-17 Thread GitBox
yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add 
ALTER TABLE SET OWNER syntax
URL: https://github.com/apache/spark/pull/27249#discussion_r367814229
 
 

 ##
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
 ##
 @@ -227,13 +228,14 @@ case class AtomicReplaceTableAsSelectExec(
 
   override protected def doExecute(): RDD[InternalRow] = {
 val schema = query.schema.asNullable
+val propertiesWithOwner = withDefaultOwnership(properties).asJava
 
 Review comment:
   maybe we can add them in DataSourceV2Strategy? then we don't need extra 
analyzer rules to copy themselves 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [spark] yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add ALTER TABLE SET OWNER syntax

2020-01-16 Thread GitBox
yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add 
ALTER TABLE SET OWNER syntax
URL: https://github.com/apache/spark/pull/27249#discussion_r367789379
 
 

 ##
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
 ##
 @@ -227,13 +228,14 @@ case class AtomicReplaceTableAsSelectExec(
 
   override protected def doExecute(): RDD[InternalRow] = {
 val schema = query.schema.asNullable
+val propertiesWithOwner = withDefaultOwnership(properties).asJava
 
 Review comment:
   Yes, they have a common parent `V2CreateTablePlan` when they are on the 
logical side. We may add a method like 
   ```scala
   override def withPartitioning(rewritten: Seq[Transform]): V2CreateTablePlan 
= {
   this.copy(partitioning = rewritten)
   }
   
   override def withOwnership(): V2CreateTablePlan = {
   this.copy(properties = this.properites ++ ownership)
   }
   ```
   
   but not more elegant and simpler as it is now


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [spark] yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add ALTER TABLE SET OWNER syntax

2020-01-16 Thread GitBox
yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add 
ALTER TABLE SET OWNER syntax
URL: https://github.com/apache/spark/pull/27249#discussion_r367779471
 
 

 ##
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
 ##
 @@ -227,13 +228,14 @@ case class AtomicReplaceTableAsSelectExec(
 
   override protected def doExecute(): RDD[InternalRow] = {
 val schema = query.schema.asNullable
+val propertiesWithOwner = withDefaultOwnership(properties).asJava
 
 Review comment:
   do we have any other APIs that will bypass the analyzer?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [spark] yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add ALTER TABLE SET OWNER syntax

2020-01-16 Thread GitBox
yaooqinn commented on a change in pull request #27249: [SPARK-30019][SQL] Add 
ALTER TABLE SET OWNER syntax
URL: https://github.com/apache/spark/pull/27249#discussion_r367779471
 
 

 ##
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
 ##
 @@ -227,13 +228,14 @@ case class AtomicReplaceTableAsSelectExec(
 
   override protected def doExecute(): RDD[InternalRow] = {
 val schema = query.schema.asNullable
+val propertiesWithOwner = withDefaultOwnership(properties).asJava
 
 Review comment:
   do we have any other APIs will bypass the analyzer?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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