Jacek, A non-deterministic expression usually holds some state. The Nondeterministic trait makes sure a user can initialize this state properly. Take a look at InterpretedProjection <https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Projection.scala#L66-L69> for instance.
HTH -Herman On Fri, Sep 23, 2016 at 8:28 AM, Jacek Laskowski <ja...@japila.pl> wrote: > Hi, > > Just came across the Expression trait [1] that can be check for > determinism by the method deterministic [2] and trait Nondeterministic > [3]. Why both? > > [1] https://github.com/apache/spark/blob/master/sql/ > catalyst/src/main/scala/org/apache/spark/sql/catalyst/ > expressions/Expression.scala#L53 > [2] https://github.com/apache/spark/blob/master/sql/ > catalyst/src/main/scala/org/apache/spark/sql/catalyst/ > expressions/Expression.scala#L80 > [3] https://github.com/apache/spark/blob/master/sql/ > catalyst/src/main/scala/org/apache/spark/sql/catalyst/ > expressions/Expression.scala#L271 > > Pozdrawiam, > Jacek Laskowski > ---- > https://medium.com/@jaceklaskowski/ > Mastering Apache Spark 2.0 http://bit.ly/mastering-apache-spark > Follow me at https://twitter.com/jaceklaskowski > > --------------------------------------------------------------------- > To unsubscribe e-mail: dev-unsubscr...@spark.apache.org > >