Skip to content

Commit fc0389b

Browse files
committed
init
1 parent 4e678f9 commit fc0389b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

python/hsfs/core/delta_engine.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ def _generate_merge_query(self, source_alias, updates_alias):
172172
@staticmethod
173173
def _get_last_commit_metadata(spark_context, base_path):
174174
fg_source_table = DeltaTable.forPath(spark_context, base_path)
175+
176+
# Get info about the latest commit
175177
last_commit = fg_source_table.history(1).first().asDict()
176178
version = last_commit["version"]
177179
commit_timestamp = util.convert_event_time_to_timestamp(
@@ -180,6 +182,12 @@ def _get_last_commit_metadata(spark_context, base_path):
180182
commit_date_string = util.get_hudi_datestr_from_timestamp(commit_timestamp)
181183
operation_metrics = last_commit["operationMetrics"]
182184

185+
# Get info about the oldest remaining commit
186+
oldest_commit = fg_source_table.history().orderBy("version").first().asDict()
187+
oldest_commit_timestamp = util.convert_event_time_to_timestamp(
188+
oldest_commit["timestamp"]
189+
)
190+
183191
if version == 0:
184192
fg_commit = feature_group_commit.FeatureGroupCommit(
185193
commitid=None,
@@ -188,7 +196,7 @@ def _get_last_commit_metadata(spark_context, base_path):
188196
rows_inserted=operation_metrics["numOutputRows"],
189197
rows_updated=0,
190198
rows_deleted=0,
191-
last_active_commit_time=commit_timestamp,
199+
last_active_commit_time=oldest_commit_timestamp,
192200
)
193201
else:
194202
fg_commit = feature_group_commit.FeatureGroupCommit(
@@ -198,7 +206,7 @@ def _get_last_commit_metadata(spark_context, base_path):
198206
rows_inserted=operation_metrics["numTargetRowsInserted"],
199207
rows_updated=operation_metrics["numTargetRowsUpdated"],
200208
rows_deleted=operation_metrics["numTargetRowsDeleted"],
201-
last_active_commit_time=commit_timestamp,
209+
last_active_commit_time=oldest_commit_timestamp,
202210
)
203211

204212
return fg_commit

0 commit comments

Comments
 (0)