Skip to content

Commit 17405f3

Browse files
abhijeet-dhumalntkathole
authored andcommitted
fix(spark): narrow exception handling in offline path fallback
Catch FileNotFoundError and PermissionError separately for the expected fallback cases (path not yet materialized, or no access). Unexpected errors now emit a distinct RuntimeWarning instead of being silently swallowed by a bare except Exception. Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
1 parent b2c76ff commit 17405f3

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

  • sdk/python/feast/infra/offline_stores/contrib/spark_offline_store

sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,17 @@ def _apply_bfv_transformations_for_historical(
131131
ctx = replace(ctx, table_subquery=tmp_view)
132132
new_contexts.append(ctx)
133133
continue
134-
except Exception:
134+
except (FileNotFoundError, PermissionError) as e:
135135
warnings.warn(
136-
f"Offline path '{fv.batch_source.path}' not readable for "
137-
f"'{ctx.name}'; falling back to source query.",
136+
f"Offline path '{fv.batch_source.path}' not accessible for "
137+
f"'{ctx.name}': {e}; falling back to source query.",
138+
RuntimeWarning,
139+
stacklevel=2,
140+
)
141+
except Exception as e:
142+
warnings.warn(
143+
f"Unexpected error loading offline path '{fv.batch_source.path}' "
144+
f"for '{ctx.name}': {e}; falling back to source query.",
138145
RuntimeWarning,
139146
stacklevel=2,
140147
)

0 commit comments

Comments
 (0)