Quanlong Huang created IMPALA-9661:
--------------------------------------
Summary: Avoid introducing unused columns in table masking view
Key: IMPALA-9661
URL: https://issues.apache.org/jira/browse/IMPALA-9661
Project: IMPALA
Issue Type: Bug
Reporter: Quanlong Huang
Assignee: Quanlong Huang
If a table has column masking policies, we replace its unanalyzed TableRef with
an analyzed InlineViewRef (table masking view) in FromClause.analyze().
However, we can't detect which columns are actually used in the original query
at this point. In fact, analyze() for SelectList, WhereClause, GroupByClause
and other clauses containing SlotRefs happen after FromClause.analyze(). After
the whole query block is analyzed, we can get the exact set of required
columns. We should do table masking there to avoid introducing unused columns.
To be specifit, if table _tbl_(_id_ int, _name_ string, _address_ string) has
column masking policies for column _name_ and _address_ to mask them, the
following query
{code:sql}
select name from tbl where id > 10;
{code}
will be rewritten to
{code:sql}
select name from (
select id, mask(name) as name, mask(address) as address from tbl
) tbl where id > 10;
{code}
The rewritten query introduce the requirement for SELECT privilege on the
_address_ column which isn't required by the original query. We should either
fix this or IMPALA-9223.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]