Use less restrictive column access checks when using transform and cardinality functions#18840
Conversation
1873e22 to
dfacc65
Compare
transform and cardinality functions
|
[ RUN ] TaskManagerTest.outOfQueryUserMemory This is fixed in #18842 |
rschlussel
left a comment
There was a problem hiding this comment.
can you add access control tests too (create a test access control with some column restrictions and confirm you don't get an exception if accessing allowed subfields or using cardinality function.)
There was a problem hiding this comment.
why? why not use recursion to go into all of them?
There was a problem hiding this comment.
This part is moved from ExpressionAnalyzer as well. This function is called once for each dereference, when multiple dereferences are nested. So, we have this check that only looks at the dereference chain once.
There was a problem hiding this comment.
i think all the different cases here are a bit confusing. Needs some comments, but I think it would be clearer if written as a visitor instead of a while loop with each case determining whether to continue the loop. It would also be easy to introduce an infinite loop in this logic(continue gets called without the child nod getting updated to something that would break the loop eventually)
There was a problem hiding this comment.
I don't want to modify this logic in this PR. This is an existing logic moved from ExpressionAnalyzer to here, which is already tested. I can put up a todo to refactor it.
There was a problem hiding this comment.
got it. I guess it's okay since the code already existed. would be good to refactor though as a follow up.
presto-main/src/test/java/com/facebook/presto/sql/analyzer/TestColumnAndSubfieldAnalyzer.java
Outdated
Show resolved
Hide resolved
c653678 to
19221f3
Compare
19221f3 to
7d7bf4e
Compare
Commit 1:
When doing subfield access checks in sql like
transform(a, col -> col.x).We previously checked for permission of column
a.After this PR, we will check for permission of column
a.x.To do this, we need to do 2 things:
colto table columnafor access checksaThis PR does both for them.
These cases are hardcoded just for the
transformfunction. Adding other functions to these checks is easier, as demonstrated in commit 2, where we skip the check completely forcardinalityfunction.