Zouxxyy opened a new pull request, #10231:
URL: https://github.com/apache/paimon/pull/10231

   ### Purpose
   
   `CREATE OR REPLACE VIEW v AS SELECT * FROM v` can analyze the old definition 
and then persist a recursive Paimon view. Reading the stored definition 
subsequently recurses until `StackOverflowError`.
   
   Validate the original SQL before replacing metadata, preserving the existing 
definition when a cycle is found. Also reject legacy persisted cycles during 
resolution and report their dependency path. Paimon expands views without 
retaining Spark's logical `View` nodes, so the checker follows stored SQL 
dependencies, including nested subqueries and CTEs, and respects catalog 
identifier case sensitivity.
   
   The guard points follow Spark's 
[ViewHelper](https://github.com/apache/spark/blob/v4.1.2/sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala)
 and 
[ViewResolution](https://github.com/apache/spark/blob/v4.1.2/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ViewResolution.scala).
 A separate internal checker enforces `spark.sql.view.maxNestedViewDepth` and 
reuses validated subtree depths only within one resolver traversal. This avoids 
repeatedly scanning a nested view chain while still checking shared 
dependencies reached through deeper paths.
   
   ### Tests
   
   - `PaimonViewTest`: 20 tests passed on each of Spark 3.5 / Java 8, Spark 4.0 
/ Java 17, and Spark 4.1 / Java 17.
   - Covers direct and indirect cycles, legacy persisted cycles and recovery, 
EXISTS/IN/scalar subqueries, CTE dependencies, mixed-case identifiers, valid 
CTE shadowing, and shared dependencies.
   - Regression coverage bounds catalog lookups for a nested view chain, 
detects metadata changes on the next resolver invocation, and checks nesting 
limits through shared dependencies.
   - Final Spark 3 and Spark 4 Maven test builds passed with Checkstyle and 
Spotless enabled.
   - For the local Spark 4.1 run, only the generated test Hive configuration 
used port 19092 because port 9092 was occupied.
   


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

Reply via email to