You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/01 02:51:07 UTC

[GitHub] [spark] yaooqinn opened a new pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852028542


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43669/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852030297


   **[Test build #139155 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139155/testReport)** for PR 32718 at commit [`81b99ad`](https://github.com/apache/spark/commit/81b99ad935a89c8fc0ead4eb8a3c226747d3c372).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852205520


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43688/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] yaooqinn commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851950113


   the commit 8c70c175455219096622653d37fe8642a722e9d1 blocks `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly *ExpressionsSchemaSuite"` for updating golden file, will check this later
   ```
   [error] Symbol 'type org.scalactic.TripleEquals' is missing from the classpath.
   [error] This symbol is required by 'trait org.scalatest.Assertions'.
   [error] Make sure that type TripleEquals is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
   [error] A full rebuild may help if 'Assertions.class' was compiled against an incompatible version of org.scalactic.
   [error] one error found
   [info] compiling 27 Scala sources to /Users/kentyao/spark/sql/core/target/scala-2.12/classes ...
   [error] (core / Test / compileIncremental) Compilation failed
   [error] Total time: 40 s, completed 2021-6-1 15:58:05
   ```


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852151920


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139162/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852705831


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43711/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852244978


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139171/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852244978


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139171/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] yaooqinn commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r642906142



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
##########
@@ -283,3 +283,21 @@ case class TypeOf(child: Expression) extends UnaryExpression {
 
   override protected def withNewChildInternal(newChild: Expression): TypeOf = copy(child = newChild)
 }
+
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+  usage = """_FUNC_() - Return the current user who is running SparkContext for current query execution.""",

Review comment:
       right




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852196016


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139155/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] yaooqinn commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r642796052



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala
##########
@@ -40,6 +40,12 @@ class MiscFunctionsSuite extends QueryTest with SharedSparkSession {
       Row(SPARK_VERSION_SHORT + " " + SPARK_REVISION))
     assert(df.schema.fieldNames === Seq("version()"))
   }
+
+  test("get current_user and session_user in normal spark apps") {

Review comment:
       my bad, I forgot it




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852119605


   **[Test build #139149 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139149/testReport)** for PR 32718 at commit [`f935a32`](https://github.com/apache/spark/commit/f935a322387b5e42d2de7721b92736f6d6b987ae).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] yaooqinn commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851766836


   cc @cloud-fan @wangyum @maropu thanks very much


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852146928


   **[Test build #139162 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139162/testReport)** for PR 32718 at commit [`2dd229d`](https://github.com/apache/spark/commit/2dd229ddfe485a4a84dbee604fdd2b5bd0e08c45).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852185007


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43682/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852705831


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43711/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851792608


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43647/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852151829


   **[Test build #139162 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139162/testReport)** for PR 32718 at commit [`2dd229d`](https://github.com/apache/spark/commit/2dd229ddfe485a4a84dbee604fdd2b5bd0e08c45).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852769154


   **[Test build #139191 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139191/testReport)** for PR 32718 at commit [`5b0aaaa`](https://github.com/apache/spark/commit/5b0aaaad661f10fd8e9b3dd9a43da9e9f9078f20).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852658866


   **[Test build #139191 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139191/testReport)** for PR 32718 at commit [`5b0aaaa`](https://github.com/apache/spark/commit/5b0aaaad661f10fd8e9b3dd9a43da9e9f9078f20).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852199602


   **[Test build #139168 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139168/testReport)** for PR 32718 at commit [`ca09373`](https://github.com/apache/spark/commit/ca093735eeca693ac4749bedaeb1c54735848fdd).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852205563


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43688/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852240704


   **[Test build #139171 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139171/testReport)** for PR 32718 at commit [`5b0aaaa`](https://github.com/apache/spark/commit/5b0aaaad661f10fd8e9b3dd9a43da9e9f9078f20).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851871645


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139127/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user functions

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r642940513



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala
##########
@@ -109,6 +112,11 @@ case class GetCurrentDatabaseAndCatalog(catalogManager: CatalogManager) extends
         Literal.create(currentNamespace, StringType)
       case CurrentCatalog() =>
         Literal.create(currentCatalog, StringType)

Review comment:
       like this, we should pre-calculate the current user before transforming the query plan.




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852199653


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139168/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852151920


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139162/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851985810


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43669/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852268290


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43691/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852144161


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139149/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852007059


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43669/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852063022


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43675/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852193849


   **[Test build #139155 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139155/testReport)** for PR 32718 at commit [`81b99ad`](https://github.com/apache/spark/commit/81b99ad935a89c8fc0ead4eb8a3c226747d3c372).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852790306


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139191/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-853009414


   thanks, merging to master!


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852194325


   **[Test build #139168 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139168/testReport)** for PR 32718 at commit [`ca09373`](https://github.com/apache/spark/commit/ca093735eeca693ac4749bedaeb1c54735848fdd).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852144161


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139149/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852063022


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43675/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851871645


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139127/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851863297


   **[Test build #139127 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139127/testReport)** for PR 32718 at commit [`ae337c1`](https://github.com/apache/spark/commit/ae337c13b7648c2011976eb8bef4fd8e67fcf44d).
    * This patch **fails Spark unit tests**.
    * This patch merges cleanly.
    * This patch adds the following public classes _(experimental)_:
     * `case class CurrentUser() extends LeafExpression with Unevaluable `
     * `case class ReplaceCurrentLike(catalogManager: CatalogManager) extends Rule[LogicalPlan] `


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851767500


   **[Test build #139127 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139127/testReport)** for PR 32718 at commit [`ae337c1`](https://github.com/apache/spark/commit/ae337c13b7648c2011976eb8bef4fd8e67fcf44d).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852211002


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43682/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] yaooqinn commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852657980


   retest this please


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852146928


   **[Test build #139162 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139162/testReport)** for PR 32718 at commit [`2dd229d`](https://github.com/apache/spark/commit/2dd229ddfe485a4a84dbee604fdd2b5bd0e08c45).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852199653


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139168/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852194325


   **[Test build #139168 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139168/testReport)** for PR 32718 at commit [`ca09373`](https://github.com/apache/spark/commit/ca093735eeca693ac4749bedaeb1c54735848fdd).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851782661


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43647/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] HyukjinKwon commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r642758972



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala
##########
@@ -40,6 +40,12 @@ class MiscFunctionsSuite extends QueryTest with SharedSparkSession {
       Row(SPARK_VERSION_SHORT + " " + SPARK_REVISION))
     assert(df.schema.fieldNames === Seq("version()"))
   }
+
+  test("get current_user and session_user in normal spark apps") {

Review comment:
       shall we add the JIRA prefix?




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852028542


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43669/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852284158


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43691/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851955826


   **[Test build #139149 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139149/testReport)** for PR 32718 at commit [`f935a32`](https://github.com/apache/spark/commit/f935a322387b5e42d2de7721b92736f6d6b987ae).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851802395


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43647/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852238342


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43682/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r642924784



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala
##########
@@ -109,6 +112,11 @@ case class GetCurrentDatabaseAndCatalog(catalogManager: CatalogManager) extends
         Literal.create(currentNamespace, StringType)
       case CurrentCatalog() =>
         Literal.create(currentCatalog, StringType)
+      case CurrentUser() =>
+        val currentUser = SparkContext.getActive.map { sc =>

Review comment:
       nit:
   ```
   SparkContext.getActive.flatMap { sc =>
     Option(sc.getLocalProperty(SESSION_USER_KEY))
   }.getOrElse(Utils.getCurrentUserName())
   ```




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852692892


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43711/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852284158


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43691/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r643063853



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala
##########
@@ -98,17 +101,21 @@ object ComputeCurrentTime extends Rule[LogicalPlan] {
  * Replaces the expression of CurrentDatabase with the current database name.
  * Replaces the expression of CurrentCatalog with the current catalog name.
  */
-case class GetCurrentDatabaseAndCatalog(catalogManager: CatalogManager) extends Rule[LogicalPlan] {
+case class ReplaceCurrentLike(catalogManager: CatalogManager) extends Rule[LogicalPlan] {

Review comment:
       after this renaming, I think current_date etc. should also be calculated here. We can do it in a followup.




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851802395


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43647/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852790306


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139191/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852658866


   **[Test build #139191 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139191/testReport)** for PR 32718 at commit [`5b0aaaa`](https://github.com/apache/spark/commit/5b0aaaad661f10fd8e9b3dd9a43da9e9f9078f20).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851767500


   **[Test build #139127 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139127/testReport)** for PR 32718 at commit [`ae337c1`](https://github.com/apache/spark/commit/ae337c13b7648c2011976eb8bef4fd8e67fcf44d).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852240704


   **[Test build #139171 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139171/testReport)** for PR 32718 at commit [`5b0aaaa`](https://github.com/apache/spark/commit/5b0aaaad661f10fd8e9b3dd9a43da9e9f9078f20).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852238342


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43682/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852205563


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/43688/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852196016


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/139155/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] yaooqinn commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r643098128



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala
##########
@@ -98,17 +101,21 @@ object ComputeCurrentTime extends Rule[LogicalPlan] {
  * Replaces the expression of CurrentDatabase with the current database name.
  * Replaces the expression of CurrentCatalog with the current catalog name.
  */
-case class GetCurrentDatabaseAndCatalog(catalogManager: CatalogManager) extends Rule[LogicalPlan] {
+case class ReplaceCurrentLike(catalogManager: CatalogManager) extends Rule[LogicalPlan] {

Review comment:
       ok, marked




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852705791


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43711/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852244924


   **[Test build #139171 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139171/testReport)** for PR 32718 at commit [`5b0aaaa`](https://github.com/apache/spark/commit/5b0aaaad661f10fd8e9b3dd9a43da9e9f9078f20).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA removed a comment on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852030297


   **[Test build #139155 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139155/testReport)** for PR 32718 at commit [`81b99ad`](https://github.com/apache/spark/commit/81b99ad935a89c8fc0ead4eb8a3c226747d3c372).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-851955826


   **[Test build #139149 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/139149/testReport)** for PR 32718 at commit [`f935a32`](https://github.com/apache/spark/commit/f935a322387b5e42d2de7721b92736f6d6b987ae).


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan closed pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #32718:
URL: https://github.com/apache/spark/pull/32718


   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] SparkQA commented on pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32718:
URL: https://github.com/apache/spark/pull/32718#issuecomment-852059214


   Kubernetes integration test unable to build dist.
   
   exiting with code: 1
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/43675/
   


-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user and session_user functions

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r642887270



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
##########
@@ -283,3 +283,21 @@ case class TypeOf(child: Expression) extends UnaryExpression {
 
   override protected def withNewChildInternal(newChild: Expression): TypeOf = copy(child = newChild)
 }
+
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+  usage = """_FUNC_() - Return the current user who is running SparkContext for current query execution.""",

Review comment:
       As a SQL function, we need to be engine-agnostic and define the semantic without Spark.




-- 
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:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on a change in pull request #32718: [SPARK-21957][SQL] Support current_user function

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #32718:
URL: https://github.com/apache/spark/pull/32718#discussion_r643114642



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CurrentUserContext.scala
##########
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.catalyst
+
+import org.apache.spark.util.Utils
+
+object CurrentUserContext {
+  val CURRENT_USER: InheritableThreadLocal[String] = new InheritableThreadLocal[String] {
+    override protected def initialValue(): String = Utils.getCurrentUserName()

Review comment:
       The default value can be null.




-- 
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:
users@infra.apache.org



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