Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20861#discussion_r204272567
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ---
    @@ -1994,6 +1996,20 @@ class Analyzer(
         }
       }
     
    +  /**
    +   * Set the seed for random number generation in Uuid expressions.
    +   */
    +  object ResolvedUuidExpressions extends Rule[LogicalPlan] {
    +    private lazy val random = new Random()
    +
    +    override def apply(plan: LogicalPlan): LogicalPlan = plan.transformUp {
    +      case p if p.resolved => p
    +      case p => p transformExpressionsUp {
    +        case Uuid(None) => Uuid(Some(random.nextLong()))
    --- End diff --
    
    One thing I think is, is any use case that we need to re-initialize random 
seed for `Rand`? Maybe streaming? For streaming query, I think `Rand` should 
use different random seed in each execution. For now, the random seed is 
initialized when constructing, even we re-analyze the query, it still uses same 
seed.
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to