Re: Naming files while saving a Dataframe

2021-07-17 Thread Eric Beabes
Reason we've two jobs writing to the same directory is that the data is partitioned by 'day' (mmdd) but the job runs hourly. Maybe the only way to do this is to create an hourly partition (/mmdd/hh). Is that the only way to solve this? On Fri, Jul 16, 2021 at 5:45 PM ayan guha wrote: > I

Re: Naming files while saving a Dataframe

2021-07-17 Thread Mich Talebzadeh
Jobs have names in spark. You can prefix it to the file name when writing to directory I guess val sparkConf = new SparkConf(). setAppName(sparkAppName). view my Linkedin profile *Disclaimer:* Use it at your own r

Re: Naming files while saving a Dataframe

2021-07-17 Thread Eric Beabes
I am not sure if you've understood the question. Here's how we're saving the DataFrame: df .coalesce(numFiles) .write .partitionBy(partitionDate) .mode("overwrite") .format("parquet") .save(*someDirectory*) Now where would I add a 'prefix' in this one? On Sat, Jul 17, 2021 at 10:5

Re: Naming files while saving a Dataframe

2021-07-17 Thread ayan guha
Hi Eric - yes that maybe the best way to resolve this. I have not seen any specific way to define names of the actual files written by spark. Finally, make sure you optimize number of files written. On Sun, Jul 18, 2021 at 2:39 AM Eric Beabes wrote: > Reason we've two jobs writing to the same di

Re: Naming files while saving a Dataframe

2021-07-17 Thread Mich Talebzadeh
Using this df.write.mode("overwrite").format("parquet").saveAsTable("test.ABCD") That will create a parquet table in the database test. which is essentially a hive partition in the format /user/hive/warehouse/test.db/abcd/00_0 view my Linkedin profile

Re: Naming files while saving a Dataframe

2021-07-17 Thread Eric Beabes
Mich - You're suggesting changing the "Path". Problem is that, we've an EXTERNAL table created on top of this path so "Path" CANNOT change. If we could, it would be easy to solve this problem. My question is about changing the "Filename". As Ayan pointed out, Spark doesn't seem to allow "prefixes"