Skip to content

bug: initialize_index fails for nested index fields #8149

Description

@justinrmiller

Problem

DatasetIndexExt::initialize_index fails when an index references a nested field, even when the source and target datasets have identical schemas.

For example, initializing an index on embedding_data.vector.v2 fails with:

Index { message: "Field 'vector.v2' required by index 'vec_v2_idx' not found in target dataset" }

The failure affects initialize_index directly and initialize_indices when it encounters a nested index.

Root cause

The implementation resolves the source field by ID, but then uses only the leaf field name for both the target-schema lookup and the field names passed to the index initializer:

let target_field = self.schema().field(&source_field.name);
field_names.push(source_field.name.as_str());

For embedding_data.vector.v2, this reduces the canonical path to vector.v2, so the target schema lookup starts at the root and fails. Field names that require path quoting are affected as well.

Expected behavior

Resolve the indexed field ID to its canonical schema path with Schema::field_path, use that path for target-schema validation, and pass it to the scalar or vector index initializer.

Add regression coverage for initialization from an identical source schema using:

  • a simple nested field path
  • a nested field whose name requires path quoting

Impact

Index initialization and cloning workflows are blocked for valid nested vector or scalar indexes. No data corruption is known.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions