Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[coral-hive] Add support for Hive logged_in_user() function #418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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