@@ -219,10 +219,9 @@ def register_hudi_temporary_table(
219
219
read_options ,
220
220
)
221
221
222
- if (hudi_fg_alias ._feature_group .storage_connector is None ):
223
- hudi_engine_instance .reconcile_hudi_schema (
224
- self .save_empty_dataframe , hudi_fg_alias , read_options
225
- )
222
+ hudi_engine_instance .reconcile_hudi_schema (
223
+ self .save_empty_dataframe , hudi_fg_alias , read_options
224
+ )
226
225
227
226
def register_delta_temporary_table (
228
227
self , delta_fg_alias , feature_store_id , feature_store_name , read_options
@@ -1250,13 +1249,22 @@ def is_spark_dataframe(self, dataframe):
1250
1249
return True
1251
1250
return False
1252
1251
1253
- def save_empty_dataframe (self , feature_group ):
1254
- fg_table_name = feature_group ._get_table_name ()
1255
- dataframe = self ._spark_session .table (fg_table_name ).limit (0 )
1252
+ def save_empty_dataframe (self , feature_group , new_features = None ):
1253
+ dataframe = self ._spark_session .read .format ("hudi" ).load (
1254
+ feature_group .get_uri ()
1255
+ )
1256
+
1257
+ if (new_features is not None ):
1258
+ if isinstance (new_features , list ):
1259
+ for new_feature in new_features :
1260
+ dataframe = dataframe .withColumn (new_feature .name , lit ("" ).cast (new_feature .type ))
1261
+ else :
1262
+ dataframe = dataframe .withColumn (new_features .name , lit ("" ).cast (new_features .type ))
1263
+
1256
1264
1257
1265
self .save_dataframe (
1258
1266
feature_group ,
1259
- dataframe ,
1267
+ dataframe . limit ( 0 ) ,
1260
1268
"upsert" ,
1261
1269
feature_group .online_enabled ,
1262
1270
"offline" ,
0 commit comments