Skip to content

Commit caecfe4

Browse files
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 6794ef2 commit caecfe4

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
@@ -118,10 +118,17 @@ def _apply_bfv_transformations_for_historical(
118118
ctx = replace(ctx, table_subquery=tmp_view)
119119
new_contexts.append(ctx)
120120
continue
121-
except Exception:
121+
except (FileNotFoundError, PermissionError) as e:
122122
warnings.warn(
123-
f"Offline path '{fv.batch_source.path}' not readable for "
124-
f"'{ctx.name}'; falling back to source query.",
123+
f"Offline path '{fv.batch_source.path}' not accessible for "
124+
f"'{ctx.name}': {e}; falling back to source query.",
125+
RuntimeWarning,
126+
stacklevel=2,
127+
)
128+
except Exception as e:
129+
warnings.warn(
130+
f"Unexpected error loading offline path '{fv.batch_source.path}' "
131+
f"for '{ctx.name}': {e}; falling back to source query.",
125132
RuntimeWarning,
126133
stacklevel=2,
127134
)

0 commit comments

Comments
 (0)