Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ public boolean isOptional(int i) {

// Context functions
addFunctionEntry("current_user", CURRENT_USER);
createAddUserDefinedFunction("logged_in_user", FunctionReturnTypes.STRING, NILADIC);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017-2022 LinkedIn Corporation. All rights reserved.
* Copyright 2017-2023 LinkedIn Corporation. All rights reserved.
* Licensed under the BSD-2 Clause license.
* See LICENSE in the project root for license information.
*/
Expand Down Expand Up @@ -633,6 +633,14 @@ public void testNameSakeColumnNamesShouldGetUniqueIdentifiers() {
assertEquals(generated, expected);
}

@Test
public void testLoggedInUser() {
final String sql = "SELECT logged_in_user() as liu";
String generated = relToString(sql);
final String expected = "LogicalProject(liu=[logged_in_user()])\n LogicalValues(tuples=[[{ 0 }]])\n";
assertEquals(generated, expected);
}

private String relToString(String sql) {
return RelOptUtil.toString(converter.convertSql(sql));
}
Expand Down