Skip to content

feat(spec): Expose DataFile serde functions #1563

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CTTY
Copy link
Contributor

@CTTY CTTY commented Jul 30, 2025

Which issue does this PR close?

What changes are included in this PR?

  • Added functions to provide serde for DataFile
  • Have DataFileSerde::try_from take in FormatVersion directly

Are these changes tested?

Added uts

@CTTY CTTY changed the title Expose DataFile serde functions feat(spec): Expose DataFile serde functions Jul 30, 2025
@CTTY CTTY marked this pull request as ready for review July 30, 2025 04:52
"referenced_data_file": null,
"content_offset": null,
"content_size_in_bytes": null
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After some tinkering, I think using serde_json::Value to check the json output gives the most readable test.

Also I found a tricky corner case: DataFile's serializer won't preserve the order of DataFile's array like column_sizes. Right now I just make the array sizes to be one to work around that, maybe there is a better solution?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I found a tricky corner case: DataFile's serializer won't preserve the order of DataFile's array like column_sizes. Right now I just make the array sizes to be one to work around that, maybe there is a better solution?

I guess the randomness comes from HashMap, but since now you use serde_json::Value to do the check, I guess the order doesn't matter?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems it still matters in below outtput. One approach is to change this function to make it determined:

#[cfg(test)]
// sort the keys.

Copy link
Contributor

@liurenjie1024 liurenjie1024 left a comment

Choose a reason for hiding this comment

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

Thanks @CTTY for this PR, generally looks good!

"referenced_data_file": null,
"content_offset": null,
"content_size_in_bytes": null
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Also I found a tricky corner case: DataFile's serializer won't preserve the order of DataFile's array like column_sizes. Right now I just make the array sizes to be one to work around that, maybe there is a better solution?

I guess the randomness comes from HashMap, but since now you use serde_json::Value to do the check, I guess the order doesn't matter?

"referenced_data_file": null,
"content_offset": null,
"content_size_in_bytes": null
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems it still matters in below outtput. One approach is to change this function to make it determined:

#[cfg(test)]
// sort the keys.

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.

Expose DataFileSerde as functions
2 participants