yaooqinn opened a new pull request #32718:
URL: https://github.com/apache/spark/pull/32718


   ### What changes were proposed in this pull request?
   
   Currently, we do not have a suitable definition of the `user` concept in 
Spark. We only have a `sparkUser` app widely but do not support identifier or 
retrieve the user information from a session in STS or a runtime query 
execution.
   
   These SQL functions are very popular and supported by plenty of other modern 
or old school databases, and also compliance.
   
   This PR add `current_user()` and `session_user()` as SQL functions. And, 
they are the same.  In this PR, we add these functions w/o ambiguity.
   1. For a normal single-threaded Spark application, clearly the `sparkUser` 
is always equivalent to `current_user()` and `session_user()`. 
   2. For a multi-threaded Spark application, e.g. Spark thrift server, we use 
a `ThreadLocal` variable to store the client-side user(after authenticated) 
before running the query and retrieve it in the parser.
   
   ### Why are the changes needed?
   
   These SQL functions are very popular and supported by plenty of other modern 
or old school databases, and also compliance.
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   yes, added  `current_user()` and `session_user()` as SQL functions
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some 
test cases that check the changes thoroughly including negative and positive 
cases if possible.
   If it was tested in a way different from regular unit tests, please clarify 
how you tested step by step, ideally copy and paste-able, so that other 
reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why 
it was difficult to add.
   -->
   
   new tests in thrift server and sql/catalyst


-- 
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



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

Reply via email to