fastflowtransform.table_formats.spark_hudi¶
HudiFormatHandler ¶
Bases: SparkFormatHandler
Hudi format handler using Spark's Hudi integration.
Responsibilities
- save_df_as_table() via df.write.format("hudi").saveAsTable(...)
- incremental_insert(): INSERT INTO ... SELECT ...
- incremental_merge(): MERGE INTO ... USING (...) WHEN MATCHED/NOT MATCHED ... (Hudi's Spark MERGE support must be enabled in the cluster).
Source code in src/fastflowtransform/table_formats/spark_hudi.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
save_df_as_table ¶
save_df_as_table(table_name, df)
Save DataFrame as a Hudi table registered in the current catalog.
Source code in src/fastflowtransform/table_formats/spark_hudi.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
incremental_insert ¶
incremental_insert(table_name, select_body_sql)
Append-only incremental load.
Uses Spark SQL INSERT INTO; the Hudi connector will handle this as an insert/upsert depending on table configuration.
Source code in src/fastflowtransform/table_formats/spark_hudi.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
incremental_merge ¶
incremental_merge(table_name, select_body_sql, unique_key)
Hudi MERGE implementation.
MERGE INTO db.table AS t
USING (<select_body_sql>) AS s
ON AND-joined equality on unique_key
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *
This requires Hudi's MERGE support to be enabled on your Spark cluster.
Source code in src/fastflowtransform/table_formats/spark_hudi.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
run_sql ¶
run_sql(sql)
Execute SQL via the injected runner (guardable in the executor).
Source code in src/fastflowtransform/table_formats/base.py
45 46 47 | |
format_identifier_for_sql ¶
format_identifier_for_sql(table_name, *, database=None)
Return a SQL-safe identifier (per-part quoted) for the table.
Source code in src/fastflowtransform/table_formats/base.py
54 55 56 57 58 59 60 | |