Skip to content
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

Hook up Avro Decoder #6820

Merged
merged 6 commits into from
Dec 1, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Docs
tustvold committed Nov 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit bbdaf7b3d38166adfe3aed3db525fb2cd28a6742
4 changes: 4 additions & 0 deletions arrow-avro/src/reader/record.rs
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ impl RecordDecoder {
Ok(cursor.position())
}

/// Flush the decoded records into a [`RecordBatch`]
pub fn flush(&mut self) -> Result<RecordBatch, ArrowError> {
let arrays = self
.fields
@@ -155,6 +156,7 @@ impl Decoder {
})
}

/// Append a null record
fn append_null(&mut self) {
match self {
Self::Null(count) => *count += 1,
@@ -176,6 +178,7 @@ impl Decoder {
}
}

/// Decode a single record from `buf`
fn decode(&mut self, buf: &mut AvroCursor<'_>) -> Result<(), ArrowError> {
match self {
Self::Null(x) => *x += 1,
@@ -216,6 +219,7 @@ impl Decoder {
Ok(())
}

/// Flush decoded records to an [`ArrayRef`]
fn flush(&mut self, nulls: Option<NullBuffer>) -> Result<ArrayRef, ArrowError> {
Ok(match self {
Self::Nullable(_, n, e) => e.flush(n.finish())?,