-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
187: Adding apache hudi support to dbt (#210)
* initial working version * Rebased and resolve all the merge conflicts. * Rebased and resolved merge conflicts. * Removed hudi dep jar and used the released version via packages option * Added insert overwrite unit tests for hudi * Used unique_key as default value for hudi primaryKey option * Updated changelog.md with this new update. * Final round of testing and few minor fixes * Fixed lint issues * Fixed the integration tests * Fixed the circle ci env to add hudi packages * Updated hudi spark bundle to use scala 2.11 * Fixed Hudi incremental strategy integration tests and other integration tests * Fixed the hudi hive sync hms integration test issues * Added sql HMS config to fix the integration tests. * Added hudi hive sync mode conf to CI * Set the hms schema verification to false * Removed the merge update columns hence its not supported. * Passed the correct hiveconf to the circle ci build script * Disabled few incremental tests for spark2 and reverted to spark2 config * Added hudi configs to the circle ci build script * Commented out the Hudi integration test until we have the hudi 0.10.0 version * Fixed the macro which checks the table type. * Disabled this model since hudi is not supported in databricks runtime, will be added later
- Loading branch information
Vinoth Govindarajan
authored
Nov 19, 2021
1 parent
05678b3
commit 68a3b5a
Showing
19 changed files
with
261 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
spark.hadoop.datanucleus.autoCreateTables true | ||
spark.hadoop.datanucleus.schema.autoCreateTables true | ||
spark.hadoop.datanucleus.fixedDatastore false | ||
spark.serializer org.apache.spark.serializer.KryoSerializer | ||
spark.jars.packages org.apache.hudi:hudi-spark3-bundle_2.12:0.9.0 | ||
spark.sql.extensions org.apache.spark.sql.hudi.HoodieSparkSessionExtension | ||
spark.driver.userClassPathFirst true |
19 changes: 19 additions & 0 deletions
19
tests/integration/incremental_strategies/models_hudi/append.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'append', | ||
file_format = 'hudi', | ||
) }} | ||
|
||
{% if not is_incremental() %} | ||
|
||
select cast(1 as bigint) as id, 'hello' as msg | ||
union all | ||
select cast(2 as bigint) as id, 'goodbye' as msg | ||
|
||
{% else %} | ||
|
||
select cast(2 as bigint) as id, 'yo' as msg | ||
union all | ||
select cast(3 as bigint) as id, 'anyway' as msg | ||
|
||
{% endif %} |
19 changes: 19 additions & 0 deletions
19
tests/integration/incremental_strategies/models_hudi/insert_overwrite_no_partitions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'insert_overwrite', | ||
file_format = 'hudi', | ||
) }} | ||
|
||
{% if not is_incremental() %} | ||
|
||
select cast(1 as bigint) as id, 'hello' as msg | ||
union all | ||
select cast(2 as bigint) as id, 'goodbye' as msg | ||
|
||
{% else %} | ||
|
||
select cast(2 as bigint) as id, 'yo' as msg | ||
union all | ||
select cast(3 as bigint) as id, 'anyway' as msg | ||
|
||
{% endif %} |
20 changes: 20 additions & 0 deletions
20
tests/integration/incremental_strategies/models_hudi/insert_overwrite_partitions.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'insert_overwrite', | ||
partition_by = 'id', | ||
file_format = 'hudi', | ||
) }} | ||
|
||
{% if not is_incremental() %} | ||
|
||
select cast(1 as bigint) as id, 'hello' as msg | ||
union all | ||
select cast(2 as bigint) as id, 'goodbye' as msg | ||
|
||
{% else %} | ||
|
||
select cast(2 as bigint) as id, 'yo' as msg | ||
union all | ||
select cast(3 as bigint) as id, 'anyway' as msg | ||
|
||
{% endif %} |
19 changes: 19 additions & 0 deletions
19
tests/integration/incremental_strategies/models_hudi/merge_no_key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'merge', | ||
file_format = 'hudi', | ||
) }} | ||
|
||
{% if not is_incremental() %} | ||
|
||
select cast(1 as bigint) as id, 'hello' as msg | ||
union all | ||
select cast(2 as bigint) as id, 'goodbye' as msg | ||
|
||
{% else %} | ||
|
||
select cast(2 as bigint) as id, 'yo' as msg | ||
union all | ||
select cast(3 as bigint) as id, 'anyway' as msg | ||
|
||
{% endif %} |
20 changes: 20 additions & 0 deletions
20
tests/integration/incremental_strategies/models_hudi/merge_unique_key.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'merge', | ||
file_format = 'hudi', | ||
unique_key = 'id', | ||
) }} | ||
|
||
{% if not is_incremental() %} | ||
|
||
select cast(1 as bigint) as id, 'hello' as msg | ||
union all | ||
select cast(2 as bigint) as id, 'goodbye' as msg | ||
|
||
{% else %} | ||
|
||
select cast(2 as bigint) as id, 'yo' as msg | ||
union all | ||
select cast(3 as bigint) as id, 'anyway' as msg | ||
|
||
{% endif %} |
22 changes: 22 additions & 0 deletions
22
tests/integration/incremental_strategies/models_hudi/merge_update_columns.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{ config( | ||
materialized = 'incremental', | ||
incremental_strategy = 'merge', | ||
file_format = 'hudi', | ||
unique_key = 'id', | ||
merge_update_columns = ['msg'], | ||
) }} | ||
|
||
{% if not is_incremental() %} | ||
|
||
select cast(1 as bigint) as id, 'hello' as msg, 'blue' as color | ||
union all | ||
select cast(2 as bigint) as id, 'goodbye' as msg, 'red' as color | ||
|
||
{% else %} | ||
|
||
-- msg will be updated, color will be ignored | ||
select cast(2 as bigint) as id, 'yo' as msg, 'green' as color | ||
union all | ||
select cast(3 as bigint) as id, 'anyway' as msg, 'purple' as color | ||
|
||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.