Created
December 21, 2021 23:22
-
-
Save 1ambda/dc778d34024e1ef57fe1c4af862140ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df\ | |
.where(col("brand").isNotNull())\ | |
.groupBy("brand")\ | |
.agg( | |
collect_list("product_id").alias("product_id_list"), | |
size(collect_list("product_id")).alias("product_id_list_count"), | |
collect_set("product_id").alias("product_id_set"), | |
size(collect_set("product_id")).alias("product_id_set_count"), | |
)\ | |
.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment