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

    https://github.com/apache/spark/pull/14568#discussion_r74437337
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/MonotonicallyIncreasingID.scala
 ---
    @@ -40,13 +42,23 @@ import org.apache.spark.sql.types.{DataType, LongType}
           represent the record number within each partition. The assumption is 
that the data frame has
           less than 1 billion partitions, and each partition has less than 8 
billion records.""",
       extended = "> SELECT _FUNC_();\n 0")
    -case class MonotonicallyIncreasingID() extends LeafExpression with 
Nondeterministic {
    +case class MonotonicallyIncreasingID(offset: Long = 0) extends 
LeafExpression
    +  with Nondeterministic with Logging {
    +
    +  def this() = {
    +    this(offset = 0)
    +  }
    +
    +  def this(offset: Expression) = {
    +    this(offset = MonotonicallyIncreasingID.parseExpression(offset))
    +    logDebug(s"offset is $offset")
    +  }
     
       /**
    -   * Record ID within each partition. By being transient, count's value is 
reset to 0 every time
    -   * we serialize and deserialize and initialize it.
    +   * Record ID within each partition. By being transient, count's value is 
reset to offset every
    +   * time we serialize and deserialize and initialize it.
        */
    -  @transient private[this] var count: Long = _
    +  @transient private[this] var count: Long = offset
    --- End diff --
    
    This probably does not work. You need to set the value in the 
`MonotonicallyIncreasingID.initInternal()`. This is why your tests are failing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to