zstan commented on code in PR #6314:
URL: https://github.com/apache/ignite-3/pull/6314#discussion_r2241688940


##########
modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItSqlOperatorsTest.java:
##########
@@ -400,6 +403,22 @@ public void testCurrentTimeFunctions() {
         assertExpression("LOCALTIMESTAMP").check();
     }
 
+    @Test
+    public void testCurrentUser() {
+        assertExpression("CURRENT_USER")
+                .returns(Commons.SYSTEM_USER_NAME)
+                .columnMetadata(new MetadataMatcher().type(ColumnType.STRING))
+                .check();
+
+        sql("CREATE TABLE t1 (id INT PRIMARY KEY, val VARCHAR)");
+        sql("INSERT INTO t1 (id, val) VALUES (1, CURRENT_USER)");
+
+        assertQuery("SELECT val FROM t1 WHERE val = CURRENT_USER")
+                .returns(Commons.SYSTEM_USER_NAME)
+                .columnMetadata(new MetadataMatcher().type(ColumnType.STRING))
+                .check();

Review Comment:
   seems this part is not related to Operators at all and duplicated in 
existing tests, or i miss smth ?



##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcConnectionContext.java:
##########
@@ -45,22 +45,30 @@ class JdbcConnectionContext {
 
     private final ZoneId timeZoneId;
 
+    private final String userName;
+
     private final ConcurrentMap<Long, CancelHandle> cancelHandles = new 
ConcurrentHashMap<>();
 
     private @Nullable TxWithTimeTracker txWithTimeTracker;
 
     JdbcConnectionContext(
             TxManager txManager,
-            ZoneId timeZoneId
+            ZoneId timeZoneId,
+            String userName

Review Comment:
   ```suggestion
               @Nullable String userName
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/IgniteSqlImpl.java:
##########
@@ -660,7 +661,8 @@ private static SqlProperties toPropertiesBuilder(Statement 
statement) {
         return new SqlProperties()
                 .timeZoneId(statement.timeZoneId())
                 
.defaultSchema(IgniteNameUtils.parseIdentifier(statement.defaultSchema()))
-                .queryTimeout(statement.queryTimeout(TimeUnit.MILLISECONDS));
+                .queryTimeout(statement.queryTimeout(TimeUnit.MILLISECONDS))
+                .userName(Commons.SYSTEM_USER_NAME);

Review Comment:
   is it possible to move it into SqlProperties class with common default 
params initialization ? i.e.:
   ```
   public class SqlProperties {
       private String defaultSchema = SqlCommon.DEFAULT_SCHEMA_NAME;
       ...
       private @Nullable String userName = Commons.SYSTEM_USER_NAME; ??
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlOperationContext.java:
##########
@@ -104,6 +107,10 @@ public ZoneId timeZoneId() {
         return timeZoneId;
     }
 
+    public @Nullable String userName() {

Review Comment:
   javadoc is still helpful



##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcConnectionContext.java:
##########
@@ -45,22 +45,30 @@ class JdbcConnectionContext {
 
     private final ZoneId timeZoneId;
 
+    private final String userName;
+
     private final ConcurrentMap<Long, CancelHandle> cancelHandles = new 
ConcurrentHashMap<>();
 
     private @Nullable TxWithTimeTracker txWithTimeTracker;
 
     JdbcConnectionContext(
             TxManager txManager,
-            ZoneId timeZoneId
+            ZoneId timeZoneId,
+            String userName
     ) {
         this.txManager = txManager;
         this.timeZoneId = timeZoneId;
+        this.userName = userName;
     }
 
     ZoneId timeZoneId() {
         return timeZoneId;
     }
 
+    String userName() {

Review Comment:
   ```suggestion
       @Nullable String userName() {
   ```



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

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to