-
Notifications
You must be signed in to change notification settings - Fork 194
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
refactor: Removing type infromation in Struct
literal.
#103
Closed
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
44d238c
Initial commit - Updated values.rs
mobley-trent 4f7d777
Updated values.rs
mobley-trent a0dd0b3
Updated values.rs
mobley-trent e232a64
Temporarily disabled From<Literal> for JsonValue
mobley-trent 6033c09
Merge branch 'main' of https://github.com/apache/iceberg-rust into ty…
mobley-trent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @liurenjie1024 how should we design this method ? Since the iterator only return the value instead of the
(id, value, name)
tuple. I'm having trouble setting up the test for this method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I used
enumerate
to account for the id property in the json object. I don't know if this is the correct procedure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late reply. Is this method really useful? I think we should expose this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the this
Struct
method supposed to return a hashmap ? The StructType for iceberg requires a NestedField with the id and value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's supposed to return an json object, and the field names should match struct field names. But this is not feasible without schema. This method is the correct approach I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mean we should remove the total implementation of
From<&Literal> for JsonValue
. Since we have decided to remove type info forStruct
, this method signature is incorrect. The conversion from/to json should delegate to ser/de module.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serde_json
doesn't seem to have a method to extract the JsonValue from the Literal. This was only possible throughFrom<&Literal> for JsonValue
This line raises a compiler error when I removed
From<&Literal> for JsonValue
Error:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, after removing this, directly ser/de from json no longer works. The correct way to do this is to ser/de is using the ser/de module, you can see this method as example. It delegates ser/de to serializaiton/deserialization system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you are saying I should refactor
check_json_serde
to follow the structure ofcheck_convert_with_avro
?Also just a reminder, but the code doesn't build when I remove
From<&values::Literal>
so I don't think removing it entirely will work @liurenjie1024There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @mobley-trent Yes, we are planning to delegate conversion between literal values and json values to ser/de module, just like what we did with avro. You're right complete removing
From<&values::Literal>
will not work before that. I think we can hold on this pr before that the json conversion was finished.