This shows you the differences between two versions of the page.
spark_cookbook [2019/02/14 10:44] mantis created |
spark_cookbook [2019/02/14 10:45] mantis |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Adding unique id to Dataframe ====== | ====== Adding unique id to Dataframe ====== | ||
+ | using this [[https://spark.apache.org/docs/2.4.0/api/java/org/apache/spark/sql/functions.html#monotonically_increasing_id--|function]] | ||
<code scala> | <code scala> | ||
.toDF().withColumn("uid", monotonically_increasing_id) | .toDF().withColumn("uid", monotonically_increasing_id) | ||
</code> | </code> |