I have data like this:
| Date | Ident |
|---|---|
| 01.02.2002 | AAA_111111 |
| 01.02.2002 | BBB_222222 |
I count duplicates and write result in csv files my code like this:
(df.groupBy("Date", "Ident")
.agg(functions.count("*")))
.orderBy(functions.to_date(functions.column("Date"), "dd.MM.yyyy").cast(DateType).asc)
.write.format("csv").save(pathResult)
If df approximate size 100 lines, each file contains data about one date. Like this:
02.05.2020,AAA_111111,1
02.05.2020,AAA_111112,1
02.05.2020,AAA_111113,2
02.05.2020,AAA_111114,1
02.05.2020,AAA_111115,1
If df approximate size 10000 lines, each file contains data about few date. Like this:
02.05.2020,AAA_111111,1
02.05.2020,AAA_111112,1
.......................
03.05.2020,AAB_111113,2
03.05.2020,AAB_111114,1
.......................
04.05.2020,AAC_111115,1
Can use partitionBy("Date"), but this will create separate folders for each day, and remove the "Date" data from the csv
Is it possible to write data about only one "Date" to one file, without using partitionBy()?
I would like to get data about only one date in one file for any df size.