You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/05/23 23:16:19 UTC

[GitHub] [calcite] julianhyde commented on a change in pull request #973: [CALCITE-2742] Update USER and SYSTEM_USER to use DataContext for value

julianhyde commented on a change in pull request #973: [CALCITE-2742] Update USER and SYSTEM_USER to use DataContext for value
URL: https://github.com/apache/calcite/pull/973#discussion_r287167196
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java
 ##########
 @@ -1951,6 +1952,20 @@ public static TimeZone timeZone(DataContext root) {
     return (TimeZone) DataContext.Variable.TIME_ZONE.get(root);
   }
 
+  /** SQL {@code USER} function. */
+  @NonDeterministic
+  public static String user(DataContext root) {
+    return Optional.ofNullable((String) DataContext.Variable.USER.get(root))
+        .orElse("sa");
+  }
+
+  /** SQL {@code SYSTEM_USER} function. */
+  @NonDeterministic
 
 Review comment:
   Conceivably (I know it's a stretch) a query could be prepared by one user and executed by another. The NonDeterministic prevents constant-reduction.

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


With regards,
Apache Git Services