-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(api-gateway): make sure DAP works with sql pushdown #9021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| if (hasExpressionsInQuery) { | ||
| rewrittenQuery = this.evalMemberExpressionsInQuery(rewrittenQuery); | ||
| if (this.hasExpressionsInQuery(rewrittenQuery)) { | ||
| rewrittenQuery = this.parseMemberExpressionsInQuery(rewrittenQuery); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not yet checked yet what can applyRowLevelSecurity introduce
But parseMemberExpressionsInQuery is not enough anyway.
There's three states of member expressions:
-
MemberExpression
Object withexpressionmethod, that takes cubes as symbols and returns SQL -
ParsedMemberExpression
Object withexpressionas array of strings. Essentially JSON-compatible way of storingMemberExpression -
Just a string with JSON-serialzed
ParsedMemberExpression.
Schema compiler expects only MemberExpression.
parseMemberExpressionsInQuery turns strings in proper places in query to ParsedMemberExpression.
evalMemberExpressionsInQuery turns ParsedMemberExpression to MemberExpression in those places.
So, depending on what applyRowLevelSecurity can add either only evalMemberExpressionsInQuery, or both of parseMemberExpressionsInQuery + evalMemberExpressionsInQuery are necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expression: () => '1 = 0',
That's MemberExpression, with expression as method, returning SQL. For this case no need to add any additional calls after applyRowLevelSecurity
String member expression would look like something this: query.segments.push('{"cubeName":"foo","expr":"1=0"}');
This would require to add both calls to parse and eval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've removed all my previous comments and just added the eval. Looks like it should be fine now
| const normalizedQuery = normalizeQuery(currentQuery, persistent); | ||
| let normalizedQuery = normalizeQuery(currentQuery, persistent); | ||
|
|
||
| if (hasExpressionsInQuery) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add comment about why early/second call is necessary. I'll probably forget about this whole issue next week 😅
75f8708 to
b7bd8b6
Compare
fixes an issue when processing queries with member expressions
b7bd8b6 to
33c1659
Compare
fixes an issue when processing queries with member expressions
Check List
Issue Reference this PR resolves
[For example #12]
Description of Changes Made (if issue reference is not provided)
[Description goes here]