Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::Schema Class Reference

Immutable schema description for a Parquet file. More...

#include <schema.hpp>

Public Member Functions

 Schema ()=default
 Default-construct an empty schema.
 
 Schema (std::string name, std::vector< ColumnDescriptor > columns)
 Construct a schema directly from a name and column list.
 
const std::string & name () const
 Root schema name (e.g. "tick_data").
 
size_t num_columns () const
 Number of columns in this schema.
 
const ColumnDescriptorcolumn (size_t index) const
 Access a column descriptor by index.
 
const std::vector< ColumnDescriptor > & columns () const
 All column descriptors (ordered).
 
std::optional< size_tfind_column (const std::string &col_name) const
 Find a column index by name.
 
bool operator== (const Schema &other) const
 Equality — schemas match if they have the same name and identical columns (name, physical_type, logical_type, repetition, type_length).
 
bool operator!= (const Schema &other) const
 Inequality operator.
 

Static Public Member Functions

template<typename... Cols>
static Schema build (std::string name, Cols &&... cols)
 Build a Schema from typed Column<T> descriptors (variadic factory).
 
static SchemaBuilder builder (std::string name)
 Create a SchemaBuilder for fluent column construction.
 

Detailed Description

Immutable schema description for a Parquet file.

A Schema has a root name and an ordered list of ColumnDescriptor entries. Create one via the variadic Schema::build() factory or the fluent Schema::builder() API.

See also
Column, SchemaBuilder, ColumnDescriptor

Definition at line 192 of file schema.hpp.

Constructor & Destructor Documentation

◆ Schema() [1/2]

signet::forge::Schema::Schema ( )
default

Default-construct an empty schema.

◆ Schema() [2/2]

signet::forge::Schema::Schema ( std::string  name,
std::vector< ColumnDescriptor columns 
)
inline

Construct a schema directly from a name and column list.

Parameters
nameRoot schema name.
columnsOrdered column descriptors.

Definition at line 200 of file schema.hpp.

Member Function Documentation

◆ build()

template<typename... Cols>
static Schema signet::forge::Schema::build ( std::string  name,
Cols &&...  cols 
)
inlinestatic

Build a Schema from typed Column<T> descriptors (variadic factory).

auto s = Schema::build("tick_data",
Column<double>{"price"},
Column<std::string>{"symbol"});
static Schema build(std::string name, Cols &&... cols)
Build a Schema from typed Column<T> descriptors (variadic factory).
Definition schema.hpp:217
const ColumnDescriptor & column(size_t index) const
Access a column descriptor by index.
Definition schema.hpp:244
@ TIMESTAMP_NS
Timestamp — INT64, nanoseconds since Unix epoch.
Typed column descriptor for the Schema::build() variadic API.
Definition schema.hpp:39
Template Parameters
ColsPack of Column<T> types.
Parameters
nameSchema root name.
colsOne or more Column<T> objects.
Returns
An immutable Schema.

Definition at line 217 of file schema.hpp.

◆ builder()

static SchemaBuilder signet::forge::Schema::builder ( std::string  name)
inlinestatic

Create a SchemaBuilder for fluent column construction.

Parameters
nameRoot schema name.
Returns
A SchemaBuilder instance.
See also
SchemaBuilder

Definition at line 228 of file schema.hpp.

◆ column()

const ColumnDescriptor & signet::forge::Schema::column ( size_t  index) const
inline

Access a column descriptor by index.

Parameters
indexZero-based column index.
Returns
Const reference to the ColumnDescriptor.
Exceptions
std::out_of_rangeif index >= num_columns().

Definition at line 244 of file schema.hpp.

◆ columns()

const std::vector< ColumnDescriptor > & signet::forge::Schema::columns ( ) const
inline

All column descriptors (ordered).

Definition at line 254 of file schema.hpp.

◆ find_column()

std::optional< size_t > signet::forge::Schema::find_column ( const std::string &  col_name) const
inline

Find a column index by name.

Parameters
col_nameColumn name to search for.
Returns
The zero-based index, or std::nullopt if not found.

Definition at line 261 of file schema.hpp.

◆ name()

const std::string & signet::forge::Schema::name ( ) const
inline

Root schema name (e.g. "tick_data").

Definition at line 235 of file schema.hpp.

◆ num_columns()

size_t signet::forge::Schema::num_columns ( ) const
inline

Number of columns in this schema.

Definition at line 238 of file schema.hpp.

◆ operator!=()

bool signet::forge::Schema::operator!= ( const Schema other) const
inline

Inequality operator.

Definition at line 291 of file schema.hpp.

◆ operator==()

bool signet::forge::Schema::operator== ( const Schema other) const
inline

Equality — schemas match if they have the same name and identical columns (name, physical_type, logical_type, repetition, type_length).

Definition at line 272 of file schema.hpp.


The documentation for this class was generated from the following file: