Michael Smith has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/24165 )
Change subject: IMPALA-14875: Make a Preconditions check case-insensitive in authorize() ...................................................................... IMPALA-14875: Make a Preconditions check case-insensitive in authorize() In IMPALA-14507, we slightly revised a Preconditions check that requires each column-level privilege request has at least one respective table-level privilege request. However, we found that this introduced a regression due to which the check would fail in the local catalog mode if the name of the target table in the CREATE TABLE AS SELECT statement contains uppercase letters. For instance, a query like the following would fail in the local catalog mode. create table alltypes_A as select int_col from functional.alltypes; One root cause of this was that during the registration of the column-level INSERT privilege in InsertStmt#analyze(), table_.getTableName().getTbl() would still contain uppercase letters in the local catalog mode. As a result, during the Preconditions check in BaseAuthorizationChecker#authorize(), the key of the same table in the map from table name to the associated table-level privilege requests did not match that in the map from table name to the associated column-level privilege requests, causing the check to fail. In our example, the key of the target table in the former map would end with "alltypes_a", whereas that of the latter map ended with "alltypes_A". To fix the issue, this patch lowercases the table name when constructing the 2 maps above. On a related note, the issue only affected the CTAS statement but not the INSERT statement. This is because during the analysis of the CTAS statement in the local catalog mode, we create a temporary target table 'table_' such that table_.getTableName().getTbl() could still contain uppercase letters and then call InsertStmt#analyze() with 'table_' being the target table. For the INSERT statement, the name of the target table is already lowercased for both catalog modes. Testing: - Added test cases to verify that a CTAS statement could pass the Preconditions check even though the name of target table has capital letters. Change-Id: Idfae24a7de8da683bc0bf28a947188ab96481301 Reviewed-on: http://gerrit.cloudera.org:8080/24165 Reviewed-by: Yida Wu <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Reviewed-by: Michael Smith <[email protected]> --- M fe/src/main/java/org/apache/impala/authorization/BaseAuthorizationChecker.java M testdata/workloads/functional-query/queries/QueryTest/create-table-as-select.test 2 files changed, 29 insertions(+), 4 deletions(-) Approvals: Yida Wu: Looks good to me, but someone else must approve Impala Public Jenkins: Verified Michael Smith: Looks good to me, approved -- To view, visit http://gerrit.cloudera.org:8080/24165 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Idfae24a7de8da683bc0bf28a947188ab96481301 Gerrit-Change-Number: 24165 Gerrit-PatchSet: 3 Gerrit-Owner: Fang-Yu Rao <[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]>
