Skip to content

Conversation

@westonpace
Copy link
Member

This is a minor simplification of the recently added map support. It does not add any functionality, only simplifies the code slightly. The current implementation creates a StructuralMapEncoder which mimics the StructuralListEncoder. This change instead wraps the StructuralListEncoder (composition instead of duplication). As a result we can get rid of the StructuralMapScheduler. The decoder then simply casts from a list array to a map array.

Since the list encoder is so simple this isn't really saving us a ton of work. However, if we choose to experiment or add new complicated features to the list encoder in the future then this will help us avoid doing the work twice or missing the changes in the map encoder.

@github-actions
Copy link
Contributor

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@westonpace
Copy link
Member Author

CC @xloya do you mind reviewing? I don't feel super strongly about this so if you prefer the old approach that is ok too. Still, I think if we can avoid the map encoder having its own logic that will be helpful.

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 84.48276% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-encoding/src/encodings/logical/map.rs 84.44% 5 Missing and 2 partials ⚠️
rust/lance-encoding/src/decoder.rs 85.71% 1 Missing ⚠️
...ust/lance-encoding/src/encodings/logical/struct.rs 83.33% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@xloya
Copy link
Contributor

xloya commented Dec 18, 2025

I think this optimization is great! There's only one issue regarding the list field naming.

as Box<dyn StructuralFieldScheduler>)

let list_field = Field::try_from(ArrowField::new(
field.name.clone(),
Copy link
Contributor

@xloya xloya Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the name of entries_field here?

}
let child_decoder = Self::field_to_decoder(entries_field, should_validate)?;
let list_field = Arc::new(arrow_schema::Field::new(
field.name().clone(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about name

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants