个性化monotonically_increasing_id火花

时间:2018-07-06 15:34:22

标签: apache-spark uuid

我有几个数据框,我想唯一地标识每个数据框中的每一行。因此,我想使用个性化ID。 我在spark中使用monotonically_increasing_id()内置函数,如下所示:

import org.apache.spark.sql.functions._
val dfWithId = trzuCom.withColumn("UniqueID", monotonically_increasing_id)

问题是,当我尝试如下个性化设置时:

val dfWithId = trzuCom.withColumn("UniqueID", "TB1_" + monotonically_increasing_id)

我遇到错误。 实际上,我想为数据帧1提供TB1_ID,而为TB2_ID这样一个。任何我想如何做到这一点。 最好的问候

0 个答案:

没有答案