From c3ab79f3b1e503b7008b3612593df40da34150da Mon Sep 17 00:00:00 2001 From: liyixin <601947961@qq.com> Date: Tue, 13 Jun 2023 10:54:38 +0800 Subject: [PATCH] update planus version and regenerate code --- Cargo.toml | 9 +- src/ipc/generated.rs | 11927 ++++++++++++++++++++++++++++++++++------- 2 files changed, 10125 insertions(+), 1811 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index be3829c..02a9766 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,14 +6,17 @@ license = "Apache-2.0" homepage = "https://github.com/DataEngineeringLabs/arrow-format" repository = "https://github.com/DataEngineeringLabs/arrow-format" authors = ["Jorge C. Leitao "] -keywords = [ "arrow", "analytics" ] +keywords = ["arrow", "analytics"] description = "Unofficial flatbuffers and tonic code of Apache Arrow spec" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -planus = { version = "0.3.1", optional = true } -serde = { version = "1", optional = true, default-features = false, features = ["derive", "std"] } +planus = { version = "0.4.0", optional = true } +serde = { version = "1", optional = true, default-features = false, features = [ + "derive", + "std", +] } tonic = { version = "0.8.0", optional = true } prost = { version = "0.11.0", optional = true } prost-derive = { version = "0.11.0", optional = true } diff --git a/src/ipc/generated.rs b/src/ipc/generated.rs index a21908c..c15f9ff 100644 --- a/src/ipc/generated.rs +++ b/src/ipc/generated.rs @@ -1,109 +1,171 @@ pub use root::*; + +const _: () = ::planus::check_version_compatibility("planus-0.4.0"); + +/// The root namespace +/// +/// Generated from these locations: +/// * File `File.fbs` #[no_implicit_prelude] mod root { + /// The namespace `org` + /// + /// Generated from these locations: + /// * File `File.fbs` pub mod org { + /// The namespace `org.apache` + /// + /// Generated from these locations: + /// * File `File.fbs` pub mod apache { + /// The namespace `org.apache.arrow` + /// + /// Generated from these locations: + /// * File `File.fbs` pub mod arrow { + /// The namespace `org.apache.arrow.flatbuf` + /// + /// Generated from these locations: + /// * File `File.fbs` + /// * File `Schema.fbs` + /// * File `Message.fbs` + /// * File `SparseTensor.fbs` + /// * File `Tensor.fbs` pub mod flatbuf { - #[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)] + /// ---------------------------------------------------------------------- + /// Arrow File metadata + /// + /// + /// Generated from these locations: + /// * Table `Footer` in the file `File.fbs:26` + #[derive( + Clone, + Debug, + PartialEq, + PartialOrd, + Eq, + Ord, + Hash, + ::serde::Serialize, + ::serde::Deserialize, + )] pub struct Footer { + /// The field `version` in the table `Footer` pub version: self::MetadataVersion, + /// The field `schema` in the table `Footer` pub schema: ::core::option::Option<::planus::alloc::boxed::Box>, + /// The field `dictionaries` in the table `Footer` pub dictionaries: ::core::option::Option<::planus::alloc::vec::Vec>, + /// The field `recordBatches` in the table `Footer` pub record_batches: ::core::option::Option<::planus::alloc::vec::Vec>, + /// User-defined metadata pub custom_metadata: ::core::option::Option<::planus::alloc::vec::Vec>, } + #[allow(clippy::derivable_impls)] + impl ::core::default::Default for Footer { + fn default() -> Self { + Self { + version: self::MetadataVersion::V1, + schema: ::core::default::Default::default(), + dictionaries: ::core::default::Default::default(), + record_batches: ::core::default::Default::default(), + custom_metadata: ::core::default::Default::default(), + } + } + } + impl Footer { + /// Creates a [FooterBuilder] for serializing an instance of this table. + #[inline] + pub fn builder() -> FooterBuilder<()> { + FooterBuilder(()) + } + #[allow(clippy::too_many_arguments)] pub fn create( builder: &mut ::planus::Builder, - version: impl ::planus::WriteAsDefault< + field_version: impl ::planus::WriteAsDefault< self::MetadataVersion, self::MetadataVersion, >, - schema: impl ::planus::WriteAsOptional<::planus::Offset>, - dictionaries: impl ::planus::WriteAsOptional< + field_schema: impl ::planus::WriteAsOptional<::planus::Offset>, + field_dictionaries: impl ::planus::WriteAsOptional< ::planus::Offset<[self::Block]>, >, - record_batches: impl ::planus::WriteAsOptional< + field_record_batches: impl ::planus::WriteAsOptional< ::planus::Offset<[self::Block]>, >, - custom_metadata: impl ::planus::WriteAsOptional< + field_custom_metadata: impl ::planus::WriteAsOptional< ::planus::Offset<[::planus::Offset]>, >, ) -> ::planus::Offset { let prepared_version = - version.prepare(builder, &self::MetadataVersion::V1); - - let prepared_schema = schema.prepare(builder); - - let prepared_dictionaries = dictionaries.prepare(builder); - - let prepared_record_batches = record_batches.prepare(builder); - - let prepared_custom_metadata = custom_metadata.prepare(builder); - - let mut table_writer = - ::planus::table_writer::TableWriter::<12, 18>::new(builder); - - if prepared_version.is_some() { - table_writer.calculate_size::(2); - } + field_version.prepare(builder, &self::MetadataVersion::V1); + let prepared_schema = field_schema.prepare(builder); + let prepared_dictionaries = field_dictionaries.prepare(builder); + let prepared_record_batches = field_record_batches.prepare(builder); + let prepared_custom_metadata = field_custom_metadata.prepare(builder); + + let mut table_writer: ::planus::table_writer::TableWriter<14> = + ::core::default::Default::default(); if prepared_schema.is_some() { - table_writer.calculate_size::<::planus::Offset>(4); + table_writer.write_entry::<::planus::Offset>(1); } if prepared_dictionaries.is_some() { - table_writer.calculate_size::<::planus::Offset<[self::Block]>>(6); + table_writer.write_entry::<::planus::Offset<[self::Block]>>(2); } if prepared_record_batches.is_some() { - table_writer.calculate_size::<::planus::Offset<[self::Block]>>(8); + table_writer.write_entry::<::planus::Offset<[self::Block]>>(3); } if prepared_custom_metadata.is_some() { - table_writer.calculate_size::<::planus::Offset<[::planus::Offset]>>(10); + table_writer.write_entry::<::planus::Offset<[::planus::Offset]>>(4); + } + if prepared_version.is_some() { + table_writer.write_entry::(0); } - - table_writer.finish_calculating(); unsafe { - if let ::core::option::Option::Some(prepared_schema) = - prepared_schema - { - table_writer.write::<_, _, 4>(1, &prepared_schema); - } - if let ::core::option::Option::Some(prepared_dictionaries) = - prepared_dictionaries - { - table_writer.write::<_, _, 4>(2, &prepared_dictionaries); - } - if let ::core::option::Option::Some(prepared_record_batches) = - prepared_record_batches - { - table_writer.write::<_, _, 4>(3, &prepared_record_batches); - } - if let ::core::option::Option::Some(prepared_custom_metadata) = - prepared_custom_metadata - { - table_writer.write::<_, _, 4>(4, &prepared_custom_metadata); - } - if let ::core::option::Option::Some(prepared_version) = - prepared_version - { - table_writer.write::<_, _, 2>(0, &prepared_version); - } + table_writer.finish(builder, |object_writer| { + if let ::core::option::Option::Some(prepared_schema) = + prepared_schema + { + object_writer.write::<_, _, 4>(&prepared_schema); + } + if let ::core::option::Option::Some(prepared_dictionaries) = + prepared_dictionaries + { + object_writer.write::<_, _, 4>(&prepared_dictionaries); + } + if let ::core::option::Option::Some(prepared_record_batches) = + prepared_record_batches + { + object_writer.write::<_, _, 4>(&prepared_record_batches); + } + if let ::core::option::Option::Some(prepared_custom_metadata) = + prepared_custom_metadata + { + object_writer.write::<_, _, 4>(&prepared_custom_metadata); + } + if let ::core::option::Option::Some(prepared_version) = + prepared_version + { + object_writer.write::<_, _, 2>(&prepared_version); + } + }); } - - table_writer.finish() + builder.current_offset() } } impl ::planus::WriteAs<::planus::Offset