dbt-labs / dbt-athena

The athena adapter plugin for dbt (https://getdbt.com)
https://dbt-athena.github.io
Apache License 2.0
225 stars 97 forks source link

Add iceberg table materialization #11

Closed nicor88 closed 1 year ago

nicor88 commented 2 years ago

Add Iceberg table materialisation, original work was done in https://github.com/Tomme/dbt-athena/pull/135

zsvoboda commented 2 years ago

Hi,

I'm looking at the Iceberg tables support plan:

As iceberg doesn't support CTA, the implementation do the following:

create tmp table as parquet drop the old table, if exist create iceberg table based on tmp table definition, only metadata insert into from tmp drop tmp table I think that the tmp table creation is going to kill performance (I have 10s of billions of rows).

How about this approach:

create the tmp table with the model's SELECT with "LIMIT 0" appended create iceberg table based on tmp table definition, only metadata insert into the iceberg table with the model's SQL (don't append the LIMIT this time) drop the tmp table This would save one copying of all rows (hours of processing in my case).

Regards,

ZD

nicor88 commented 1 year ago

@zsvoboda I implemented what you suggested, I tested with small datasets, seems working fine.

zsvoboda commented 1 year ago

Thank you!!! I’ll test it as soon as possible. What branch should I use for testing it?

nicor88 commented 1 year ago

@zsvoboda we released the changes to 1.3.1, try that out.

zsvoboda commented 1 year ago

Hi Nicola, I'm testing the 1.3.2, and it works great in the table materialization mode. My elt works much faster now. Thank you! However, it works the old way in the incremental materialization mode. Any chance you can do the same trick in the incremental mode?

nicor88 commented 1 year ago

@zsvoboda Feel free to address another issue to handle that request. I believe that is possible: