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

Fluent builder for constructing a Schema one column at a time. More...

#include <schema.hpp>

Public Member Functions

 SchemaBuilder (std::string name)
 Construct a builder with the given root schema name.
 
template<typename T >
SchemaBuildercolumn (std::string col_name, LogicalType logical_type=LogicalType::NONE)
 Add a typed column, deducing PhysicalType from T.
 
template<typename T >
SchemaBuildercolumn (std::string col_name, LogicalType logical_type, Repetition repetition)
 Add a column with an explicit repetition level.
 
template<typename T >
SchemaBuilderoptional_column (std::string col_name, LogicalType logical_type=LogicalType::NONE)
 Add an optional (nullable) column — shorthand for Repetition::OPTIONAL.
 
SchemaBuilderraw_column (ColumnDescriptor cd)
 Add a pre-built ColumnDescriptor directly.
 
Schema build ()
 Build the final Schema, consuming the builder.
 

Detailed Description

Fluent builder for constructing a Schema one column at a time.

auto schema = Schema::builder("trades")
.column<double>("price")
.optional_column<std::string>("note")
.build();
SchemaBuilder & column(std::string col_name, LogicalType logical_type=LogicalType::NONE)
Add a typed column, deducing PhysicalType from T.
Definition schema.hpp:107
Schema build()
Build the final Schema, consuming the builder.
Definition schema.hpp:303
SchemaBuilder & optional_column(std::string col_name, LogicalType logical_type=LogicalType::NONE)
Add an optional (nullable) column — shorthand for Repetition::OPTIONAL.
Definition schema.hpp:157
static SchemaBuilder builder(std::string name)
Create a SchemaBuilder for fluent column construction.
Definition schema.hpp:228
@ TIMESTAMP_NS
Timestamp — INT64, nanoseconds since Unix epoch.
See also
Schema::builder(), Column

Definition at line 92 of file schema.hpp.

Constructor & Destructor Documentation

◆ SchemaBuilder()

signet::forge::SchemaBuilder::SchemaBuilder ( std::string  name)
inlineexplicit

Construct a builder with the given root schema name.

Parameters
nameRoot schema name (e.g. "trades").

Definition at line 96 of file schema.hpp.

Member Function Documentation

◆ build()

Schema signet::forge::SchemaBuilder::build ( )
inline

Build the final Schema, consuming the builder.

After calling build(), the builder is left in a moved-from state and should not be reused.

Returns
An immutable Schema.

Definition at line 303 of file schema.hpp.

◆ column() [1/2]

template<typename T >
SchemaBuilder & signet::forge::SchemaBuilder::column ( std::string  col_name,
LogicalType  logical_type,
Repetition  repetition 
)
inline

Add a column with an explicit repetition level.

Template Parameters
TC++ type.
Parameters
col_nameColumn name.
logical_typeLogical annotation.
repetitionField repetition (REQUIRED, OPTIONAL, REPEATED).
Returns
Reference to this builder for chaining.

Definition at line 132 of file schema.hpp.

◆ column() [2/2]

template<typename T >
SchemaBuilder & signet::forge::SchemaBuilder::column ( std::string  col_name,
LogicalType  logical_type = LogicalType::NONE 
)
inline

Add a typed column, deducing PhysicalType from T.

For std::string columns with no explicit logical type, defaults to LogicalType::STRING.

Template Parameters
TC++ type (bool, int32_t, int64_t, float, double, std::string).
Parameters
col_nameColumn name (must be unique within the schema).
logical_typeOptional logical annotation (default: NONE / auto).
Returns
Reference to this builder for chaining.

Definition at line 107 of file schema.hpp.

◆ optional_column()

template<typename T >
SchemaBuilder & signet::forge::SchemaBuilder::optional_column ( std::string  col_name,
LogicalType  logical_type = LogicalType::NONE 
)
inline

Add an optional (nullable) column — shorthand for Repetition::OPTIONAL.

Template Parameters
TC++ type.
Parameters
col_nameColumn name.
logical_typeOptional logical annotation.
Returns
Reference to this builder for chaining.

Definition at line 157 of file schema.hpp.

◆ raw_column()

SchemaBuilder & signet::forge::SchemaBuilder::raw_column ( ColumnDescriptor  cd)
inline

Add a pre-built ColumnDescriptor directly.

Useful for FIXED_LEN_BYTE_ARRAY columns where type_length must be set manually, or for columns that cannot be expressed via Column<T>.

Parameters
cdA fully-populated column descriptor.
Returns
Reference to this builder for chaining.

Definition at line 168 of file schema.hpp.


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