dataframe takes unusually long time to save as a delta table using sql for a very small dataset with 30k rows. It takes around 2hrs. Is there a solution for this problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 10:14 PM
I am trying to save a dataframe after a series of data manipulations using Udf functions to a delta table. I tried using this code
(
df
.write
.format('delta')
.mode('overwrite')
.option('overwriteSchema', 'true')
.saveAsTable('output_table')
)
but this is taking more than 2 hours. So I converted the dataframe into a sql local temp view and tried saving the df as a delta table from that temp view, this worked for one of the notebooks(14 minutes) but for other notebooks this is also taking around 2 hours to write to the delta table. Not sure why this is happening for a very small dataset. Any solution is appreciated.
code:
df.createOrReplaceTempView("sql_temp_view")
%sql
DROP TABLE IF EXISTS default.output_version_2;
create table default.output_version_2
select * from sql_temp_view
- Labels:
-
Long Time
-
Task Running Long