Skip to content
Closed
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
31 changes: 31 additions & 0 deletions rust/arrow/src/ipc/gen/File.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ impl<'a> Footer<'a> {
args: &'args FooterArgs<'args>,
) -> flatbuffers::WIPOffset<Footer<'bldr>> {
let mut builder = FooterBuilder::new(_fbb);
if let Some(x) = args.custom_metadata {
builder.add_custom_metadata(x);
}
if let Some(x) = args.recordBatches {
builder.add_recordBatches(x);
}
Expand All @@ -142,6 +145,7 @@ impl<'a> Footer<'a> {
pub const VT_SCHEMA: flatbuffers::VOffsetT = 6;
pub const VT_DICTIONARIES: flatbuffers::VOffsetT = 8;
pub const VT_RECORDBATCHES: flatbuffers::VOffsetT = 10;
pub const VT_CUSTOM_METADATA: flatbuffers::VOffsetT = 12;

#[inline]
pub fn version(&self) -> MetadataVersion {
Expand Down Expand Up @@ -172,13 +176,27 @@ impl<'a> Footer<'a> {
)
.map(|v| v.safe_slice())
}
/// User-defined metadata
#[inline]
pub fn custom_metadata(
&self,
) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<KeyValue<'a>>>> {
self._tab.get::<flatbuffers::ForwardsUOffset<
flatbuffers::Vector<flatbuffers::ForwardsUOffset<KeyValue<'a>>>,
>>(Footer::VT_CUSTOM_METADATA, None)
}
}

pub struct FooterArgs<'a> {
pub version: MetadataVersion,
pub schema: Option<flatbuffers::WIPOffset<Schema<'a>>>,
pub dictionaries: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Block>>>,
pub recordBatches: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, Block>>>,
pub custom_metadata: Option<
flatbuffers::WIPOffset<
flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<KeyValue<'a>>>,
>,
>,
}
impl<'a> Default for FooterArgs<'a> {
#[inline]
Expand All @@ -188,6 +206,7 @@ impl<'a> Default for FooterArgs<'a> {
schema: None,
dictionaries: None,
recordBatches: None,
custom_metadata: None,
}
}
}
Expand Down Expand Up @@ -233,6 +252,18 @@ impl<'a: 'b, 'b> FooterBuilder<'a, 'b> {
);
}
#[inline]
pub fn add_custom_metadata(
&mut self,
custom_metadata: flatbuffers::WIPOffset<
flatbuffers::Vector<'b, flatbuffers::ForwardsUOffset<KeyValue<'b>>>,
>,
) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(
Footer::VT_CUSTOM_METADATA,
custom_metadata,
);
}
#[inline]
pub fn new(
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
) -> FooterBuilder<'a, 'b> {
Expand Down
3 changes: 2 additions & 1 deletion rust/arrow/src/ipc/gen/Message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ impl<'a> DictionaryBatch<'a> {
)
}
/// If isDelta is true the values in the dictionary are to be appended to a
/// dictionary with the indicated id
/// dictionary with the indicated id. If isDelta is false this dictionary
/// should replace the existing dictionary.
#[inline]
pub fn isDelta(&self) -> bool {
self._tab
Expand Down
80 changes: 78 additions & 2 deletions rust/arrow/src/ipc/gen/Schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,63 @@ pub fn enum_name_type(e: Type) -> &'static str {
}

pub struct TypeUnionTableOffset {}
/// ----------------------------------------------------------------------
/// Dictionary encoding metadata
/// Maintained for forwards compatibility, in the future
/// Dictionaries might be explicit maps between integers and values
/// allowing for non-contiguous index values
#[allow(non_camel_case_types)]
#[repr(i16)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum DictionaryKind {
DenseArray = 0,
}

const ENUM_MIN_DICTIONARY_KIND: i16 = 0;
const ENUM_MAX_DICTIONARY_KIND: i16 = 0;

impl<'a> flatbuffers::Follow<'a> for DictionaryKind {
type Inner = Self;
#[inline]
fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
flatbuffers::read_scalar_at::<Self>(buf, loc)
}
}

impl flatbuffers::EndianScalar for DictionaryKind {
#[inline]
fn to_little_endian(self) -> Self {
let n = i16::to_le(self as i16);
let p = &n as *const i16 as *const DictionaryKind;
unsafe { *p }
}
#[inline]
fn from_little_endian(self) -> Self {
let n = i16::from_le(self as i16);
let p = &n as *const i16 as *const DictionaryKind;
unsafe { *p }
}
}

impl flatbuffers::Push for DictionaryKind {
type Output = DictionaryKind;
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
flatbuffers::emplace_scalar::<DictionaryKind>(dst, *self);
}
}

#[allow(non_camel_case_types)]
const ENUM_VALUES_DICTIONARY_KIND: [DictionaryKind; 1] = [DictionaryKind::DenseArray];

#[allow(non_camel_case_types)]
const ENUM_NAMES_DICTIONARY_KIND: [&'static str; 1] = ["DenseArray"];

pub fn enum_name_dictionary_kind(e: DictionaryKind) -> &'static str {
let index = e as i16;
ENUM_NAMES_DICTIONARY_KIND[index as usize]
}

/// ----------------------------------------------------------------------
/// Endianness of the platform producing the data
#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -2358,8 +2415,6 @@ impl<'a: 'b, 'b> KeyValueBuilder<'a, 'b> {
pub enum DictionaryEncodingOffset {}
#[derive(Copy, Clone, Debug, PartialEq)]

/// ----------------------------------------------------------------------
/// Dictionary encoding metadata
pub struct DictionaryEncoding<'a> {
pub _tab: flatbuffers::Table<'a>,
}
Expand Down Expand Up @@ -2389,13 +2444,15 @@ impl<'a> DictionaryEncoding<'a> {
if let Some(x) = args.indexType {
builder.add_indexType(x);
}
builder.add_dictionaryKind(args.dictionaryKind);
builder.add_isOrdered(args.isOrdered);
builder.finish()
}

pub const VT_ID: flatbuffers::VOffsetT = 4;
pub const VT_INDEXTYPE: flatbuffers::VOffsetT = 6;
pub const VT_ISORDERED: flatbuffers::VOffsetT = 8;
pub const VT_DICTIONARYKIND: flatbuffers::VOffsetT = 10;

/// The known dictionary id in the application where this data is used. In
/// the file or streaming formats, the dictionary ids are found in the
Expand Down Expand Up @@ -2425,12 +2482,22 @@ impl<'a> DictionaryEncoding<'a> {
.get::<bool>(DictionaryEncoding::VT_ISORDERED, Some(false))
.unwrap()
}
#[inline]
pub fn dictionaryKind(&self) -> DictionaryKind {
self._tab
.get::<DictionaryKind>(
DictionaryEncoding::VT_DICTIONARYKIND,
Some(DictionaryKind::DenseArray),
)
.unwrap()
}
}

pub struct DictionaryEncodingArgs<'a> {
pub id: i64,
pub indexType: Option<flatbuffers::WIPOffset<Int<'a>>>,
pub isOrdered: bool,
pub dictionaryKind: DictionaryKind,
}
impl<'a> Default for DictionaryEncodingArgs<'a> {
#[inline]
Expand All @@ -2439,6 +2506,7 @@ impl<'a> Default for DictionaryEncodingArgs<'a> {
id: 0,
indexType: None,
isOrdered: false,
dictionaryKind: DictionaryKind::DenseArray,
}
}
}
Expand All @@ -2464,6 +2532,14 @@ impl<'a: 'b, 'b> DictionaryEncodingBuilder<'a, 'b> {
.push_slot::<bool>(DictionaryEncoding::VT_ISORDERED, isOrdered, false);
}
#[inline]
pub fn add_dictionaryKind(&mut self, dictionaryKind: DictionaryKind) {
self.fbb_.push_slot::<DictionaryKind>(
DictionaryEncoding::VT_DICTIONARYKIND,
dictionaryKind,
DictionaryKind::DenseArray,
);
}
#[inline]
pub fn new(
_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
) -> DictionaryEncodingBuilder<'a, 'b> {
Expand Down
Loading