fix: undefined values should become null in nullable fields#2658
Merged
wjones127 merged 7 commits intolancedb:mainfrom Sep 23, 2025
Merged
fix: undefined values should become null in nullable fields#2658wjones127 merged 7 commits intolancedb:mainfrom
wjones127 merged 7 commits intolancedb:mainfrom
Conversation
wjones127
reviewed
Sep 15, 2025
Contributor
wjones127
left a comment
There was a problem hiding this comment.
Thanks for doing this. It looks like something went wrong with the formatter or linter and there are lot of irrelevant changes as well as a CI failure. Happy to merge once that is fixed.
Comment on lines
+1014
to
+1015
| // Test for the undefined values bug fix | ||
| describe("undefined values handling", () => { |
Previously undefined values were coerced to default values (false, NaN, '') instead of null for nullable fields. Now undefined values are properly converted to null when fields are marked as nullable in the schema.
Contributor
Author
|
@wjones127 |
wjones127
approved these changes
Sep 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix: Undefined Values in Nullable Fields
Issue: When inserting data with
undefinedvalues into nullable fields, LanceDB was incorrectly coercing them to default values (falsefor booleans,NaNfor numbers,""for strings) instead ofnull.Fix: Modified the
makeVector()function inarrow.tsto properly convertundefinedvalues tonullfor nullable fields before passing data to Apache Arrow.fixes: #2645
Result: Now
{ text: undefined, number: undefined, bool: undefined }correctly becomes{ text: null, number: null, bool: null }when fields are marked as nullable in the schema.Files Changed:
nodejs/lancedb/arrow.ts(core fix)nodejs/__test__/arrow.test.ts(test coverage)This ensures proper null handling for nullable fields as expected by users.