Skip to content

[SPARK-19970][SQL][BRANCH-2.1] Table owner should be USER instead of PRINCIPAL in kerberized clusters#17363

Closed
dongjoon-hyun wants to merge 1 commit into
apache:branch-2.1from
dongjoon-hyun:SPARK-19970-2
Closed

[SPARK-19970][SQL][BRANCH-2.1] Table owner should be USER instead of PRINCIPAL in kerberized clusters#17363
dongjoon-hyun wants to merge 1 commit into
apache:branch-2.1from
dongjoon-hyun:SPARK-19970-2

Conversation

@dongjoon-hyun

Copy link
Copy Markdown
Member

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 in Hive. We had better to fix this.

BEFORE

scala> sql("create table t(a int)").show
scala> sql("desc formatted t").show(false)
...
|Owner:                      |spark@EXAMPLE.COM                                         |       |

AFTER

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.

}
hiveTable.setPartCols(partCols.asJava)
hiveTable.setOwner(conf.getUser)
hiveTable.setOwner(state.getAuthenticator().getUserName())

@dongjoon-hyun dongjoon-hyun Mar 20, 2017

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanzin . I made a backport for branch-2.1 of #17311 . This one uses state as you advised.

@SparkQA

SparkQA commented Mar 20, 2017

Copy link
Copy Markdown

Test build #74891 has finished for PR 17363 at commit 1328f1d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun

dongjoon-hyun commented Mar 20, 2017

Copy link
Copy Markdown
Member Author

This is also tested manually in kerberized cluster, @vanzin .

BTW, Spark 1.6 has the same issue at ClientWrapper.

According to the Spark dev email, there exists demands on more Apache Spark 1.6.X. May I create a backport for branch-1.6? How do you think about that?

For Spark 1.6, it happens only with CREATE TABLE .. AS SELECT statement.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Hi, @vanzin .
Could you review this backport when you have some time?

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Retest this please

@SparkQA

SparkQA commented Mar 22, 2017

Copy link
Copy Markdown

Test build #75055 has finished for PR 17363 at commit 1328f1d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin

vanzin commented Mar 23, 2017

Copy link
Copy Markdown
Contributor

Merging to 2.1 / 2.0.

I don't really expect any more 1.6 releases at this point, so I wouldn't bother.

asfgit pushed a commit that referenced this pull request Mar 23, 2017
…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 <dongjoon@apache.org>

Closes #17363 from dongjoon-hyun/SPARK-19970-2.
@vanzin

vanzin commented Mar 23, 2017

Copy link
Copy Markdown
Contributor

Failed to merge to 2.0. :-/

@vanzin

vanzin commented Mar 23, 2017

Copy link
Copy Markdown
Contributor

@dongjoon-hyun you'll have to manually close this.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Oo. Thank you so much, @vanzin !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants