Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ authors = [
"Jorge Leitao <jorgecarleitao@gmail.com>",
"Chandra Penke <chandrapenke@gmail.com>",
]
version = "0.11.4"
version = "0.12.0"
edition = "2021"
license = "Apache-2.0 OR MIT"
keywords = ["Arrow", "arrow"]
repository = "https://github.com/Swoorup/arrow-convert"

[workspace.dependencies]
arrow_convert = { path = "arrow_convert", version = "0.11.4" }
arrow_convert_derive = { path = "arrow_convert_derive", version = "0.11.4" }
arrow_convert = { path = "arrow_convert" }
arrow_convert_derive = { path = "arrow_convert_derive" }

arrow = { version = "57", default-features = false }
arrow-array = { version = "57" }
arrow-buffer = { version = "57" }
arrow-data = { version = "57" }
arrow-schema = { version = "57" }
arrow = { version = "59", default-features = false }
arrow-array = { version = "59" }
arrow-buffer = { version = "59" }
arrow-data = { version = "59" }
arrow-schema = { version = "59" }
chrono = { version = "0.4", default-features = false }
criterion = "0.7"
err-derive = "0.3"
Expand Down
18 changes: 5 additions & 13 deletions arrow_convert_derive/src/derive_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,17 @@ pub fn expand_field(input: DeriveEnum) -> TokenStream {
..
} = (&input).into();

let num_variants = syn::LitInt::new(
&format!("{}", variant_types.len()),
proc_macro2::Span::call_site(),
);

quote! {
impl arrow_convert::field::ArrowField for #original_name {
type Type = Self;

fn data_type() -> arrow::datatypes::DataType {
arrow::datatypes::DataType::Union(
arrow::datatypes::UnionFields::new(
0..#num_variants, // basically union tag id or here called type_id
vec![
#(
<#variant_types as arrow_convert::field::ArrowField>::field(#variant_names_str),
)*
]
),
arrow::datatypes::UnionFields::from_fields(vec![
#(
<#variant_types as arrow_convert::field::ArrowField>::field(#variant_names_str),
)*
]),
#union_type,
)
}
Expand Down
Loading