zhang-arvin opened a new pull request, #18105:
URL: https://github.com/apache/iceberg/pull/18105

   ## Purpose
   
   Fixes #18103. Resolves flaky test failures in `TestViews` caused by 
colliding temporary function names.
   
   ## Root cause
   
   `viewName()` generated suffixes with `new Random().nextInt(1000000)`, which 
can produce duplicate names across the parameterized catalog runs of the same 
SparkSession (e.g. `readFromViewReferencingTempFunction` creates a temporary 
function named `viewName("test_avg")` on each catalog and never drops it), 
leading to `ROUTINE_ALREADY_EXISTS` errors. The same pattern exists in 
`createViewReferencingTempFunction` and 
`createViewReferencingQualifiedTempFunction` for Spark 3.5 / 4.0 / 4.1 / 4.2.
   
   ## Fix
   
   Replace the random suffix with a process-unique monotonically increasing 
`AtomicInteger` counter (`NAME_SUFFIX.incrementAndGet()`), so names can never 
collide within a JVM run and the `java.util.Random` import is removed. This 
also applies to the shared `viewName()` helper used by all other view tests.
   
   Files changed:
   - spark/v3.5/spark-extensions/.../TestViews.java
   - spark/v4.0/spark-extensions/.../TestViews.java
   - spark/v4.1/spark-extensions/.../TestViews.java
   - spark/v4.2/spark-extensions/.../TestViews.java


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