We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
val duplicates = df .select(<pk cols>) .withColumn("__file_path", col("_metadata.file_path")) .withColumn("__row_index", col("_metadata.row_index")) .withColumn( "rank", row_number().over( Window() .partitionBy(<pk cols>) .orderBy(<pk cols>))) .filter("rank > 1") .drop("rank")
And then:
df.alias("old") .merge( duplicates.alias("new"), "old.<pk1> = new.<pk1> AND ... AND old.<pkn> = new.<pkn>" + " AND old._metadata.file_path = new.__file_path" + " AND old._metadata.row_index = new.__row_index") .whenMatchedDelete() .execute()
The text was updated successfully, but these errors were encountered:
@MrPowers - When you say it does not require a primary key, do you mean that we can infer the primary key ?
Sorry, something went wrong.
No branches or pull requests
And then:
The text was updated successfully, but these errors were encountered: