我想根据列ID删除重复的行。我怎样才能得到有重复“ID”的丢弃的数据?这是我现在正在处理的代码。根据列火花数据帧得到重复的行
val datatoBeInserted = data.select("id", "is_enabled", "code", "description", "gamme", "import_local", "marque", "type_marketing", "reference", "struct", "type_tarif", "family_id", "range_id", "article_type_id")
val cleanedData = datatoBeInserted.dropDuplicates("id")
使用上面的查询,cleanData将给出没有“id”重复的所有行。现在,我想知道哪些行因为重复而被过滤掉。
你尝试'dataToBeInserted.except(cleanedData)'? – philantrovert
@philantrovert请回答这个问题:) –
@RameshMaharjan我把它标记为重复:) – philantrovert