apache-spark - 个性化 monotonically_increasing_id 火花
问题描述
我有几个数据框,我想唯一标识每个数据框中的每一行。因此我想使用个性化的 Ids 。我在 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、TB2_ID 等设置一个 TB1_ID 。任何我知道如何做到这一点。此致
解决方案
推荐阅读
- excel - 如何将组合框的值保存在单独的工作表中?
- python - python中的学生姓名和标记类-定义时出现未定义错误
- laravel - cURL 错误 60:无法识别对等方的证书颁发者。使用 Laravel 通知
- python-3.x - 如何使颜色图与 DataFrame 的列匹配?
- wordpress - 如果我使用 AWS 托管,我的 wordpress 博客网站是否安全?
- flutter - 如何修复水平视口被赋予了无限的高度
- eloqua - Eloqua 联系人 ID 的格式是什么?
- sql - BigQuery:如何找到按比例缩放的平均每周销售额?
- javascript - 如何从我的电报频道获取个人资料照片?
- apexcharts - 在 Apexcharts 中设置图表的高度