Skip to content

Support blob v2 extension type for file format >= 2.2 #505

@puchengy

Description

@puchengy

Problem

When creating a table with 'file_format_version' = '2.2' and '<column>.lance.encoding' = 'blob', the write fails with:

Error: Invalid user input: Legacy blob columns (field metadata key "lance-encoding:blob") are not supported
for file version >= 2.2. Use the blob v2 extension type (ARROW:extension:name = "lance.blob.v2") and the
new blob APIs (e.g. lance::blob::blob_field / lance::blob::BlobArrayBuilder).

Root Cause

SchemaConverter.addBlobMetadata() unconditionally sets the legacy lance-encoding:blob field metadata. For file format >= 2.2, lance-core requires the blob v2 Arrow extension type
(ARROW:extension:name = "lance.blob.v2") with a Struct<data: LargeBinary?, uri: Utf8?> schema instead.

Proposed Changes

  1. When file_format_version >= 2.2 and blob encoding is requested, emit the blob v2 extension type metadata and struct schema instead of legacy metadata.
  2. Update BlobUtils to add blob v2 constants and detection.
  3. Update LanceArrowUtils.scala to handle the blob v2 struct type on the read path.
  4. Keep legacy behavior for file_format_version < 2.2.

Workaround

Use 'file_format_version' = '2.1' with legacy blob encoding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions