codeant-ai-for-open-source[bot] commented on PR #38683:
URL: https://github.com/apache/superset/pull/38683#issuecomment-4071486298
## **Sequence Diagram**
This PR changes RLS handling to avoid unnecessary SQL reformatting and to
preserve valid column resolution. SQL is only regenerated when RLS predicates
are actually applied, and subquery aliases now use the base table name so
qualified column references continue to work.
```mermaid
sequenceDiagram
participant QueryFlow
participant SQLHandler
participant RLSEngine
participant SQLTransformer
QueryFlow->>SQLHandler: Build SQL for virtual or adhoc query
SQLHandler->>RLSEngine: Apply RLS to parsed statement
RLSEngine->>SQLTransformer: Wrap table with filtered subquery using
table name alias
SQLTransformer-->>RLSEngine: Updated statement
RLSEngine-->>SQLHandler: Return rls applied true or false
alt RLS applied
SQLHandler->>SQLHandler: Regenerate SQL from updated AST
else No RLS predicates
SQLHandler->>SQLHandler: Keep original SQL text unchanged
end
SQLHandler-->>QueryFlow: Return final SQL for execution
```
---
*Generated by [CodeAnt AI](https://codeant.ai)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]