https://delta.io logo
t

Thanhtan Le

05/14/2023, 3:23 PM
Hello team, I have 1 question. I am using Apache Spark Streaming to run Merge Query to Delta Lake table. My table turn on optimize performance. Meaning after run Merge Query complete, it is automatic run Optimize query. I want to turn of that to improve Streaming batch. How can I turn off this feature ?
g

Gerhard Brueckl

05/15/2023, 7:36 AM
t

Thanhtan Le

05/15/2023, 9:56 AM
I don't know why each merge statement completely, optimize operation automatically run. How to turn off that? I did not configure any special
g

Gerhard Brueckl

05/15/2023, 10:56 AM
yes, as I said, you can configure this by setting the table properties mentioned in the link above
t

Thanhtan Le

05/15/2023, 11:29 AM
base on your recommendation, I think delta.autoCompact configure will suitable, right ? I just want to turn of optimize statement
g

Gerhard Brueckl

05/15/2023, 11:51 AM
yes, setting
detal.autoCompact
to
False
in your table properties should do the trick
k

Kashyap Bhatt

05/15/2023, 2:51 PM
This is interesting. We don't use
MERGE
, we do
streaming_df.writeStream()
. Target delta table has both autoCompact and optimizeWrite enabled. We see that it runs OPTIMIZE only once in a while, which makes sense as it's waiting (I think) for enough small files to be there before optimizing.
👍 1
Is this something specific to MERGE?
t

Thanhtan Le

05/15/2023, 3:02 PM
yes for every complex business logic. Just resolve by sql spark. So I use merge statement
I think it is not working. After setup parameters, optimize statement still run
hello @Gerhard Brueckl
Can I customize OPTIMIZE query ? I want to add zOrderBy to that
g

Gerhard Brueckl

05/16/2023, 7:14 AM
no, autoCompact does not support ZOrdering
can you share your current Table properties?
t

Thanhtan Le

05/16/2023, 8:44 AM
that is our setting
g

Gerhard Brueckl

05/16/2023, 8:53 AM
can you try
delta.autoCompact
insterad of
delta.autoOptimize.autoCompact
t

Thanhtan Le

05/16/2023, 9:25 AM
I can not setup configure
g

Gerhard Brueckl

05/16/2023, 9:26 AM
i think you need to write the properties with quotes
t

Thanhtan Le

05/16/2023, 9:34 AM
IMG_8444.jpg
I have try between quote and double quote
g

Gerhard Brueckl

05/16/2023, 11:46 AM
it should be `ALTER TABLE delta.
mytable_location
SET TBLPROPERTIES ('my property' = 'abc')`
t

Thanhtan Le

05/17/2023, 1:36 PM
Tks so much, I have change configure success. And monitor tmr
7 Views