0

Is it possible to do update on a delta lake table with join? In mysql (and other databases) you could something like

update table x 
join table y on y.a=x.a 
set x.b=y.b
where x.c='something'

Do we have something similar in delta? I know they support in and exists clause. Their documentation does not seem to mention anything about update join

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
Ridwan
  • 301
  • 5
  • 12

1 Answers1

1

You can achieve it with MERGE INTO command. Something like:

    merge into x using y
    on (x.a=y.a and x.c='something')
    when matched then
    update set x.b=y.b;
  • thanks Dipesh. any idea how we can use join optimizations like skew (....) ? – Ridwan Nov 13 '19 at 18:56
  • 1
    @Ridwan Can you please describe your use-case? To start with, You can have a look at performance improvements here: https://kb.databricks.com/delta/delta-merge-into.html#how-to-improve-performance-of-delta-merge-into-queries-using-partition-pruning – Dipesh Patel Nov 14 '19 at 12:58