[SPARK-21957][SQL] Add current_user function - #19169
Conversation
|
The Python side looks reasonable, maybe @marmbrus can share his view on adding this function in general? |
|
looks something is gone wrong with Jenkins command .. not sure why but looks we should just say "ok to test"? |
|
ok to test |
| */ | ||
| @ExpressionDescription( | ||
| usage = """ | ||
| _FUNC_() - Returns the current user executing the query. |
There was a problem hiding this comment.
I do not think Spark has something like SESSION_USER. Thus, this impl is wrong.
|
|
||
| /** Returns the result of evaluating this expression on a given input Row */ | ||
| override def eval(input: InternalRow): Any = { | ||
| SparkContext.getActive.map(_.sparkUser).getOrElse("") |
There was a problem hiding this comment.
This is from Spark Context. All the sessions share the same user names. I am afraid this value is misleading to our end users. cc @rxin
There was a problem hiding this comment.
This is actually the user which executes the query. I agree that may be misleading that a user can connect to STS with his credentials and then the queries are run with a superuser, but this is how Spark works at the moment and the user which actually runs the query is the superuser. If we don't think to STS, in the other use cases the user which runs a query is the user who started the session.
There was a problem hiding this comment.
Sorry, I do not think we should support it until we provide session-specific user management.
There was a problem hiding this comment.
ok, thanks. Then is there any plan to support session-specific user management? If so, can I help somehow? Thanks.
There was a problem hiding this comment.
So far, it is not in our plan.
|
Test build #81580 has finished for PR 19169 at commit
|
|
Test build #81581 has finished for PR 19169 at commit
|
|
the error the build job is failing for is: this is not to be related to this PR. I am checking the reason which introduced the problem. Any idea? |
|
The test failure with -9 in Jenkins is unknown up to my knowledge (although there have been few clues and assumptions so far). It should be not related with it. |
|
It seems the failure is caused by the version mismatch |
| @@ -0,0 +1,47 @@ | |||
| /* | |||
There was a problem hiding this comment.
|
On local I solved the build error by running a |
|
So far, session-specific user management is not part of our plan yet. This API is not useful before it. Could you please close this PR? |
|
I think it could have been useful anyway (eg. a user inserting rows through STS who wants to store the name of the user which is connecting to STS and performing the operation), but I agree that these are very corner cases. I am closing this then. Thanks. |
|
It would be great to see this revived. A lot of old school ETL uses a current_user() function like this for audit/lineage/provenance fields. |
What changes were proposed in this pull request?
Added the
current_userfunction.How was this patch tested?
Added UTs.