-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
ARROW-2385: [Rust] implement to_json for DataType and Field #1829
Conversation
use serde_json::Value; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
pub enum ArrowError { |
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.
There is one of these in errors.rs
FYI
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.
+1, LGTM
fn test_define_schema() { | ||
let _person = Schema::new(vec![ | ||
fn create_struct_type() { | ||
let _person = DataType::Struct(vec![ |
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.
@andygrove are we still using Schema? The tests now all reference Vecs of fields in a single DataType.
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 Schema is becoming redundant. I'm still using it in my project to define a RecordBatch
but I could switch to using a Vec<Field>
instead. Do you want to file a JIRA for removing Schema?
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.
OK, though to what extent should we mirror https://arrow.apache.org/docs/metadata.html?
That would make a Schema
of Field
s.
Struct(Vec<Field>)
would go from a variant of DataType
to defined as children
on a Field
, whose type was only Struct
?
(tbc these are low confidence and I'm only recently learning, so shoot me down if I'm off)
Note that this PR also moves some tests for comparing arrays from Array to Buffer and removes some redundant code that was implemented before it was possible to get a type-safe Iterator from Buffer.
This change was made in this PR because the serde_json crate's macros pretty much forced me to address this now.