Skip to content

fix: inconsistency inline constant handling for non‑fixed‑stride datatype#5851

Open
zhangyue19921010 wants to merge 3 commits intolance-format:mainfrom
zhangyue19921010:fix-inconsistency
Open

fix: inconsistency inline constant handling for non‑fixed‑stride datatype#5851
zhangyue19921010 wants to merge 3 commits intolance-format:mainfrom
zhangyue19921010:fix-inconsistency

Conversation

@zhangyue19921010
Copy link
Contributor

Encoding side (rust/lance-arrow/src/scalar.rs)

try_inline_value decides whether a scalar value can be written inline. The old logic only checked that:

  • the scalar is non-null and a single value
  • it has no child data
  • there is only one buffer
  • the inline size does not exceed the threshold

However, it did not verify that the data type is fixed-stride or not. TAKE BOOLEAN AS EXAMPLE

Decoding side (decode_scalar_from_inline_value)

Decoding explicitly requires data_type.byte_width_opt() to be present; otherwise it errors out:

  • Inline constant is not supported for non-fixed-stride data type Boolean.

This creates an inconsistency between the encoder and decoder.

Without this fix, new added unit test test_constant_layout_out_of_line_boolean_v2_2 and similar scenarios will report errors

called `Result::unwrap()` on an `Err` value: Arrow { message: "Invalid argument error: 
Inline constant is not supported for non-fixed-stride data type Boolean", 
location: Location { file: "rust/lance-encoding/src/encodings/logical/primitive/constant.rs", line: 246, column: 59 } }

@github-actions github-actions bot added the bug Something isn't working label Jan 29, 2026
@zhangyue19921010
Copy link
Contributor Author

Hi @Xuanwo , would u mind to take a look at your convenient? Thanks!

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../lance-encoding/src/encodings/logical/primitive.rs 89.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant