-
Notifications
You must be signed in to change notification settings - Fork 0
/
RewriteLogic
36 lines (17 loc) · 879 Bytes
/
RewriteLogic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Input Query:
~/Desktop/rambo/presto --server localhost:8082 --catalog hive --schema default --execute "Select * from userdb.table2 ";
First code checks whether its case of impersonation and if it is then if the user is truster user
Need API here
DBSTableKeeper is called
-------
private static final String TABLE_NAME_PREFIX = "__DBS_t";
private static final Pattern UNION_SPLIT_PATTERN = Pattern.compile("(?i)UNION");
private static final Pattern GENERATED_VIEW_PATTERN = Pattern.compile("(?i)select[\\s]+DBS[\\s]+from[\\s]+__DBS_t[0-9]+");
----------------------------
It calls DBSRowFilterColumnMaskRewrite
we get query :
SELECT * FROM ( SELECT DBS FROM __DBS_t1 ) table2
which is replaced to :
var 20 is hardcode to APS (there is connection to policy iengine and query is sent to PE)
SELECT * FROM ( APS ) table2
query re-wrote to