Visitar URL original
feat: Add LanceFormat table format with version/tag pinning by haoxu0 · Pull Request #6925 · feast-dev/feast · GitHub
Skip to content

feat: Add LanceFormat table format with version/tag pinning - #6925

Merged
ntkathole merged 1 commit into
feast-dev:masterfrom
haoxu0:feat/lance-table-format
Oct 4, 2026
Merged

ntkathole merged 1 commit into
feast-dev:masterfrom
haoxu0:feat/lance-table-format

Conversation

@haoxu0

@haoxu0 haoxu0 commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Adds Lance to the existing TableFormat abstraction from #5650, rather than introducing a separate data source. Addresses the core of #6899.

Why TableFormat and not a new source

TableFormat already models Iceberg, Delta and Hudi as formats a source can carry, with catalog/namespace addressing and a properties bag. Lance fits that shape exactly, so it needs no new source class, no new offline store, and no changes to any existing consumer.

LanceFormat(
    catalog="my_catalog",
    namespace="my_namespace",
    version=3,            # or tag="candidate"
)

It works with SparkSource unchanged

SparkSource already drives its reader generically:

reader = spark_session.read.format(self.table_format.format_type.value)
for key, value in self.table_format.properties.items():
    reader = reader.option(key, value)

So mirroring the pin into properties is what makes this fall out for free. Verified:

SparkSource accepted it   : LanceFormat
spark .format(...) value  : lance
reader .option(...) pairs :
    lance.catalog = polaris_dev
    lance.namespace = ml_features
    lance.version = 3
SparkSource proto rt      : LanceFormat version = 3

Pin semantics

version / tag is the Lance-shaped instance of #5782. Two invariants:

  • version >= 1 is enforced. Lance dataset versions start at 1 and the proto treats 0 as unset, so without the guard version=0 would not round-trip — to_proto/from_proto read 0 as absent. Rejecting it keeps the Python and proto semantics in agreement rather than silently dropping a pin.
  • version and tag are mutually exclusive, since a tag already resolves to a version.

On the broader question @jfw-ppi raised in #5782 — whether a pin can change the response shape — the position I'd argue for is that a pin selects data, never shape: the declared FeatureView schema stays the contract, and a pinned version whose schema disagrees should fail explicitly. That belongs in whatever consumes the pin, so it is not in this PR, but the format carries enough information to enforce it.

Proto regeneration, deliberately constrained

Two things worth flagging, both about not doing the obvious thing.

1. Generated with grpcio-tools==1.62.3, not the pinned 1.84.0.

Regenerating with the pinned toolchain emits gencode that opens with:

_runtime_version.ValidateProtobufRuntimeVersion(_runtime_version.Domain.PUBLIC, 7, 35, 1, ...)

pyproject.toml declares protobuf>=4.24.0. That call would hard-fail for anyone on protobuf 4/5/6 — and google.protobuf.runtime_version does not exist in 4.x at all, so it is an ImportError on that one module while every other proto still imports. Using 1.62.3 emits 4.25.1-level gencode, matching every other checked-in proto, and keeps the declared floor honest.

Worth noting independently: the checked-in protos are at gencode 4.25.1 while the requirements pin grpcio-tools==1.84.0 / protobuf==7.36.2, so a full regeneration on master today would touch ~70 files and raise the effective protobuf floor. That looks like something to decide on purpose rather than as a side effect of a feature PR.

2. DataSource_pb2 is left untouched on purpose.

Regenerating also rewrites DataSource_pb2.py/.pyi (~125 lines), but that churn is pre-existing — I verified it reproduces on pristine master with no changes at all. The checked-in copy is missing _CONNECTIONREF_PARAMSENTRY entries, i.e. it is stale against DataSource.proto. Happy to fix that separately; it does not belong here.

Net result is 5 files, and only DataFormat_pb2 regenerated.

Scope

This adds the format descriptor. It does not add a Lance reader or offline store — that is the follow-on discussed in #6899, and it is why the tests here cover LanceFormat semantics rather than reading real datasets (no new test dependency on pylance).

Also explicitly not proposing Lance as an online store: it is a format plus indexes, not a low-latency KV service, and its write path is columnar while online_write_batch is row-oriented proto.

Testing

11 new tests in test_table_format.py (24 total in the file): creation, minimal construction, version pin, tag pin, version < 1 rejection, version+tag rejection, dict/json/proto round-trips, unpinned not coming back as version 0, and factory dispatch.

  • test_table_format.py — 24 passed
  • test_utils.py, test_data_sources.py, test_types.py — 52 passed, 1 skipped
  • mypy feast/table_format.py — clean, no issues
  • ruff check / ruff format --check — clean

Related: #6899, #5782, #5650, #6499

@haoxu0
haoxu0 requested a review from a team as a code owner October 1, 2026 20:27
@codecov-commenter

codecov-commenter commented Oct 1, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 48.68%. Comparing base (298c3f6) to head (9afb378).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
sdk/python/feast/table_format.py 97.61% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6925      +/-   ##
==========================================
+ Coverage   48.64%   48.68%   +0.04%     
==========================================
  Files         427      427              
  Lines       53864    53906      +42     
  Branches     7849     7858       +9     
==========================================
+ Hits        26203    26246      +43     
+ Misses      25792    25788       -4     
- Partials     1869     1872       +3     
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 50.06% <97.61%> (+0.04%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/table_format.py 85.62% <97.61%> (+5.11%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 298c3f6...9afb378. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haoxu0

haoxu0 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

@ntkathole PTAL, It's a simple one

Extends the existing TableFormat abstraction (feast-dev#5650) with Lance rather than
introducing a separate data source, so Lance is addressed the same way Iceberg,
Delta and Hudi already are. Closes part of feast-dev#6899.

LanceFormat carries catalog/namespace addressing plus an optional pin to a
dataset version or tag. Because SparkSource already drives its reader
generically from table_format.format_type.value and table_format.properties,
this works with SparkSource with no changes to it: format_type.value is
"lance", and the pin is mirrored into properties as lance.version / lance.tag.

version is validated as >= 1 so the Python and proto semantics agree. Lance
dataset versions start at 1 and the proto treats 0 as unset, so without that
guard version=0 would not round-trip, since to_proto/from_proto read 0 as
absent. version and tag are mutually exclusive, because a tag already resolves
to a version.

Only DataFormat_pb2 is regenerated, using grpcio-tools 1.62.3 so the emitted
gencode stays at the 4.25.1 level the other checked-in protos use. Regenerating
with the pinned grpcio-tools 1.84.0 instead emits gencode that calls
ValidateProtobufRuntimeVersion for protobuf 7.35.1, which would break the
declared protobuf>=4.24.0 floor for that one module.

DataSource_pb2 is deliberately left untouched. It is already stale against
DataSource.proto on master, missing ConnectionRef entries, and regenerating it
produces ~125 lines of churn unrelated to this change.

Signed-off-by: hao-xu5 <hxu44@apple.com>
@ntkathole
ntkathole force-pushed the feat/lance-table-format branch from 8d5e3a5 to 9afb378 Compare October 4, 2026 13:05
@ntkathole
ntkathole merged commit 1196e22 into feast-dev:master Oct 4, 2026
21 of 23 checks passed
ntkathole pushed a commit to haoxu0/feast that referenced this pull request Oct 7, 2026
Adds LanceSource and teaches the DuckDB offline store to read it, completing the
read half of feast-dev#6899. LanceFormat landed in feast-dev#6925 as a format descriptor; nothing
read Lance until now.

Lance already worked through SparkSource, which drives its reader generically
from table_format.format_type.value and table_format.properties. What was
missing is a path that needs no JVM, which is also the real test of whether the
DataSource abstraction is engine-agnostic rather than Spark-agnostic in name
only.

Placement: a new source read by the existing DuckDB store, rather than a Lance
offline store or an extension of FileSource.

FileSource is the wrong host. Its format axis is already taken by file_format,
so adding table_format would give one source two overlapping format axes. It is
also read by two stores with incompatible contracts: duckdb._read_data_source
dispatches on type, while dask._read_datasource has no dispatch seam and reads
file_options.uri unconditionally as Parquet, and asserts isinstance(...,
FileSource) in three places. Decisively, Lance's catalog addressing has no path
to put in FileSource.path, so the catalog-based layer would not fit the class
even if the path-based one did.

A Lance offline store would be the wrong 120 lines. duckdb.py is a binding that
injects reader and writer callbacks into the engine in ibis.py, so a Lance store
would be a near-copy of it plus a repo_config entry, and would force a choice
between Lance and Parquet instead of mixing them in one feature service.

Reading a source as ibis.memtable(arrow_table) in the DuckDB store already has
two precedents, IcebergSource and MlflowDatasetSource. Following them leaves
ibis.py untouched, so the point-in-time join, TTL handling, field mapping and
ODFVs work unchanged, and no edit to repo_config.py or data_source.py is needed
because CUSTOM_SOURCE plus data_source_class_type is self-describing.

Both addressing modes work: a uri, and catalog/namespace/table through
namespace_client and table_id.

Pin semantics follow what was argued on feast-dev#5782 and feast-dev#6925: a pin selects data,
never shape. get_table_column_names_and_types reads the pinned schema so
feast apply infers what reads will actually see; a pre-flight check fails with a
message naming the pin when a pinned version cannot satisfy the declared schema;
and vector widths go through _validate_vector_field_lengths from feast-dev#6909 rather
than a second validator.

Tests use the dir namespace implementation, which exercises the same
namespace_client and table_id code path as a remote catalog with no server
required. 43 tests, including a demonstration that a tag pin returns earlier
data after the dataset has been overwritten for the same entity and timestamp.

Read-only for now: _write_data_source is untouched, so a LanceSource is not yet
a persist target and there is no SavedDatasetLanceStorage.

Signed-off-by: hao-xu5 <hxu44@apple.com>
ntkathole pushed a commit that referenced this pull request Oct 7, 2026
* feat: Add a non-JVM read path for Lance data sources

Adds LanceSource and teaches the DuckDB offline store to read it, completing the
read half of #6899. LanceFormat landed in #6925 as a format descriptor; nothing
read Lance until now.

Lance already worked through SparkSource, which drives its reader generically
from table_format.format_type.value and table_format.properties. What was
missing is a path that needs no JVM, which is also the real test of whether the
DataSource abstraction is engine-agnostic rather than Spark-agnostic in name
only.

Placement: a new source read by the existing DuckDB store, rather than a Lance
offline store or an extension of FileSource.

FileSource is the wrong host. Its format axis is already taken by file_format,
so adding table_format would give one source two overlapping format axes. It is
also read by two stores with incompatible contracts: duckdb._read_data_source
dispatches on type, while dask._read_datasource has no dispatch seam and reads
file_options.uri unconditionally as Parquet, and asserts isinstance(...,
FileSource) in three places. Decisively, Lance's catalog addressing has no path
to put in FileSource.path, so the catalog-based layer would not fit the class
even if the path-based one did.

A Lance offline store would be the wrong 120 lines. duckdb.py is a binding that
injects reader and writer callbacks into the engine in ibis.py, so a Lance store
would be a near-copy of it plus a repo_config entry, and would force a choice
between Lance and Parquet instead of mixing them in one feature service.

Reading a source as ibis.memtable(arrow_table) in the DuckDB store already has
two precedents, IcebergSource and MlflowDatasetSource. Following them leaves
ibis.py untouched, so the point-in-time join, TTL handling, field mapping and
ODFVs work unchanged, and no edit to repo_config.py or data_source.py is needed
because CUSTOM_SOURCE plus data_source_class_type is self-describing.

Both addressing modes work: a uri, and catalog/namespace/table through
namespace_client and table_id.

Pin semantics follow what was argued on #5782 and #6925: a pin selects data,
never shape. get_table_column_names_and_types reads the pinned schema so
feast apply infers what reads will actually see; a pre-flight check fails with a
message naming the pin when a pinned version cannot satisfy the declared schema;
and vector widths go through _validate_vector_field_lengths from #6909 rather
than a second validator.

Tests use the dir namespace implementation, which exercises the same
namespace_client and table_id code path as a remote catalog with no server
required. 43 tests, including a demonstration that a tag pin returns earlier
data after the dataset has been overwritten for the same entity and timestamp.

Read-only for now: _write_data_source is untouched, so a LanceSource is not yet
a persist target and there is no SavedDatasetLanceStorage.

Signed-off-by: hao-xu5 <hxu44@apple.com>

* fix: Address Lance read review feedback

Signed-off-by: HaoXuAI <sduxuhao@gmail.com>

---------

Signed-off-by: hao-xu5 <hxu44@apple.com>
Signed-off-by: HaoXuAI <sduxuhao@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants