You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by va...@apache.org on 2017/03/20 17:07:37 UTC
spark git commit: [SPARK-19970][SQL] Table owner should be USER
instead of PRINCIPAL in kerberized clusters
Repository: spark
Updated Branches:
refs/heads/master 7ce30e00b -> fc7554599
[SPARK-19970][SQL] Table owner should be USER instead of PRINCIPAL in kerberized clusters
## What changes were proposed in this pull request?
In the kerberized hadoop cluster, when Spark creates tables, the owner of tables are filled with PRINCIPAL strings instead of USER names. This is inconsistent with Hive and causes problems when using [ROLE](https://cwiki.apache.org/confluence/display/Hive/SQL+Standard+Based+Hive+Authorization) in Hive. We had better to fix this.
**BEFORE**
```scala
scala> sql("create table t(a int)").show
scala> sql("desc formatted t").show(false)
...
|Owner: |sparkEXAMPLE.COM | |
```
**AFTER**
```scala
scala> sql("create table t(a int)").show
scala> sql("desc formatted t").show(false)
...
|Owner: |spark | |
```
## How was this patch tested?
Manually do `create table` and `desc formatted` because this happens in Kerberized clusters.
Author: Dongjoon Hyun <do...@apache.org>
Closes #17311 from dongjoon-hyun/SPARK-19970.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/fc755459
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/fc755459
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/fc755459
Branch: refs/heads/master
Commit: fc7554599a4b6e5c22aa35e7296b424a653a420b
Parents: 7ce30e0
Author: Dongjoon Hyun <do...@apache.org>
Authored: Mon Mar 20 10:07:31 2017 -0700
Committer: Marcelo Vanzin <va...@cloudera.com>
Committed: Mon Mar 20 10:07:31 2017 -0700
----------------------------------------------------------------------
.../scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/fc755459/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
index 989fdc5..13edcd0 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
@@ -851,7 +851,7 @@ private[hive] object HiveClientImpl {
hiveTable.setFields(schema.asJava)
}
hiveTable.setPartCols(partCols.asJava)
- conf.foreach(c => hiveTable.setOwner(c.getUser))
+ conf.foreach { _ => hiveTable.setOwner(SessionState.get().getAuthenticator().getUserName()) }
hiveTable.setCreateTime((table.createTime / 1000).toInt)
hiveTable.setLastAccessTime((table.lastAccessTime / 1000).toInt)
table.storage.locationUri.map(CatalogUtils.URIToString(_)).foreach { loc =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org