Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: json schema serializes field metadata #3379

Merged
merged 3 commits into from
Jan 14, 2025
Merged

fix: json schema serializes field metadata #3379

merged 3 commits into from
Jan 14, 2025

Conversation

albertlockett
Copy link
Contributor

fixes: #3378

@github-actions github-actions bot added the bug Something isn't working label Jan 14, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.49%. Comparing base (26eb471) to head (5406a2d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3379      +/-   ##
==========================================
+ Coverage   78.45%   78.49%   +0.04%     
==========================================
  Files         250      250              
  Lines       90189    90243      +54     
  Branches    90189    90243      +54     
==========================================
+ Hits        70758    70838      +80     
+ Misses      16525    16503      -22     
+ Partials     2906     2902       -4     
Flag Coverage Δ
unittests 78.49% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@westonpace westonpace left a comment

Choose a reason for hiding this comment

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

Some minor suggestions but seems ok. I don't really know what we use the JSON serialization for so I'm not sure I can consider all downstream implications.

@@ -172,6 +172,9 @@ pub struct JsonField {
#[serde(rename = "type")]
type_: JsonDataType,
nullable: bool,

#[serde(skip_serializing_if = "Option::is_none")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Not super important but would it be possible to do skip_serializing_if = "HashMap::is_empty" and then skip the option? I'm not sure if that is more or less clear.]

Hmm...maybe this won't work on deserialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking we'd keep this as Option::is_none as it maintains consistency with how we're currently handling this for schema metadata

rust/lance/src/arrow/json.rs Outdated Show resolved Hide resolved
@albertlockett
Copy link
Contributor Author

Some minor suggestions but seems ok. I don't really know what we use the JSON serialization for so I'm not sure I can consider all downstream implications.

Thanks @westonpace -- fwiw at least once use case we have for Json schema serialization is that lancedb cloud uses it (specifically in the response to calling .schema() on a remote table.

@albertlockett albertlockett merged commit 4d77d7b into main Jan 14, 2025
30 checks passed
@albertlockett albertlockett deleted the albert/3378 branch January 14, 2025 18:51
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.

Field metadata is not available on JSON arrow schema
3 participants