GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(spark): Replace mapInArrow with foreachPartition for materialization by abhijeet-dhumal · Pull Request #6370 · feast-dev/feast

Conversation

@abhijeet-dhumal

@abhijeet-dhumal abhijeet-dhumal commented May 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

Fixes materialization failures when using BatchFeatureView + SparkComputeEngine with vector stores and Spark 3.5+.

1. Replace mapInArrow with foreachPartition (main fix)

Spark 3.5 inserts WindowGroupLimitExec upstream of MapInArrowExec when UDFs use Window operations, routing the Python worker through the wrong serialiser:

AttributeError: 'list' object has no attribute 'dtype'

foreachPartition uses pickle — no Arrow UDF bridge — so the mismatch cannot occur.

2. Re-apply session configs on reuse

SparkSession.getOrCreate() silently drops new spark.sql.* / spark.hadoop.* overrides when a session already exists, causing S3 access failures. Now explicitly re-applied after getOrCreate().

3. Fix map_in_pandas dummy yield

Changed pd.DataFrame([pd.Series(range(1, 2))]) → pd.DataFrame({"status": [0]}) to match the declared return schema.

4. Remove redundant _apply_bfv_transformations

Superseded by SparkFeatureBuilder DAG pipeline (#6357) which handles BFV transformations for both materialization and historical retrieval.

5. Add spark_embed utility

Helper for @batch_feature_view UDFs that generate embeddings via SentenceTransformer. Uses localCheckpoint(eager=True) to sever Python lineage before downstream writes.

Which issue(s) this PR fixes

Fixes BatchFeatureView materialization with vector stores (Milvus/Redis), Spark 3.5+ Window operations, and K8s-mode session config drift.

Testing Strategy

  • Unit tests: session config forwarding, map_in_pandas schema, empty partition handling, S3 event log dir
  • Manual: Materialized BatchFeatureView with PySpark + RAPIDS GPU on K8s (4 executors), 26M+ keys to Redis

Checks

  • Tests passing
  • Commits signed off
  • PR title follows conventional commits

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@abhijeet-dhumal
fix(spark): replace mapInArrow with foreachPartition and fix session …
2cee78e
…config forwarding for vector store materialization

Signed-off-by: abhijeet-dhumal <[email protected]>
@abhijeet-dhumal
abhijeet-dhumal force-pushed the fix/spark-vector-store-materialization branch from 60fe5cf to 2cee78e Compare May 6, 2026 08:57
@abhijeet-dhumal
abhijeet-dhumal marked this pull request as ready for review May 6, 2026 09:09
@abhijeet-dhumal
abhijeet-dhumal requested a review from a team as a code owner May 6, 2026 09:10
@abhijeet-dhumal abhijeet-dhumal changed the title fix(spark): replace mapInArrow with foreachPartition and fix session … fix(spark): Replace mapInArrow with foreachPartition for materialization May 6, 2026
abhijeet-dhumal and others added 4 commits May 6, 2026 14:45
@abhijeet-dhumal
fix: resolve linting and ruff check issues
e69c623
Signed-off-by: abhijeet-dhumal <[email protected]>
@abhijeet-dhumal
feat: read from offline path in get_historical_features for BFVs
893db92
@abhijeet-dhumal @cursoragent
feat: allow query + path in SparkSource for offline materialization
165fbe2
SparkSource previously required exactly one of table/query/path.
This relaxes the constraint to allow query + path together:
- query: used for reading raw data during materialization
- path: used for offline write-back (offline=True) and as
  pre-computed read source in get_historical_features

Co-authored-by: Cursor <[email protected]>
@abhijeet-dhumal @cursoragent
fix: add missing BatchFeatureView import in spark offline store
6ebcde1
Co-authored-by: Cursor <[email protected]>
@abhijeet-dhumal
abhijeet-dhumal marked this pull request as draft May 7, 2026 08:01
abhijeet-dhumal and others added 2 commits May 7, 2026 13:32
@abhijeet-dhumal @cursoragent
fix: graceful fallback when offline path is not readable
c80d436
Co-authored-by: Cursor <[email protected]>
@abhijeet-dhumal
fix: chunk foreachPartition writes to bound Python memory — prevents …
3d1c364
…MemoryError/OOMKill on large feature views

Signed-off-by: abhijeet-dhumal <[email protected]>
@abhijeet-dhumal abhijeet-dhumal closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@abhijeet-dhumal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.