Repository navigation
Description
Is your feature request related to a problem? Please describe.
Some list features always have the same number of elements but aren't vector-search embeddings. Examples are fixed-size numeric feature vectors and fixed-width sequences. Feast can't currently declare or enforce that length for them. FeatureSpecV2.vector_length (field 7) is documented as "the vector length" and used only when vector_index is true.
In current master,
- Stored and round-tripped. Field(name="v", dtype=Array(Float64), vector_length=4) with vector_index=False survives Field.to_proto/from_proto, FeatureView.to_proto/from_proto, and a SqlRegistry round trip (SQLite). The value type is DOUBLE_LIST and vector_length comes back as 4.
- Ignored for validation. _get_feature_view_vector_field_metadata only considers fields where vector_index is true. So both _validate_vector_field_lengths in utils.py (Arrow) and the pandas check in feature_store.py return early for these fields. A wrong-length list is accepted at materialization and ingestion, and shows up later as a bad model input.
- Consumed only for vector fields. The SQLite, Qdrant, Elasticsearch and MongoDB online stores read vector_length only for the vector field. MongoDB raises an error when vector_index is true and vector_length is unset.
- Clients keep it. The Java feature server's vendored Feature.proto already has field 7.
There's also a typing gap. The schema says only "list of Float64", so a consumer can't tell a fixed-size array from a variable-length list.
Describe the solution you'd like
Let a feature declare a fixed list length without being a vector-search field, and enforce it on write.
- Option A, reuse vector_length. Define it as "the fixed length of this list feature". Apply the existing validators to any field that declares it, whether or not vector_index is set. Update the proto comment and Field docstring. This needs no proto change, and the SQLite round-trip result above shows it already persists.
- Option B, add fixed_length to FeatureSpecV2. Keep vector_length tied to vector search. The cost is two overlapping fields.
I'd lean towards A if maintainers are comfortable with the meaning change, because the data is already stored and validators exist.
Describe alternatives you've considered
- Tags: Field.from_proto already persists struct and nested-collection type info in internal tags. A tag could carry the length, but it wouldn't be validated, and it would be inconsistent with vector_length.
- A new Value type: a fixed-size list variant would touch every SDK, store and server. It gains nothing on the wire, because a proto3 repeated double is already packed, and protobuf can't enforce a length.
Additional context
- Option A or B?
- Should a declared length also apply to Set?
- Is mismatch an error or a warning on the pandas path?
Activity