j1wonpark opened a new pull request, #7747:
URL: https://github.com/apache/kyuubi/pull/7747

   ### Why are the changes needed?
   
   Fixes #7746.
   
   `PermanentViewMarker` is a `LeafNode`, so `QueryPlan.deterministic` reports 
`true` for any
   permanent view, even one over `rand()`, `uuid()` or `reflect()`. `InlineCTE` 
reads that flag and
   inlines a nondeterministic view CTE that is referenced more than once, so 
each reference
   recomputes the view and, for expressions that draw a fresh value per 
evaluation, the references
   disagree. Without authz Spark keeps the CTE out of line and shares one 
`ReusedExchange`.
   
   This overrides `deterministic` to delegate to the wrapped plan. The same 
flag feeds
   `SubqueryExpression.deterministic`, so subqueries over such a view are 
classified the same way
   as without authz.
   
   `override lazy val` compiles against both the `lazy val` in Spark 3.5 and 
the `def` in 4.0+.
   
   ### How was this patch tested?
   
   Two tests in `HiveCatalogRangerSparkExtensionSuite`:
   
   - a `uuid()` view referenced twice through a CTE keeps a 
`RepartitionByExpression` in the
     optimized plan and a `ReusedExchange` in the executed plan;
   - a `reflect('java.util.UUID', 'randomUUID')` view referenced twice through 
a CTE yields the same
     value for both references.
   
   Both fail with `PermanentViewMarker` reverted to master and pass with the 
change, on Spark 3.5.8,
   4.0.3, 4.1.3 and 4.2.0.
   
   ### Was this patch assisted by generative AI tooling?
   
   Assisted-by: Claude Fable 5.1
   


-- 
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]

Reply via email to