Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/24205 )
Change subject: IMPALA-14884: Implement SHOW CURRENT GROUPS statement ...................................................................... IMPALA-14884: Implement SHOW CURRENT GROUPS statement This patch implements the SHOW CURRENT GROUPS statement that could display the groups associated with the current requesting user. This is particularly helpful for troubleshooting authorization-related issues when we suspect there may be something wrong with the user-to-groups mapping. We decided to name the command "SHOW CURRENT GROUPS" because Impala already supports the SHOW CURRENT ROLES statement that displays roles assigned to the current user as described at https://github.com/apache/impala/blob/325dc8b/docs/topics/impala_show.xml#L386-L392 so "SHOW CURRENT GROUPS" may be more intuitive for Impala users to adopt. This also slightly extends how 'struct_field_def' can grow via 'word' so that we could still support the following statement afterward. This changes how 'GROUPS' is parsed. Note that before this patch, it was parsed as an UNUSED_RESERVED_WORD as seen at https://github.com/apache/impala/blob/325dc8b/fe/src/main/jflex/sql-scanner.flex#L578 but with this patch, it is parsed as a keyword at https://github.com/apache/impala/blob/042b915/fe/src/main/jflex/sql-scanner.flex#L576. CREATE TABLE t (i STRUCT<groups:INT>); On a related note, the test case above is at https://github.com/apache/impala/blame/325dc8b/fe/src/test/java/org/apache/impala/analysis/ParserTest.java#L3663-L3671, where we require that a keyword can be a struct-field name. On the other hand, we do not produce the Ranger audit event corresponding to this statement, since the statement is not supported by Apache Hive and hence we do not have a reference implementation in RangerHiveAuthorizer.java as to what resource we should specify in RangerAuthorizationChecker#authorizeResource(). Testing: - Added a frontend parser test and an end-to-end test to verify the statement works as expected. Generated-by: Cursor AI (gemini-3.1-pro) Change-Id: I7d65c6d038e9bb2d56c6c2510eaf52a8c27965c8 Reviewed-on: http://gerrit.cloudera.org:8080/24205 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- M be/src/service/client-request-state.cc M be/src/service/frontend.cc M be/src/service/frontend.h M common/thrift/Frontend.thrift M fe/src/main/cup/sql-parser.cup M fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java A fe/src/main/java/org/apache/impala/analysis/ShowCurrentGroupsStmt.java M fe/src/main/java/org/apache/impala/authorization/ranger/RangerAuthorizationChecker.java M fe/src/main/java/org/apache/impala/authorization/ranger/RangerUtil.java M fe/src/main/java/org/apache/impala/service/Frontend.java M fe/src/main/java/org/apache/impala/service/JniFrontend.java M fe/src/main/jflex/sql-scanner.flex M fe/src/test/java/org/apache/impala/analysis/ParserTest.java A testdata/workloads/functional-query/queries/QueryTest/show_current_groups.test M tests/authorization/test_ranger.py 15 files changed, 176 insertions(+), 17 deletions(-) Approvals: Impala Public Jenkins: Looks good to me, approved; Verified -- To view, visit http://gerrit.cloudera.org:8080/24205 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I7d65c6d038e9bb2d56c6c2510eaf52a8c27965c8 Gerrit-Change-Number: 24205 Gerrit-PatchSet: 12 Gerrit-Owner: Fang-Yu Rao <[email protected]> Gerrit-Reviewer: Abhishek Rawat <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Fang-Yu Rao <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Reviewer: Yida Wu <[email protected]>
