[ 
https://issues.apache.org/jira/browse/IMPALA-14875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18070974#comment-18070974
 ] 

ASF subversion and git services commented on IMPALA-14875:
----------------------------------------------------------

Commit b650fda439c578d4067bfbc5694c348cb8a8c4e6 in impala's branch 
refs/heads/master from Fang-Yu Rao
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=b650fda43 ]

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


> CREATE TABLE AS SELECT could fail a Preconditions check added in IMPALA-14507
> -----------------------------------------------------------------------------
>
>                 Key: IMPALA-14875
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14875
>             Project: IMPALA
>          Issue Type: Bug
>    Affects Versions: Impala 5.0.0
>            Reporter: Fang-Yu Rao
>            Assignee: Fang-Yu Rao
>            Priority: Blocker
>              Labels: broken-build
>             Fix For: Impala 5.0.0
>
>
> We found that CREATE TABLE AS SELECT could fail a Preconditions check added 
> in IMPALA-14507. We could reproduce the issue by executing the following in 
> impala-shell.
> - create database test_db_100.
> - create database config_ueeevc.
> - CREATE EXTERNAL TABLE config_ueeevc.employee (emp_id INT, name STRING, 
> start_date DATE, quit_date DATE, quit_flag STRING) STORED AS PARQUET 
> TBLPROPERTIES ('OBJCAPABILITIES'='EXTREAD,EXTWRITE', 
> 'TRANSLATED_TO_EXTERNAL'='TRUE', 'external.table.purge'='TRUE').
> - CREATE TABLE test_db_100.employee_A STORED AS PARQUET 
> TBLPROPERTIES('transactional'='false') AS SELECT * FROM 
> config_ueeevc.employee;
> Query: CREATE TABLE test_db_100.employee_A STORED AS PARQUET 
> TBLPROPERTIES('transactional'='false') AS SELECT * FROM 
> config_ueeevc.employee.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to