This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new ceda7b5 ARROW-7207: [Rust] Update generated fbs files
ceda7b5 is described below
commit ceda7b5633b2a5a265841eca61432f28216f0717
Author: Neville Dipale <[email protected]>
AuthorDate: Tue Nov 19 18:05:10 2019 -0700
ARROW-7207: [Rust] Update generated fbs files
Mainly adds large list types and some changes to tensors, which we don't
yet use in Rust.
Closes #5864 from nevi-me/ARROW-7207 and squashes the following commits:
476e71b55 <Neville Dipale> ARROW-7207: Update generated fbs files
Authored-by: Neville Dipale <[email protected]>
Signed-off-by: Andy Grove <[email protected]>
---
rust/arrow/README.md | 2 +-
rust/arrow/src/ipc/convert.rs | 14 +-
rust/arrow/src/ipc/gen/File.rs | 5 +-
rust/arrow/src/ipc/gen/Message.rs | 36 +--
rust/arrow/src/ipc/gen/Schema.rs | 543 ++++++++++++++++++++++++++-------
rust/arrow/src/ipc/gen/SparseTensor.rs | 263 ++++++++++++----
rust/arrow/src/ipc/gen/Tensor.rs | 85 ++++--
7 files changed, 724 insertions(+), 224 deletions(-)
diff --git a/rust/arrow/README.md b/rust/arrow/README.md
index 7dffc34..cb21985 100644
--- a/rust/arrow/README.md
+++ b/rust/arrow/README.md
@@ -60,7 +60,7 @@ flatc --rust -o rust/arrow/src/ipc/gen/ format/*.fbs
Some manual steps were then performed:
-- Replace `type__type` with `type_type`
+- Replace `type__` with `type_`
- Remove `org::apache::arrow::flatbuffers` namespace
- Add includes to each generated file
diff --git a/rust/arrow/src/ipc/convert.rs b/rust/arrow/src/ipc/convert.rs
index 97fcde0..a928a00 100644
--- a/rust/arrow/src/ipc/convert.rs
+++ b/rust/arrow/src/ipc/convert.rs
@@ -86,7 +86,7 @@ fn get_data_type(field: ipc::Field) -> DataType {
match field.type_type() {
ipc::Type::Bool => DataType::Boolean,
ipc::Type::Int => {
- let int = field.type__as_int().unwrap();
+ let int = field.type_as_int().unwrap();
match (int.bitWidth(), int.is_signed()) {
(8, true) => DataType::Int8,
(8, false) => DataType::UInt8,
@@ -102,11 +102,11 @@ fn get_data_type(field: ipc::Field) -> DataType {
ipc::Type::Binary => DataType::Binary,
ipc::Type::Utf8 => DataType::Utf8,
ipc::Type::FixedSizeBinary => {
- let fsb = field.type__as_fixed_size_binary().unwrap();
+ let fsb = field.type_as_fixed_size_binary().unwrap();
DataType::FixedSizeBinary(fsb.byteWidth())
}
ipc::Type::FloatingPoint => {
- let float = field.type__as_floating_point().unwrap();
+ let float = field.type_as_floating_point().unwrap();
match float.precision() {
ipc::Precision::HALF => DataType::Float16,
ipc::Precision::SINGLE => DataType::Float32,
@@ -114,14 +114,14 @@ fn get_data_type(field: ipc::Field) -> DataType {
}
}
ipc::Type::Date => {
- let date = field.type__as_date().unwrap();
+ let date = field.type_as_date().unwrap();
match date.unit() {
ipc::DateUnit::DAY => DataType::Date32(DateUnit::Day),
ipc::DateUnit::MILLISECOND =>
DataType::Date64(DateUnit::Millisecond),
}
}
ipc::Type::Time => {
- let time = field.type__as_time().unwrap();
+ let time = field.type_as_time().unwrap();
match (time.bitWidth(), time.unit()) {
(32, ipc::TimeUnit::SECOND) =>
DataType::Time32(TimeUnit::Second),
(32, ipc::TimeUnit::MILLISECOND) => {
@@ -138,7 +138,7 @@ fn get_data_type(field: ipc::Field) -> DataType {
}
}
ipc::Type::Timestamp => {
- let timestamp = field.type__as_timestamp().unwrap();
+ let timestamp = field.type_as_timestamp().unwrap();
match timestamp.unit() {
ipc::TimeUnit::SECOND => DataType::Timestamp(TimeUnit::Second),
ipc::TimeUnit::MILLISECOND =>
DataType::Timestamp(TimeUnit::Millisecond),
@@ -161,7 +161,7 @@ fn get_data_type(field: ipc::Field) -> DataType {
panic!("expect a list to have one child")
}
let child_field = children.get(0);
- let fsl = field.type__as_fixed_size_list().unwrap();
+ let fsl = field.type_as_fixed_size_list().unwrap();
DataType::FixedSizeList((
Box::new(get_data_type(child_field)),
fsl.listSize(),
diff --git a/rust/arrow/src/ipc/gen/File.rs b/rust/arrow/src/ipc/gen/File.rs
index f5ee273..1dac1a6 100644
--- a/rust/arrow/src/ipc/gen/File.rs
+++ b/rust/arrow/src/ipc/gen/File.rs
@@ -100,11 +100,12 @@ impl Block {
}
}
-/// ----------------------------------------------------------------------
-/// Arrow File metadata
pub enum FooterOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// Arrow File metadata
+///
pub struct Footer<'a> {
pub _tab: flatbuffers::Table<'a>,
}
diff --git a/rust/arrow/src/ipc/gen/Message.rs
b/rust/arrow/src/ipc/gen/Message.rs
index 0cd88b1..dd3ca6e 100644
--- a/rust/arrow/src/ipc/gen/Message.rs
+++ b/rust/arrow/src/ipc/gen/Message.rs
@@ -41,7 +41,7 @@ use flatbuffers::EndianScalar;
/// it is best to send data using RecordBatch
#[allow(non_camel_case_types)]
#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum MessageHeader {
NONE = 0,
Schema = 1,
@@ -106,8 +106,8 @@ const ENUM_NAMES_MESSAGE_HEADER: [&'static str; 6] = [
];
pub fn enum_name_message_header(e: MessageHeader) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_MESSAGE_HEADER[index]
+ let index = e as u8;
+ ENUM_NAMES_MESSAGE_HEADER[index as usize]
}
pub struct MessageHeaderUnionTableOffset {}
@@ -117,9 +117,9 @@ pub struct MessageHeaderUnionTableOffset {}
/// Metadata about a field at some level of a nested type tree (but not
/// its children).
///
-/// For example, a `List<Int16>` with values `[[1, 2, 3], null, [4], [5, 6],
null]`
-/// would have `{length: 5, null_count: 2}` for its `List` node, and `{length:
6,
-/// null_count: 0}` for its `Int16` node, as separate `FieldNode` structs
+/// For example, a List<Int16> with values [[1, 2, 3], null, [4], [5, 6], null]
+/// would have {length: 5, null_count: 2} for its List node, and {length: 6,
+/// null_count: 0} for its Int16 node, as separate FieldNode structs
// struct FieldNode, aligned to 8
#[repr(C, align(8))]
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -190,12 +190,12 @@ impl FieldNode {
}
}
-/// A data header describing the shared memory layout of a "record" or "row"
-/// batch. Some systems call this a "row batch" internally and others a "record
-/// batch".
pub enum RecordBatchOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// A data header describing the shared memory layout of a "record" or "row"
+/// batch. Some systems call this a "row batch" internally and others a "record
+/// batch".
pub struct RecordBatch<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -330,15 +330,15 @@ impl<'a: 'b, 'b> RecordBatchBuilder<'a, 'b> {
}
}
+pub enum DictionaryBatchOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
/// For sending dictionary encoding information. Any Field can be
/// dictionary-encoded, but in this case none of its children may be
/// dictionary-encoded.
/// There is one vector / column per dictionary, but that vector / column
/// may be spread across multiple dictionary batches by using the isDelta
/// flag
-pub enum DictionaryBatchOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
-
pub struct DictionaryBatch<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -529,14 +529,14 @@ impl<'a> Message<'a> {
#[inline]
pub fn custom_metadata(
&self,
- ) ->
Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>,
>>(Message::VT_CUSTOM_METADATA, None)
}
#[inline]
#[allow(non_snake_case)]
- pub fn header_as_schema(&'a self) -> Option<Schema> {
+ pub fn header_as_schema(&self) -> Option<Schema<'a>> {
if self.header_type() == MessageHeader::Schema {
self.header().map(|u| Schema::init_from_table(u))
} else {
@@ -546,7 +546,7 @@ impl<'a> Message<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn header_as_dictionary_batch(&'a self) -> Option<DictionaryBatch> {
+ pub fn header_as_dictionary_batch(&self) -> Option<DictionaryBatch<'a>> {
if self.header_type() == MessageHeader::DictionaryBatch {
self.header().map(|u| DictionaryBatch::init_from_table(u))
} else {
@@ -556,7 +556,7 @@ impl<'a> Message<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn header_as_record_batch(&'a self) -> Option<RecordBatch> {
+ pub fn header_as_record_batch(&self) -> Option<RecordBatch<'a>> {
if self.header_type() == MessageHeader::RecordBatch {
self.header().map(|u| RecordBatch::init_from_table(u))
} else {
@@ -566,7 +566,7 @@ impl<'a> Message<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn header_as_tensor(&'a self) -> Option<Tensor> {
+ pub fn header_as_tensor(&self) -> Option<Tensor<'a>> {
if self.header_type() == MessageHeader::Tensor {
self.header().map(|u| Tensor::init_from_table(u))
} else {
@@ -576,7 +576,7 @@ impl<'a> Message<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn header_as_sparse_tensor(&'a self) -> Option<SparseTensor> {
+ pub fn header_as_sparse_tensor(&self) -> Option<SparseTensor<'a>> {
if self.header_type() == MessageHeader::SparseTensor {
self.header().map(|u| SparseTensor::init_from_table(u))
} else {
diff --git a/rust/arrow/src/ipc/gen/Schema.rs b/rust/arrow/src/ipc/gen/Schema.rs
index 988072f..f6079cd 100644
--- a/rust/arrow/src/ipc/gen/Schema.rs
+++ b/rust/arrow/src/ipc/gen/Schema.rs
@@ -29,7 +29,7 @@ use flatbuffers::EndianScalar;
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum MetadataVersion {
/// 0.1.0
V1 = 0,
@@ -87,13 +87,13 @@ const ENUM_VALUES_METADATA_VERSION: [MetadataVersion; 4] = [
const ENUM_NAMES_METADATA_VERSION: [&'static str; 4] = ["V1", "V2", "V3",
"V4"];
pub fn enum_name_metadata_version(e: MetadataVersion) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_METADATA_VERSION[index]
+ let index = e as i16;
+ ENUM_NAMES_METADATA_VERSION[index as usize]
}
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum UnionMode {
Sparse = 0,
Dense = 1,
@@ -140,13 +140,13 @@ const ENUM_VALUES_UNION_MODE: [UnionMode; 2] =
[UnionMode::Sparse, UnionMode::De
const ENUM_NAMES_UNION_MODE: [&'static str; 2] = ["Sparse", "Dense"];
pub fn enum_name_union_mode(e: UnionMode) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_UNION_MODE[index]
+ let index = e as i16;
+ ENUM_NAMES_UNION_MODE[index as usize]
}
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Precision {
HALF = 0,
SINGLE = 1,
@@ -195,13 +195,13 @@ const ENUM_VALUES_PRECISION: [Precision; 3] =
const ENUM_NAMES_PRECISION: [&'static str; 3] = ["HALF", "SINGLE", "DOUBLE"];
pub fn enum_name_precision(e: Precision) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_PRECISION[index]
+ let index = e as i16;
+ ENUM_NAMES_PRECISION[index as usize]
}
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum DateUnit {
DAY = 0,
MILLISECOND = 1,
@@ -248,13 +248,13 @@ const ENUM_VALUES_DATE_UNIT: [DateUnit; 2] =
[DateUnit::DAY, DateUnit::MILLISECO
const ENUM_NAMES_DATE_UNIT: [&'static str; 2] = ["DAY", "MILLISECOND"];
pub fn enum_name_date_unit(e: DateUnit) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_DATE_UNIT[index]
+ let index = e as i16;
+ ENUM_NAMES_DATE_UNIT[index as usize]
}
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum TimeUnit {
SECOND = 0,
MILLISECOND = 1,
@@ -309,13 +309,13 @@ const ENUM_NAMES_TIME_UNIT: [&'static str; 4] =
["SECOND", "MILLISECOND", "MICROSECOND", "NANOSECOND"];
pub fn enum_name_time_unit(e: TimeUnit) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_TIME_UNIT[index]
+ let index = e as i16;
+ ENUM_NAMES_TIME_UNIT[index as usize]
}
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum IntervalUnit {
YEAR_MONTH = 0,
DAY_TIME = 1,
@@ -363,8 +363,8 @@ const ENUM_VALUES_INTERVAL_UNIT: [IntervalUnit; 2] =
const ENUM_NAMES_INTERVAL_UNIT: [&'static str; 2] = ["YEAR_MONTH", "DAY_TIME"];
pub fn enum_name_interval_unit(e: IntervalUnit) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_INTERVAL_UNIT[index]
+ let index = e as i16;
+ ENUM_NAMES_INTERVAL_UNIT[index as usize]
}
/// ----------------------------------------------------------------------
@@ -372,7 +372,7 @@ pub fn enum_name_interval_unit(e: IntervalUnit) -> &'static
str {
/// add new logical types to Type without breaking backwards compatibility
#[allow(non_camel_case_types)]
#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Type {
NONE = 0,
Null = 1,
@@ -392,10 +392,14 @@ pub enum Type {
FixedSizeBinary = 15,
FixedSizeList = 16,
Map = 17,
+ Duration = 18,
+ LargeBinary = 19,
+ LargeUtf8 = 20,
+ LargeList = 21,
}
const ENUM_MIN_TYPE: u8 = 0;
-const ENUM_MAX_TYPE: u8 = 17;
+const ENUM_MAX_TYPE: u8 = 21;
impl<'a> flatbuffers::Follow<'a> for Type {
type Inner = Self;
@@ -429,7 +433,7 @@ impl flatbuffers::Push for Type {
}
#[allow(non_camel_case_types)]
-const ENUM_VALUES_TYPE: [Type; 18] = [
+const ENUM_VALUES_TYPE: [Type; 22] = [
Type::NONE,
Type::Null,
Type::Int,
@@ -448,10 +452,14 @@ const ENUM_VALUES_TYPE: [Type; 18] = [
Type::FixedSizeBinary,
Type::FixedSizeList,
Type::Map,
+ Type::Duration,
+ Type::LargeBinary,
+ Type::LargeUtf8,
+ Type::LargeList,
];
#[allow(non_camel_case_types)]
-const ENUM_NAMES_TYPE: [&'static str; 18] = [
+const ENUM_NAMES_TYPE: [&'static str; 22] = [
"NONE",
"Null",
"Int",
@@ -470,11 +478,15 @@ const ENUM_NAMES_TYPE: [&'static str; 18] = [
"FixedSizeBinary",
"FixedSizeList",
"Map",
+ "Duration",
+ "LargeBinary",
+ "LargeUtf8",
+ "LargeList",
];
pub fn enum_name_type(e: Type) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_TYPE[index]
+ let index = e as u8;
+ ENUM_NAMES_TYPE[index as usize]
}
pub struct TypeUnionTableOffset {}
@@ -482,7 +494,7 @@ pub struct TypeUnionTableOffset {}
/// Endianness of the platform producing the data
#[allow(non_camel_case_types)]
#[repr(i16)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Endianness {
Little = 0,
Big = 1,
@@ -529,8 +541,8 @@ const ENUM_VALUES_ENDIANNESS: [Endianness; 2] =
[Endianness::Little, Endianness:
const ENUM_NAMES_ENDIANNESS: [&'static str; 2] = ["Little", "Big"];
pub fn enum_name_endianness(e: Endianness) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_ENDIANNESS[index]
+ let index = e as i16;
+ ENUM_NAMES_ENDIANNESS[index as usize]
}
/// ----------------------------------------------------------------------
@@ -595,16 +607,19 @@ impl Buffer {
self.offset_.from_little_endian()
}
/// The absolute length (in bytes) of the memory buffer. The memory is
found
- /// from offset (inclusive) to offset + length (non-inclusive).
+ /// from offset (inclusive) to offset + length (non-inclusive). When
building
+ /// messages using the encapsulated IPC message, padding bytes may be
written
+ /// after a buffer, but such padding bytes do not need to be accounted for
in
+ /// the size here.
pub fn length<'a>(&'a self) -> i64 {
self.length_.from_little_endian()
}
}
-/// These are stored in the flatbuffer in the Type union below
pub enum NullOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// These are stored in the flatbuffer in the Type union below
pub struct Null<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -661,12 +676,12 @@ impl<'a: 'b, 'b> NullBuilder<'a, 'b> {
}
}
-/// A Struct_ in the flatbuffer metadata is the same as an Arrow Struct
-/// (according to the physical memory layout). We used Struct_ here as
-/// Struct is a reserved word in Flatbuffers
pub enum Struct_Offset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// A Struct_ in the flatbuffer metadata is the same as an Arrow Struct
+/// (according to the physical memory layout). We used Struct_ here as
+/// Struct is a reserved word in Flatbuffers
pub struct Struct_<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -784,6 +799,69 @@ impl<'a: 'b, 'b> ListBuilder<'a, 'b> {
}
}
+pub enum LargeListOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
+/// Same as List, but with 64-bit offsets, allowing to represent
+/// extremely large data values.
+pub struct LargeList<'a> {
+ pub _tab: flatbuffers::Table<'a>,
+}
+
+impl<'a> flatbuffers::Follow<'a> for LargeList<'a> {
+ type Inner = LargeList<'a>;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self {
+ _tab: flatbuffers::Table { buf: buf, loc: loc },
+ }
+ }
+}
+
+impl<'a> LargeList<'a> {
+ #[inline]
+ pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
+ LargeList { _tab: table }
+ }
+ #[allow(unused_mut)]
+ pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
+ _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
+ _args: &'args LargeListArgs,
+ ) -> flatbuffers::WIPOffset<LargeList<'bldr>> {
+ let mut builder = LargeListBuilder::new(_fbb);
+ builder.finish()
+ }
+}
+
+pub struct LargeListArgs {}
+impl<'a> Default for LargeListArgs {
+ #[inline]
+ fn default() -> Self {
+ LargeListArgs {}
+ }
+}
+pub struct LargeListBuilder<'a: 'b, 'b> {
+ fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
+}
+impl<'a: 'b, 'b> LargeListBuilder<'a, 'b> {
+ #[inline]
+ pub fn new(
+ _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ ) -> LargeListBuilder<'a, 'b> {
+ let start = _fbb.start_table();
+ LargeListBuilder {
+ fbb_: _fbb,
+ start_: start,
+ }
+ }
+ #[inline]
+ pub fn finish(self) -> flatbuffers::WIPOffset<LargeList<'a>> {
+ let o = self.fbb_.end_table(self.start_);
+ flatbuffers::WIPOffset::new(o.value())
+ }
+}
+
pub enum FixedSizeListOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
@@ -863,33 +941,33 @@ impl<'a: 'b, 'b> FixedSizeListBuilder<'a, 'b> {
}
}
+pub enum MapOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
/// A Map is a logical nested type that is represented as
///
-/// List<entry: Struct<key: K, value: V>>
+/// List<entries: Struct<key: K, value: V>>
///
/// In this layout, the keys and values are each respectively contiguous. We do
/// not constrain the key and value types, so the application is responsible
/// for ensuring that the keys are hashable and unique. Whether the keys are
sorted
-/// may be set in the metadata for this field
+/// may be set in the metadata for this field.
///
-/// In a Field with Map type, the Field has a child Struct field, which then
+/// In a field with Map type, the field has a child Struct field, which then
/// has two children: key type and the second the value type. The names of the
-/// child fields may be respectively "entry", "key", and "value", but this is
-/// not enforced
+/// child fields may be respectively "entries", "key", and "value", but this is
+/// not enforced.
///
/// Map
-/// - `child[0]` entry: Struct
-/// - `child[0]` key: K
-/// - `child[1]` value: V
+/// - child[0] entries: Struct
+/// - child[0] key: K
+/// - child[1] value: V
///
-/// Neither the "entry" field nor the "key" field may be nullable.
+/// Neither the "entries" field nor the "key" field may be nullable.
///
/// The metadata is structured so that Arrow systems without special handling
/// for Map can make Map an alias for List. The "layout" attribute for the Map
/// field must have the same contents as a List.
-pub enum MapOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
-
pub struct Map<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -964,13 +1042,13 @@ impl<'a: 'b, 'b> MapBuilder<'a, 'b> {
}
}
-/// A union is a complex type with children in Field
-/// By default ids in the type vector refer to the offsets in the children
-/// optionally typeIds provides an indirection between the child offset and
the type id
-/// for each child `typeIds[offset]` is the id used in the type vector
pub enum UnionOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// A union is a complex type with children in Field
+/// By default ids in the type vector refer to the offsets in the children
+/// optionally typeIds provides an indirection between the child offset and
the type id
+/// for each child typeIds[offset] is the id used in the type vector
pub struct Union<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -1241,10 +1319,10 @@ impl<'a: 'b, 'b> FloatingPointBuilder<'a, 'b> {
}
}
-/// Unicode with UTF-8 encoding
pub enum Utf8Offset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// Unicode with UTF-8 encoding
pub struct Utf8<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -1304,6 +1382,7 @@ impl<'a: 'b, 'b> Utf8Builder<'a, 'b> {
pub enum BinaryOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// Opaque binary data
pub struct Binary<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -1362,6 +1441,132 @@ impl<'a: 'b, 'b> BinaryBuilder<'a, 'b> {
}
}
+pub enum LargeUtf8Offset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
+/// Same as Utf8, but with 64-bit offsets, allowing to represent
+/// extremely large data values.
+pub struct LargeUtf8<'a> {
+ pub _tab: flatbuffers::Table<'a>,
+}
+
+impl<'a> flatbuffers::Follow<'a> for LargeUtf8<'a> {
+ type Inner = LargeUtf8<'a>;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self {
+ _tab: flatbuffers::Table { buf: buf, loc: loc },
+ }
+ }
+}
+
+impl<'a> LargeUtf8<'a> {
+ #[inline]
+ pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
+ LargeUtf8 { _tab: table }
+ }
+ #[allow(unused_mut)]
+ pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
+ _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
+ _args: &'args LargeUtf8Args,
+ ) -> flatbuffers::WIPOffset<LargeUtf8<'bldr>> {
+ let mut builder = LargeUtf8Builder::new(_fbb);
+ builder.finish()
+ }
+}
+
+pub struct LargeUtf8Args {}
+impl<'a> Default for LargeUtf8Args {
+ #[inline]
+ fn default() -> Self {
+ LargeUtf8Args {}
+ }
+}
+pub struct LargeUtf8Builder<'a: 'b, 'b> {
+ fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
+}
+impl<'a: 'b, 'b> LargeUtf8Builder<'a, 'b> {
+ #[inline]
+ pub fn new(
+ _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ ) -> LargeUtf8Builder<'a, 'b> {
+ let start = _fbb.start_table();
+ LargeUtf8Builder {
+ fbb_: _fbb,
+ start_: start,
+ }
+ }
+ #[inline]
+ pub fn finish(self) -> flatbuffers::WIPOffset<LargeUtf8<'a>> {
+ let o = self.fbb_.end_table(self.start_);
+ flatbuffers::WIPOffset::new(o.value())
+ }
+}
+
+pub enum LargeBinaryOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
+/// Same as Binary, but with 64-bit offsets, allowing to represent
+/// extremely large data values.
+pub struct LargeBinary<'a> {
+ pub _tab: flatbuffers::Table<'a>,
+}
+
+impl<'a> flatbuffers::Follow<'a> for LargeBinary<'a> {
+ type Inner = LargeBinary<'a>;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self {
+ _tab: flatbuffers::Table { buf: buf, loc: loc },
+ }
+ }
+}
+
+impl<'a> LargeBinary<'a> {
+ #[inline]
+ pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
+ LargeBinary { _tab: table }
+ }
+ #[allow(unused_mut)]
+ pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
+ _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
+ _args: &'args LargeBinaryArgs,
+ ) -> flatbuffers::WIPOffset<LargeBinary<'bldr>> {
+ let mut builder = LargeBinaryBuilder::new(_fbb);
+ builder.finish()
+ }
+}
+
+pub struct LargeBinaryArgs {}
+impl<'a> Default for LargeBinaryArgs {
+ #[inline]
+ fn default() -> Self {
+ LargeBinaryArgs {}
+ }
+}
+pub struct LargeBinaryBuilder<'a: 'b, 'b> {
+ fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
+}
+impl<'a: 'b, 'b> LargeBinaryBuilder<'a, 'b> {
+ #[inline]
+ pub fn new(
+ _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ ) -> LargeBinaryBuilder<'a, 'b> {
+ let start = _fbb.start_table();
+ LargeBinaryBuilder {
+ fbb_: _fbb,
+ start_: start,
+ }
+ }
+ #[inline]
+ pub fn finish(self) -> flatbuffers::WIPOffset<LargeBinary<'a>> {
+ let o = self.fbb_.end_table(self.start_);
+ flatbuffers::WIPOffset::new(o.value())
+ }
+}
+
pub enum FixedSizeBinaryOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
@@ -1594,15 +1799,15 @@ impl<'a: 'b, 'b> DecimalBuilder<'a, 'b> {
}
}
+pub enum DateOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
/// Date is either a 32-bit or 64-bit type representing elapsed time since UNIX
/// epoch (1970-01-01), stored in either of two units:
///
-/// * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no
leap
-/// seconds), where the values are evenly divisible by 86400000
+/// * Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no
+/// leap seconds), where the values are evenly divisible by 86400000
/// * Days (32 bits) since the UNIX epoch
-pub enum DateOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
-
pub struct Date<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -1678,12 +1883,12 @@ impl<'a: 'b, 'b> DateBuilder<'a, 'b> {
}
}
-/// Time type. The physical storage type depends on the unit
-/// - SECOND and MILLISECOND: 32 bits
-/// - MICROSECOND and NANOSECOND: 64 bits
pub enum TimeOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// Time type. The physical storage type depends on the unit
+/// - SECOND and MILLISECOND: 32 bits
+/// - MICROSECOND and NANOSECOND: 64 bits
pub struct Time<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -1771,15 +1976,15 @@ impl<'a: 'b, 'b> TimeBuilder<'a, 'b> {
}
}
+pub enum TimestampOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
/// Time elapsed from the Unix epoch, 00:00:00.000 on 1 January 1970, excluding
/// leap seconds, as a 64-bit integer. Note that UNIX time does not include
/// leap seconds.
///
/// The Timestamp metadata supports both "time zone naive" and "time zone
/// aware" timestamps. Read about the timezone attribute for more detail
-pub enum TimestampOffset {}
-#[derive(Copy, Clone, Debug, PartialEq)]
-
pub struct Timestamp<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -1823,22 +2028,24 @@ impl<'a> Timestamp<'a> {
}
/// The time zone is a string indicating the name of a time zone, one of:
///
- /// * As used in the Olson time zone database (the "tz database" or
"tzdata"), such as
- /// "America/New_York"
+ /// * As used in the Olson time zone database (the "tz database" or
+ /// "tzdata"), such as "America/New_York"
/// * An absolute time zone offset of the form +XX:XX or -XX:XX, such as
+07:30
///
/// Whether a timezone string is present indicates different semantics
about
/// the data:
///
- /// * If the time zone is null or equal to an empty string, the data is
"time zone
- /// naive" and shall be displayed *as is* to the user, not localized to
the locale
- /// of the user. This data can be though of as UTC but without having
"UTC" as the
- /// time zone, it is not considered to be localized to any time zone
+ /// * If the time zone is null or equal to an empty string, the data is
"time
+ /// zone naive" and shall be displayed *as is* to the user, not localized
+ /// to the locale of the user. This data can be though of as UTC but
+ /// without having "UTC" as the time zone, it is not considered to be
+ /// localized to any time zone
///
- /// * If the time zone is set to a valid value, values can be displayed as
"localized"
- /// to that time zone, even though the underlying 64-bit integers are
identical to
- /// the same data stored in UTC. Converting between time zones is a
metadata-only
- /// operation and does not change the underlying values
+ /// * If the time zone is set to a valid value, values can be displayed as
+ /// "localized" to that time zone, even though the underlying 64-bit
+ /// integers are identical to the same data stored in UTC. Converting
+ /// between time zones is a metadata-only operation and does not change
the
+ /// underlying values
#[inline]
pub fn timezone(&self) -> Option<&'a str> {
self._tab
@@ -1976,12 +2183,92 @@ impl<'a: 'b, 'b> IntervalBuilder<'a, 'b> {
}
}
-/// ----------------------------------------------------------------------
-/// user defined key value pairs to add custom metadata to arrow
-/// key namespacing is the responsibility of the user
+pub enum DurationOffset {}
+#[derive(Copy, Clone, Debug, PartialEq)]
+
+pub struct Duration<'a> {
+ pub _tab: flatbuffers::Table<'a>,
+}
+
+impl<'a> flatbuffers::Follow<'a> for Duration<'a> {
+ type Inner = Duration<'a>;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self {
+ _tab: flatbuffers::Table { buf: buf, loc: loc },
+ }
+ }
+}
+
+impl<'a> Duration<'a> {
+ #[inline]
+ pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
+ Duration { _tab: table }
+ }
+ #[allow(unused_mut)]
+ pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
+ _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
+ args: &'args DurationArgs,
+ ) -> flatbuffers::WIPOffset<Duration<'bldr>> {
+ let mut builder = DurationBuilder::new(_fbb);
+ builder.add_unit(args.unit);
+ builder.finish()
+ }
+
+ pub const VT_UNIT: flatbuffers::VOffsetT = 4;
+
+ #[inline]
+ pub fn unit(&self) -> TimeUnit {
+ self._tab
+ .get::<TimeUnit>(Duration::VT_UNIT, Some(TimeUnit::MILLISECOND))
+ .unwrap()
+ }
+}
+
+pub struct DurationArgs {
+ pub unit: TimeUnit,
+}
+impl<'a> Default for DurationArgs {
+ #[inline]
+ fn default() -> Self {
+ DurationArgs {
+ unit: TimeUnit::MILLISECOND,
+ }
+ }
+}
+pub struct DurationBuilder<'a: 'b, 'b> {
+ fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
+}
+impl<'a: 'b, 'b> DurationBuilder<'a, 'b> {
+ #[inline]
+ pub fn add_unit(&mut self, unit: TimeUnit) {
+ self.fbb_
+ .push_slot::<TimeUnit>(Duration::VT_UNIT, unit,
TimeUnit::MILLISECOND);
+ }
+ #[inline]
+ pub fn new(
+ _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ ) -> DurationBuilder<'a, 'b> {
+ let start = _fbb.start_table();
+ DurationBuilder {
+ fbb_: _fbb,
+ start_: start,
+ }
+ }
+ #[inline]
+ pub fn finish(self) -> flatbuffers::WIPOffset<Duration<'a>> {
+ let o = self.fbb_.end_table(self.start_);
+ flatbuffers::WIPOffset::new(o.value())
+ }
+}
+
pub enum KeyValueOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// user defined key value pairs to add custom metadata to arrow
+/// key namespacing is the responsibility of the user
pub struct KeyValue<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -2076,11 +2363,11 @@ impl<'a: 'b, 'b> KeyValueBuilder<'a, 'b> {
}
}
-/// ----------------------------------------------------------------------
-/// Dictionary encoding metadata
pub enum DictionaryEncodingOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// Dictionary encoding metadata
pub struct DictionaryEncoding<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -2201,16 +2488,12 @@ impl<'a: 'b, 'b> DictionaryEncodingBuilder<'a, 'b> {
}
}
-/// ----------------------------------------------------------------------
-/// A field represents a named column in a record / row batch or child of a
-/// nested type.
-///
-/// - children is only for nested Arrow arrays
-/// - For primitive types, children will have length 0
-/// - nullable should default to true in general
pub enum FieldOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// A field represents a named column in a record / row batch or child of a
+/// nested type.
pub struct Field<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -2264,11 +2547,13 @@ impl<'a> Field<'a> {
pub const VT_CHILDREN: flatbuffers::VOffsetT = 14;
pub const VT_CUSTOM_METADATA: flatbuffers::VOffsetT = 16;
+ /// Name is not required, in i.e. a List
#[inline]
pub fn name(&self) -> Option<&'a str> {
self._tab
.get::<flatbuffers::ForwardsUOffset<&str>>(Field::VT_NAME, None)
}
+ /// Whether or not this field can contain nulls. Should be true in general.
#[inline]
pub fn nullable(&self) -> bool {
self._tab
@@ -2281,6 +2566,7 @@ impl<'a> Field<'a> {
.get::<Type>(Field::VT_TYPE_TYPE, Some(Type::NONE))
.unwrap()
}
+ /// This is the type of the decoded value if the field is dictionary
encoded.
#[inline]
pub fn type_(&self) -> Option<flatbuffers::Table<'a>> {
self._tab
@@ -2289,6 +2575,7 @@ impl<'a> Field<'a> {
None,
)
}
+ /// Present only if the field is dictionary encoded.
#[inline]
pub fn dictionary(&self) -> Option<DictionaryEncoding<'a>> {
self._tab
@@ -2297,25 +2584,28 @@ impl<'a> Field<'a> {
None,
)
}
+ /// children apply only to nested data types like Struct, List and Union.
For
+ /// primitive types children will have length 0.
#[inline]
pub fn children(
&self,
- ) -> Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Field<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<Field<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<Field<'a>>>,
>>(Field::VT_CHILDREN, None)
}
+ /// User-defined metadata
#[inline]
pub fn custom_metadata(
&self,
- ) ->
Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>,
>>(Field::VT_CUSTOM_METADATA, None)
}
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_null(&'a self) -> Option<Null> {
+ pub fn type_as_null(&self) -> Option<Null<'a>> {
if self.type_type() == Type::Null {
self.type_().map(|u| Null::init_from_table(u))
} else {
@@ -2325,7 +2615,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_int(&'a self) -> Option<Int> {
+ pub fn type_as_int(&self) -> Option<Int<'a>> {
if self.type_type() == Type::Int {
self.type_().map(|u| Int::init_from_table(u))
} else {
@@ -2335,7 +2625,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_floating_point(&'a self) -> Option<FloatingPoint> {
+ pub fn type_as_floating_point(&self) -> Option<FloatingPoint<'a>> {
if self.type_type() == Type::FloatingPoint {
self.type_().map(|u| FloatingPoint::init_from_table(u))
} else {
@@ -2345,7 +2635,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_binary(&'a self) -> Option<Binary> {
+ pub fn type_as_binary(&self) -> Option<Binary<'a>> {
if self.type_type() == Type::Binary {
self.type_().map(|u| Binary::init_from_table(u))
} else {
@@ -2355,7 +2645,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_utf_8(&'a self) -> Option<Utf8> {
+ pub fn type_as_utf_8(&self) -> Option<Utf8<'a>> {
if self.type_type() == Type::Utf8 {
self.type_().map(|u| Utf8::init_from_table(u))
} else {
@@ -2365,7 +2655,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_bool(&'a self) -> Option<Bool> {
+ pub fn type_as_bool(&self) -> Option<Bool<'a>> {
if self.type_type() == Type::Bool {
self.type_().map(|u| Bool::init_from_table(u))
} else {
@@ -2375,7 +2665,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_decimal(&'a self) -> Option<Decimal> {
+ pub fn type_as_decimal(&self) -> Option<Decimal<'a>> {
if self.type_type() == Type::Decimal {
self.type_().map(|u| Decimal::init_from_table(u))
} else {
@@ -2385,7 +2675,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_date(&'a self) -> Option<Date> {
+ pub fn type_as_date(&self) -> Option<Date<'a>> {
if self.type_type() == Type::Date {
self.type_().map(|u| Date::init_from_table(u))
} else {
@@ -2395,7 +2685,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_time(&'a self) -> Option<Time> {
+ pub fn type_as_time(&self) -> Option<Time<'a>> {
if self.type_type() == Type::Time {
self.type_().map(|u| Time::init_from_table(u))
} else {
@@ -2405,7 +2695,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_timestamp(&'a self) -> Option<Timestamp> {
+ pub fn type_as_timestamp(&self) -> Option<Timestamp<'a>> {
if self.type_type() == Type::Timestamp {
self.type_().map(|u| Timestamp::init_from_table(u))
} else {
@@ -2415,7 +2705,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_interval(&'a self) -> Option<Interval> {
+ pub fn type_as_interval(&self) -> Option<Interval<'a>> {
if self.type_type() == Type::Interval {
self.type_().map(|u| Interval::init_from_table(u))
} else {
@@ -2425,7 +2715,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_list(&'a self) -> Option<List> {
+ pub fn type_as_list(&self) -> Option<List<'a>> {
if self.type_type() == Type::List {
self.type_().map(|u| List::init_from_table(u))
} else {
@@ -2435,7 +2725,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_struct_(&'a self) -> Option<Struct_> {
+ pub fn type_as_struct_(&self) -> Option<Struct_<'a>> {
if self.type_type() == Type::Struct_ {
self.type_().map(|u| Struct_::init_from_table(u))
} else {
@@ -2445,7 +2735,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_union(&'a self) -> Option<Union> {
+ pub fn type_as_union(&self) -> Option<Union<'a>> {
if self.type_type() == Type::Union {
self.type_().map(|u| Union::init_from_table(u))
} else {
@@ -2455,7 +2745,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_fixed_size_binary(&'a self) -> Option<FixedSizeBinary> {
+ pub fn type_as_fixed_size_binary(&self) -> Option<FixedSizeBinary<'a>> {
if self.type_type() == Type::FixedSizeBinary {
self.type_().map(|u| FixedSizeBinary::init_from_table(u))
} else {
@@ -2465,7 +2755,7 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_fixed_size_list(&'a self) -> Option<FixedSizeList> {
+ pub fn type_as_fixed_size_list(&self) -> Option<FixedSizeList<'a>> {
if self.type_type() == Type::FixedSizeList {
self.type_().map(|u| FixedSizeList::init_from_table(u))
} else {
@@ -2475,13 +2765,53 @@ impl<'a> Field<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_map(&'a self) -> Option<Map> {
+ pub fn type_as_map(&self) -> Option<Map<'a>> {
if self.type_type() == Type::Map {
self.type_().map(|u| Map::init_from_table(u))
} else {
None
}
}
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_duration(&self) -> Option<Duration<'a>> {
+ if self.type_type() == Type::Duration {
+ self.type_().map(|u| Duration::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_binary(&self) -> Option<LargeBinary<'a>> {
+ if self.type_type() == Type::LargeBinary {
+ self.type_().map(|u| LargeBinary::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_utf_8(&self) -> Option<LargeUtf8<'a>> {
+ if self.type_type() == Type::LargeUtf8 {
+ self.type_().map(|u| LargeUtf8::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_list(&self) -> Option<LargeList<'a>> {
+ if self.type_type() == Type::LargeList {
+ self.type_().map(|u| LargeList::init_from_table(u))
+ } else {
+ None
+ }
+ }
}
pub struct FieldArgs<'a> {
@@ -2591,11 +2921,11 @@ impl<'a: 'b, 'b> FieldBuilder<'a, 'b> {
}
}
-/// ----------------------------------------------------------------------
-/// A Schema describes the columns in a row batch
pub enum SchemaOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// A Schema describes the columns in a row batch
pub struct Schema<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -2637,8 +2967,7 @@ impl<'a> Schema<'a> {
/// endianness of the buffer
/// it is Little Endian by default
- /// if endianness doesn't match the underlying system then the vectors
need to be
- /// converted
+ /// if endianness doesn't match the underlying system then the vectors
need to be converted
#[inline]
pub fn endianness(&self) -> Endianness {
self._tab
@@ -2648,7 +2977,7 @@ impl<'a> Schema<'a> {
#[inline]
pub fn fields(
&self,
- ) -> Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<Field<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<Field<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<Field<'a>>>,
>>(Schema::VT_FIELDS, None)
@@ -2656,7 +2985,7 @@ impl<'a> Schema<'a> {
#[inline]
pub fn custom_metadata(
&self,
- ) ->
Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>,
>>(Schema::VT_CUSTOM_METADATA, None)
diff --git a/rust/arrow/src/ipc/gen/SparseTensor.rs
b/rust/arrow/src/ipc/gen/SparseTensor.rs
index a2b21f3..31f5246 100644
--- a/rust/arrow/src/ipc/gen/SparseTensor.rs
+++ b/rust/arrow/src/ipc/gen/SparseTensor.rs
@@ -24,9 +24,14 @@
use crate::ipc::gen::Schema::*;
use crate::ipc::gen::Tensor::*;
+use std::cmp::Ordering;
+use std::mem;
+
+use flatbuffers::EndianScalar;
+
#[allow(non_camel_case_types)]
#[repr(u8)]
-#[derive(Clone, Copy, PartialEq, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum SparseTensorIndex {
NONE = 0,
SparseTensorIndexCOO = 1,
@@ -79,17 +84,44 @@ const ENUM_NAMES_SPARSE_TENSOR_INDEX: [&'static str; 3] =
["NONE", "SparseTensorIndexCOO", "SparseMatrixIndexCSR"];
pub fn enum_name_sparse_tensor_index(e: SparseTensorIndex) -> &'static str {
- let index: usize = e as usize;
- ENUM_NAMES_SPARSE_TENSOR_INDEX[index]
+ let index = e as u8;
+ ENUM_NAMES_SPARSE_TENSOR_INDEX[index as usize]
}
pub struct SparseTensorIndexUnionTableOffset {}
-/// ----------------------------------------------------------------------
-/// EXPERIMENTAL: Data structures for sparse tensors
-/// Coodinate format of sparse tensor index.
pub enum SparseTensorIndexCOOOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// EXPERIMENTAL: Data structures for sparse tensors
+/// Coodinate (COO) format of sparse tensor index.
+///
+/// COO's index list are represented as a NxM matrix,
+/// where N is the number of non-zero values,
+/// and M is the number of dimensions of a sparse tensor.
+///
+/// indicesBuffer stores the location and size of the data of this indices
+/// matrix. The value type and the stride of the indices matrix is
+/// specified in indicesType and indicesStrides fields.
+///
+/// For example, let X be a 2x3x4x5 tensor, and it has the following
+/// 6 non-zero values:
+///
+/// X[0, 1, 2, 0] := 1
+/// X[1, 1, 2, 3] := 2
+/// X[0, 2, 1, 0] := 3
+/// X[0, 1, 3, 0] := 4
+/// X[0, 1, 2, 1] := 5
+/// X[1, 2, 0, 4] := 6
+///
+/// In COO format, the index matrix of X is the following 4x6 matrix:
+///
+/// [[0, 0, 0, 0, 1, 1],
+/// [1, 1, 1, 2, 1, 2],
+/// [2, 2, 3, 1, 2, 0],
+/// [0, 1, 0, 0, 3, 4]]
+///
+/// Note that the indices are sorted in lexicographical order.
pub struct SparseTensorIndexCOO<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -118,36 +150,37 @@ impl<'a> SparseTensorIndexCOO<'a> {
if let Some(x) = args.indicesBuffer {
builder.add_indicesBuffer(x);
}
+ if let Some(x) = args.indicesStrides {
+ builder.add_indicesStrides(x);
+ }
+ if let Some(x) = args.indicesType {
+ builder.add_indicesType(x);
+ }
builder.finish()
}
- pub const VT_INDICESBUFFER: flatbuffers::VOffsetT = 4;
+ pub const VT_INDICESTYPE: flatbuffers::VOffsetT = 4;
+ pub const VT_INDICESSTRIDES: flatbuffers::VOffsetT = 6;
+ pub const VT_INDICESBUFFER: flatbuffers::VOffsetT = 8;
- /// COO's index list are represented as a NxM matrix,
- /// where N is the number of non-zero values,
- /// and M is the number of dimensions of a sparse tensor.
- /// indicesBuffer stores the location and size of this index matrix.
- /// The type of index value is long, so the stride for the index matrix is
- /// unnecessary.
- ///
- /// For example, let X be a 2x3x4x5 tensor, and it has the following 6
non-zero
- /// values:
- ///
- /// X[0, 1, 2, 0] := 1
- /// X[1, 1, 2, 3] := 2
- /// X[0, 2, 1, 0] := 3
- /// X[0, 1, 3, 0] := 4
- /// X[0, 1, 2, 1] := 5
- /// X[1, 2, 0, 4] := 6
- ///
- /// In COO format, the index matrix of X is the following 4x6 matrix:
- ///
- /// [[0, 0, 0, 0, 1, 1],
- /// [1, 1, 1, 2, 1, 2],
- /// [2, 2, 3, 1, 2, 0],
- /// [0, 1, 0, 0, 3, 4]]
- ///
- /// Note that the indices are sorted in lexicographical order.
+ /// The type of values in indicesBuffer
+ #[inline]
+ pub fn indicesType(&self) -> Option<Int<'a>> {
+ self._tab.get::<flatbuffers::ForwardsUOffset<Int<'a>>>(
+ SparseTensorIndexCOO::VT_INDICESTYPE,
+ None,
+ )
+ }
+ /// Non-negative byte offsets to advance one value cell along each
dimension
+ #[inline]
+ pub fn indicesStrides(&self) -> Option<flatbuffers::Vector<'a, i64>> {
+ self._tab
+ .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, i64>>>(
+ SparseTensorIndexCOO::VT_INDICESSTRIDES,
+ None,
+ )
+ }
+ /// The location and size of the indices matrix's data
#[inline]
pub fn indicesBuffer(&self) -> Option<&'a Buffer> {
self._tab
@@ -156,12 +189,16 @@ impl<'a> SparseTensorIndexCOO<'a> {
}
pub struct SparseTensorIndexCOOArgs<'a> {
+ pub indicesType: Option<flatbuffers::WIPOffset<Int<'a>>>,
+ pub indicesStrides: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a,
i64>>>,
pub indicesBuffer: Option<&'a Buffer>,
}
impl<'a> Default for SparseTensorIndexCOOArgs<'a> {
#[inline]
fn default() -> Self {
SparseTensorIndexCOOArgs {
+ indicesType: None,
+ indicesStrides: None,
indicesBuffer: None,
}
}
@@ -172,6 +209,23 @@ pub struct SparseTensorIndexCOOBuilder<'a: 'b, 'b> {
}
impl<'a: 'b, 'b> SparseTensorIndexCOOBuilder<'a, 'b> {
#[inline]
+ pub fn add_indicesType(&mut self, indicesType:
flatbuffers::WIPOffset<Int<'b>>) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Int>>(
+ SparseTensorIndexCOO::VT_INDICESTYPE,
+ indicesType,
+ );
+ }
+ #[inline]
+ pub fn add_indicesStrides(
+ &mut self,
+ indicesStrides: flatbuffers::WIPOffset<flatbuffers::Vector<'b, i64>>,
+ ) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
+ SparseTensorIndexCOO::VT_INDICESSTRIDES,
+ indicesStrides,
+ );
+ }
+ #[inline]
pub fn add_indicesBuffer(&mut self, indicesBuffer: &'b Buffer) {
self.fbb_.push_slot_always::<&Buffer>(
SparseTensorIndexCOO::VT_INDICESBUFFER,
@@ -195,10 +249,10 @@ impl<'a: 'b, 'b> SparseTensorIndexCOOBuilder<'a, 'b> {
}
}
-/// Compressed Sparse Row format, that is matrix-specific.
pub enum SparseMatrixIndexCSROffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// Compressed Sparse Row format, that is matrix-specific.
pub struct SparseMatrixIndexCSR<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -227,48 +281,66 @@ impl<'a> SparseMatrixIndexCSR<'a> {
if let Some(x) = args.indicesBuffer {
builder.add_indicesBuffer(x);
}
+ if let Some(x) = args.indicesType {
+ builder.add_indicesType(x);
+ }
if let Some(x) = args.indptrBuffer {
builder.add_indptrBuffer(x);
}
+ if let Some(x) = args.indptrType {
+ builder.add_indptrType(x);
+ }
builder.finish()
}
- pub const VT_INDPTRBUFFER: flatbuffers::VOffsetT = 4;
- pub const VT_INDICESBUFFER: flatbuffers::VOffsetT = 6;
+ pub const VT_INDPTRTYPE: flatbuffers::VOffsetT = 4;
+ pub const VT_INDPTRBUFFER: flatbuffers::VOffsetT = 6;
+ pub const VT_INDICESTYPE: flatbuffers::VOffsetT = 8;
+ pub const VT_INDICESBUFFER: flatbuffers::VOffsetT = 10;
- /// `indptrBuffer` stores the location and size of `indptr` array that
+ /// The type of values in indptrBuffer
+ #[inline]
+ pub fn indptrType(&self) -> Option<Int<'a>> {
+ self._tab.get::<flatbuffers::ForwardsUOffset<Int<'a>>>(
+ SparseMatrixIndexCSR::VT_INDPTRTYPE,
+ None,
+ )
+ }
+ /// indptrBuffer stores the location and size of indptr array that
/// represents the range of the rows.
- /// The `i`-th row spans from `indptr[i]` to `indptr[i+1]` in the data.
+ /// The i-th row spans from indptr[i] to indptr[i+1] in the data.
/// The length of this array is 1 + (the number of rows), and the type
/// of index value is long.
///
/// For example, let X be the following 6x4 matrix:
///
- ///```text
/// X := [[0, 1, 2, 0],
/// [0, 0, 3, 0],
/// [0, 4, 0, 5],
/// [0, 0, 0, 0],
/// [6, 0, 7, 8],
/// [0, 9, 0, 0]].
- /// ```
///
/// The array of non-zero values in X is:
///
- ///```text
/// values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9].
- /// ```
///
- /// And the `indptr` of X is:
+ /// And the indptr of X is:
///
- ///```text
/// indptr(X) = [0, 2, 3, 5, 5, 8, 10].
- /// ```
#[inline]
pub fn indptrBuffer(&self) -> Option<&'a Buffer> {
self._tab
.get::<Buffer>(SparseMatrixIndexCSR::VT_INDPTRBUFFER, None)
}
+ /// The type of values in indicesBuffer
+ #[inline]
+ pub fn indicesType(&self) -> Option<Int<'a>> {
+ self._tab.get::<flatbuffers::ForwardsUOffset<Int<'a>>>(
+ SparseMatrixIndexCSR::VT_INDICESTYPE,
+ None,
+ )
+ }
/// indicesBuffer stores the location and size of the array that
/// contains the column indices of the corresponding non-zero values.
/// The type of index value is long.
@@ -286,14 +358,18 @@ impl<'a> SparseMatrixIndexCSR<'a> {
}
pub struct SparseMatrixIndexCSRArgs<'a> {
+ pub indptrType: Option<flatbuffers::WIPOffset<Int<'a>>>,
pub indptrBuffer: Option<&'a Buffer>,
+ pub indicesType: Option<flatbuffers::WIPOffset<Int<'a>>>,
pub indicesBuffer: Option<&'a Buffer>,
}
impl<'a> Default for SparseMatrixIndexCSRArgs<'a> {
#[inline]
fn default() -> Self {
SparseMatrixIndexCSRArgs {
+ indptrType: None,
indptrBuffer: None,
+ indicesType: None,
indicesBuffer: None,
}
}
@@ -304,6 +380,13 @@ pub struct SparseMatrixIndexCSRBuilder<'a: 'b, 'b> {
}
impl<'a: 'b, 'b> SparseMatrixIndexCSRBuilder<'a, 'b> {
#[inline]
+ pub fn add_indptrType(&mut self, indptrType:
flatbuffers::WIPOffset<Int<'b>>) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Int>>(
+ SparseMatrixIndexCSR::VT_INDPTRTYPE,
+ indptrType,
+ );
+ }
+ #[inline]
pub fn add_indptrBuffer(&mut self, indptrBuffer: &'b Buffer) {
self.fbb_.push_slot_always::<&Buffer>(
SparseMatrixIndexCSR::VT_INDPTRBUFFER,
@@ -311,6 +394,13 @@ impl<'a: 'b, 'b> SparseMatrixIndexCSRBuilder<'a, 'b> {
);
}
#[inline]
+ pub fn add_indicesType(&mut self, indicesType:
flatbuffers::WIPOffset<Int<'b>>) {
+ self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Int>>(
+ SparseMatrixIndexCSR::VT_INDICESTYPE,
+ indicesType,
+ );
+ }
+ #[inline]
pub fn add_indicesBuffer(&mut self, indicesBuffer: &'b Buffer) {
self.fbb_.push_slot_always::<&Buffer>(
SparseMatrixIndexCSR::VT_INDICESBUFFER,
@@ -409,7 +499,8 @@ impl<'a> SparseTensor<'a> {
#[inline]
pub fn shape(
&self,
- ) ->
Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<TensorDim<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<TensorDim<'a>>>>
+ {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<TensorDim<'a>>>,
>>(SparseTensor::VT_SHAPE, None)
@@ -446,7 +537,7 @@ impl<'a> SparseTensor<'a> {
}
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_null(&'a self) -> Option<Null> {
+ pub fn type_as_null(&self) -> Option<Null<'a>> {
if self.type_type() == Type::Null {
self.type_().map(|u| Null::init_from_table(u))
} else {
@@ -456,7 +547,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_int(&'a self) -> Option<Int> {
+ pub fn type_as_int(&self) -> Option<Int<'a>> {
if self.type_type() == Type::Int {
self.type_().map(|u| Int::init_from_table(u))
} else {
@@ -466,7 +557,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_floating_point(&'a self) -> Option<FloatingPoint> {
+ pub fn type_as_floating_point(&self) -> Option<FloatingPoint<'a>> {
if self.type_type() == Type::FloatingPoint {
self.type_().map(|u| FloatingPoint::init_from_table(u))
} else {
@@ -476,7 +567,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_binary(&'a self) -> Option<Binary> {
+ pub fn type_as_binary(&self) -> Option<Binary<'a>> {
if self.type_type() == Type::Binary {
self.type_().map(|u| Binary::init_from_table(u))
} else {
@@ -486,7 +577,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_utf_8(&'a self) -> Option<Utf8> {
+ pub fn type_as_utf_8(&self) -> Option<Utf8<'a>> {
if self.type_type() == Type::Utf8 {
self.type_().map(|u| Utf8::init_from_table(u))
} else {
@@ -496,7 +587,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_bool(&'a self) -> Option<Bool> {
+ pub fn type_as_bool(&self) -> Option<Bool<'a>> {
if self.type_type() == Type::Bool {
self.type_().map(|u| Bool::init_from_table(u))
} else {
@@ -506,7 +597,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_decimal(&'a self) -> Option<Decimal> {
+ pub fn type_as_decimal(&self) -> Option<Decimal<'a>> {
if self.type_type() == Type::Decimal {
self.type_().map(|u| Decimal::init_from_table(u))
} else {
@@ -516,7 +607,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_date(&'a self) -> Option<Date> {
+ pub fn type_as_date(&self) -> Option<Date<'a>> {
if self.type_type() == Type::Date {
self.type_().map(|u| Date::init_from_table(u))
} else {
@@ -526,7 +617,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_time(&'a self) -> Option<Time> {
+ pub fn type_as_time(&self) -> Option<Time<'a>> {
if self.type_type() == Type::Time {
self.type_().map(|u| Time::init_from_table(u))
} else {
@@ -536,7 +627,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_timestamp(&'a self) -> Option<Timestamp> {
+ pub fn type_as_timestamp(&self) -> Option<Timestamp<'a>> {
if self.type_type() == Type::Timestamp {
self.type_().map(|u| Timestamp::init_from_table(u))
} else {
@@ -546,7 +637,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_interval(&'a self) -> Option<Interval> {
+ pub fn type_as_interval(&self) -> Option<Interval<'a>> {
if self.type_type() == Type::Interval {
self.type_().map(|u| Interval::init_from_table(u))
} else {
@@ -556,7 +647,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_list(&'a self) -> Option<List> {
+ pub fn type_as_list(&self) -> Option<List<'a>> {
if self.type_type() == Type::List {
self.type_().map(|u| List::init_from_table(u))
} else {
@@ -566,7 +657,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_struct_(&'a self) -> Option<Struct_> {
+ pub fn type_as_struct_(&self) -> Option<Struct_<'a>> {
if self.type_type() == Type::Struct_ {
self.type_().map(|u| Struct_::init_from_table(u))
} else {
@@ -576,7 +667,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_union(&'a self) -> Option<Union> {
+ pub fn type_as_union(&self) -> Option<Union<'a>> {
if self.type_type() == Type::Union {
self.type_().map(|u| Union::init_from_table(u))
} else {
@@ -586,7 +677,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_fixed_size_binary(&'a self) -> Option<FixedSizeBinary> {
+ pub fn type_as_fixed_size_binary(&self) -> Option<FixedSizeBinary<'a>> {
if self.type_type() == Type::FixedSizeBinary {
self.type_().map(|u| FixedSizeBinary::init_from_table(u))
} else {
@@ -596,7 +687,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_fixed_size_list(&'a self) -> Option<FixedSizeList> {
+ pub fn type_as_fixed_size_list(&self) -> Option<FixedSizeList<'a>> {
if self.type_type() == Type::FixedSizeList {
self.type_().map(|u| FixedSizeList::init_from_table(u))
} else {
@@ -606,7 +697,7 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_map(&'a self) -> Option<Map> {
+ pub fn type_as_map(&self) -> Option<Map<'a>> {
if self.type_type() == Type::Map {
self.type_().map(|u| Map::init_from_table(u))
} else {
@@ -616,9 +707,49 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
+ pub fn type_as_duration(&self) -> Option<Duration<'a>> {
+ if self.type_type() == Type::Duration {
+ self.type_().map(|u| Duration::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_binary(&self) -> Option<LargeBinary<'a>> {
+ if self.type_type() == Type::LargeBinary {
+ self.type_().map(|u| LargeBinary::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_utf_8(&self) -> Option<LargeUtf8<'a>> {
+ if self.type_type() == Type::LargeUtf8 {
+ self.type_().map(|u| LargeUtf8::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_list(&self) -> Option<LargeList<'a>> {
+ if self.type_type() == Type::LargeList {
+ self.type_().map(|u| LargeList::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
pub fn sparseIndex_as_sparse_tensor_index_coo(
- &'a self,
- ) -> Option<SparseTensorIndexCOO> {
+ &self,
+ ) -> Option<SparseTensorIndexCOO<'a>> {
if self.sparseIndex_type() == SparseTensorIndex::SparseTensorIndexCOO {
self.sparseIndex()
.map(|u| SparseTensorIndexCOO::init_from_table(u))
@@ -630,8 +761,8 @@ impl<'a> SparseTensor<'a> {
#[inline]
#[allow(non_snake_case)]
pub fn sparseIndex_as_sparse_matrix_index_csr(
- &'a self,
- ) -> Option<SparseMatrixIndexCSR> {
+ &self,
+ ) -> Option<SparseMatrixIndexCSR<'a>> {
if self.sparseIndex_type() == SparseTensorIndex::SparseMatrixIndexCSR {
self.sparseIndex()
.map(|u| SparseMatrixIndexCSR::init_from_table(u))
diff --git a/rust/arrow/src/ipc/gen/Tensor.rs b/rust/arrow/src/ipc/gen/Tensor.rs
index ca0be1e..cf454e2 100644
--- a/rust/arrow/src/ipc/gen/Tensor.rs
+++ b/rust/arrow/src/ipc/gen/Tensor.rs
@@ -17,11 +17,9 @@
// automatically generated by the FlatBuffers compiler, do not modify
-
#![allow(dead_code)]
#![allow(unused_imports)]
-
use crate::ipc::gen::Schema::*;
use std::cmp::Ordering;
@@ -29,12 +27,12 @@ use std::mem;
use flatbuffers::EndianScalar;
-/// ----------------------------------------------------------------------
-/// Data structures for dense tensors
-/// Shape data for a single axis in a tensor
pub enum TensorDimOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]
+/// ----------------------------------------------------------------------
+/// Data structures for dense tensors
+/// Shape data for a single axis in a tensor
pub struct TensorDim<'a> {
pub _tab: flatbuffers::Table<'a>,
}
@@ -197,7 +195,8 @@ impl<'a> Tensor<'a> {
#[inline]
pub fn shape(
&self,
- ) ->
Option<flatbuffers::Vector<flatbuffers::ForwardsUOffset<TensorDim<'a>>>> {
+ ) -> Option<flatbuffers::Vector<'a,
flatbuffers::ForwardsUOffset<TensorDim<'a>>>>
+ {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<TensorDim<'a>>>,
>>(Tensor::VT_SHAPE, None)
@@ -218,7 +217,7 @@ impl<'a> Tensor<'a> {
}
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_null(&'a self) -> Option<Null> {
+ pub fn type_as_null(&self) -> Option<Null<'a>> {
if self.type_type() == Type::Null {
self.type_().map(|u| Null::init_from_table(u))
} else {
@@ -228,7 +227,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_int(&'a self) -> Option<Int> {
+ pub fn type_as_int(&self) -> Option<Int<'a>> {
if self.type_type() == Type::Int {
self.type_().map(|u| Int::init_from_table(u))
} else {
@@ -238,7 +237,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_floating_point(&'a self) -> Option<FloatingPoint> {
+ pub fn type_as_floating_point(&self) -> Option<FloatingPoint<'a>> {
if self.type_type() == Type::FloatingPoint {
self.type_().map(|u| FloatingPoint::init_from_table(u))
} else {
@@ -248,7 +247,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_binary(&'a self) -> Option<Binary> {
+ pub fn type_as_binary(&self) -> Option<Binary<'a>> {
if self.type_type() == Type::Binary {
self.type_().map(|u| Binary::init_from_table(u))
} else {
@@ -258,7 +257,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_utf_8(&'a self) -> Option<Utf8> {
+ pub fn type_as_utf_8(&self) -> Option<Utf8<'a>> {
if self.type_type() == Type::Utf8 {
self.type_().map(|u| Utf8::init_from_table(u))
} else {
@@ -268,7 +267,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_bool(&'a self) -> Option<Bool> {
+ pub fn type_as_bool(&self) -> Option<Bool<'a>> {
if self.type_type() == Type::Bool {
self.type_().map(|u| Bool::init_from_table(u))
} else {
@@ -278,7 +277,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_decimal(&'a self) -> Option<Decimal> {
+ pub fn type_as_decimal(&self) -> Option<Decimal<'a>> {
if self.type_type() == Type::Decimal {
self.type_().map(|u| Decimal::init_from_table(u))
} else {
@@ -288,7 +287,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_date(&'a self) -> Option<Date> {
+ pub fn type_as_date(&self) -> Option<Date<'a>> {
if self.type_type() == Type::Date {
self.type_().map(|u| Date::init_from_table(u))
} else {
@@ -298,7 +297,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_time(&'a self) -> Option<Time> {
+ pub fn type_as_time(&self) -> Option<Time<'a>> {
if self.type_type() == Type::Time {
self.type_().map(|u| Time::init_from_table(u))
} else {
@@ -308,7 +307,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_timestamp(&'a self) -> Option<Timestamp> {
+ pub fn type_as_timestamp(&self) -> Option<Timestamp<'a>> {
if self.type_type() == Type::Timestamp {
self.type_().map(|u| Timestamp::init_from_table(u))
} else {
@@ -318,7 +317,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_interval(&'a self) -> Option<Interval> {
+ pub fn type_as_interval(&self) -> Option<Interval<'a>> {
if self.type_type() == Type::Interval {
self.type_().map(|u| Interval::init_from_table(u))
} else {
@@ -328,7 +327,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_list(&'a self) -> Option<List> {
+ pub fn type_as_list(&self) -> Option<List<'a>> {
if self.type_type() == Type::List {
self.type_().map(|u| List::init_from_table(u))
} else {
@@ -338,7 +337,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_struct_(&'a self) -> Option<Struct_> {
+ pub fn type_as_struct_(&self) -> Option<Struct_<'a>> {
if self.type_type() == Type::Struct_ {
self.type_().map(|u| Struct_::init_from_table(u))
} else {
@@ -348,7 +347,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_union(&'a self) -> Option<Union> {
+ pub fn type_as_union(&self) -> Option<Union<'a>> {
if self.type_type() == Type::Union {
self.type_().map(|u| Union::init_from_table(u))
} else {
@@ -358,7 +357,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_fixed_size_binary(&'a self) -> Option<FixedSizeBinary> {
+ pub fn type_as_fixed_size_binary(&self) -> Option<FixedSizeBinary<'a>> {
if self.type_type() == Type::FixedSizeBinary {
self.type_().map(|u| FixedSizeBinary::init_from_table(u))
} else {
@@ -368,7 +367,7 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_fixed_size_list(&'a self) -> Option<FixedSizeList> {
+ pub fn type_as_fixed_size_list(&self) -> Option<FixedSizeList<'a>> {
if self.type_type() == Type::FixedSizeList {
self.type_().map(|u| FixedSizeList::init_from_table(u))
} else {
@@ -378,13 +377,53 @@ impl<'a> Tensor<'a> {
#[inline]
#[allow(non_snake_case)]
- pub fn type__as_map(&'a self) -> Option<Map> {
+ pub fn type_as_map(&self) -> Option<Map<'a>> {
if self.type_type() == Type::Map {
self.type_().map(|u| Map::init_from_table(u))
} else {
None
}
}
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_duration(&self) -> Option<Duration<'a>> {
+ if self.type_type() == Type::Duration {
+ self.type_().map(|u| Duration::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_binary(&self) -> Option<LargeBinary<'a>> {
+ if self.type_type() == Type::LargeBinary {
+ self.type_().map(|u| LargeBinary::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_utf_8(&self) -> Option<LargeUtf8<'a>> {
+ if self.type_type() == Type::LargeUtf8 {
+ self.type_().map(|u| LargeUtf8::init_from_table(u))
+ } else {
+ None
+ }
+ }
+
+ #[inline]
+ #[allow(non_snake_case)]
+ pub fn type_as_large_list(&self) -> Option<LargeList<'a>> {
+ if self.type_type() == Type::LargeList {
+ self.type_().map(|u| LargeList::init_from_table(u))
+ } else {
+ None
+ }
+ }
}
pub struct TensorArgs<'a> {