sparrow-ipc 0.2.0
Loading...
Searching...
No Matches
deserializer_example.cpp File Reference

Examples demonstrating deserialization of Arrow IPC streams using sparrow-ipc. More...

#include <iostream>
#include <span>
#include <vector>
#include <sparrow/record_batch.hpp>
#include <sparrow_ipc/deserialize.hpp>
#include <sparrow_ipc/deserializer.hpp>
#include <sparrow_ipc/memory_output_stream.hpp>
#include <sparrow_ipc/serializer.hpp>
Include dependency graph for deserializer_example.cpp:

Go to the source code of this file.

Functions

std::vector< sp::record_batch > create_sample_batches (size_t count)
 Helper function to create sample record batches for demonstration.
 
std::vector< uint8_t > serialize_batches (const std::vector< sp::record_batch > &batches)
 Helper function to serialize batches to a byte buffer.
 
std::vector< sp::record_batch > deserialize_stream_example (const std::vector< uint8_t > &stream_data)
 Example: Deserialize a stream using the function API.
 
void deserializer_basic_example (const std::vector< uint8_t > &stream_data)
 Example: Basic usage of the deserializer class.
 
void deserializer_incremental_example (const std::vector< std::vector< uint8_t > > &stream_chunks)
 Example: Incremental deserialization with the deserializer class.
 
void deserializer_chaining_example (const std::vector< uint8_t > &chunk1, const std::vector< uint8_t > &chunk2, const std::vector< uint8_t > &chunk3)
 Example: Chaining multiple deserializations.
 
int main ()
 

Detailed Description

Examples demonstrating deserialization of Arrow IPC streams using sparrow-ipc.

This file shows different ways to deserialize Arrow IPC streams:

  1. Using the function API (deserialize_stream)
  2. Using the deserializer class for incremental deserialization

Definition in file deserializer_example.cpp.

Function Documentation

◆ create_sample_batches()

std::vector< sp::record_batch > create_sample_batches ( size_t count)

Helper function to create sample record batches for demonstration.

Definition at line 27 of file deserializer_example.cpp.

Here is the caller graph for this function:

◆ deserialize_stream_example()

std::vector< sp::record_batch > deserialize_stream_example ( const std::vector< uint8_t > & stream_data)

Example: Deserialize a stream using the function API.

This is the simplest way to deserialize an Arrow IPC stream. Use this when you have the complete stream data available.

Definition at line 66 of file deserializer_example.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deserializer_basic_example()

void deserializer_basic_example ( const std::vector< uint8_t > & stream_data)

Example: Basic usage of the deserializer class.

The deserializer class allows you to accumulate record batches into an existing container as you deserialize data.

Definition at line 82 of file deserializer_example.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deserializer_chaining_example()

void deserializer_chaining_example ( const std::vector< uint8_t > & chunk1,
const std::vector< uint8_t > & chunk2,
const std::vector< uint8_t > & chunk3 )

Example: Chaining multiple deserializations.

The streaming operator can be chained for fluent API usage.

Definition at line 136 of file deserializer_example.cpp.

Here is the caller graph for this function:

◆ deserializer_incremental_example()

void deserializer_incremental_example ( const std::vector< std::vector< uint8_t > > & stream_chunks)

Example: Incremental deserialization with the deserializer class.

This example shows how to deserialize data incrementally as it arrives, which is useful for streaming scenarios where data comes in chunks.

Definition at line 109 of file deserializer_example.cpp.

Here is the caller graph for this function:

◆ main()

int main ( )

Definition at line 154 of file deserializer_example.cpp.

Here is the call graph for this function:

◆ serialize_batches()

std::vector< uint8_t > serialize_batches ( const std::vector< sp::record_batch > & batches)

Helper function to serialize batches to a byte buffer.

Definition at line 50 of file deserializer_example.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: