iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
iceberg::MapType Class Reference

A data type representing a dictionary of values. More...

#include <type.h>

Inheritance diagram for iceberg::MapType:
iceberg::NestedType iceberg::Type iceberg::util::Formattable

Public Member Functions

 MapType (SchemaField key, SchemaField value)
 Construct a map of the given key/value fields. The field names should be "key" and "value", respectively.
 
const SchemaFieldkey () const
 
const SchemaFieldvalue () const
 
TypeId type_id () const override
 Get the type ID.
 
std::string ToString () const override
 Get a user-readable string representation.
 
std::span< const SchemaFieldfields () const override
 Get a view of the child fields.
 
Result< std::optional< SchemaFieldConstRef > > GetFieldById (int32_t field_id) const override
 Get a field by field ID.
 
Result< std::optional< SchemaFieldConstRef > > GetFieldByIndex (int32_t index) const override
 Get a field by index.
 
Result< std::optional< SchemaFieldConstRef > > GetFieldByName (std::string_view name, bool case_sensitive) const override
 Get a field by name. Return an error Status if the field name is not unique; prefer GetFieldById or GetFieldByIndex when possible.
 
virtual Result< std::optional< SchemaFieldConstRef > > GetFieldByName (std::string_view name, bool case_sensitive) const=0
 Get a field by name. Return an error Status if the field name is not unique; prefer GetFieldById or GetFieldByIndex when possible.
 
Result< std::optional< SchemaFieldConstRef > > GetFieldByName (std::string_view name) const
 Get a field by name (case-sensitive).
 
- Public Member Functions inherited from iceberg::NestedType
bool is_primitive () const override
 Is this a primitive type (may not have child fields)?
 
bool is_nested () const override
 Is this a nested type (may have child fields)?
 
Result< std::optional< SchemaFieldConstRef > > GetFieldByName (std::string_view name) const
 Get a field by name (case-sensitive).
 

Static Public Attributes

static constexpr const TypeId kTypeId = TypeId::kMap
 
static constexpr const std::string_view kKeyName = "key"
 
static constexpr const std::string_view kValueName = "value"
 

Protected Member Functions

bool Equals (const Type &other) const override
 Compare two types for equality.
 

Protected Attributes

std::array< SchemaField, 2 > fields_
 

Additional Inherited Members

- Public Types inherited from iceberg::NestedType
using SchemaFieldConstRef = std::reference_wrapper< const SchemaField >
 

Detailed Description

A data type representing a dictionary of values.

Member Function Documentation

◆ Equals()

bool iceberg::MapType::Equals ( const Type other) const
overrideprotectedvirtual

Compare two types for equality.

Implements iceberg::Type.

◆ fields()

std::span< const SchemaField > iceberg::MapType::fields ( ) const
overridevirtual

Get a view of the child fields.

Implements iceberg::NestedType.

◆ GetFieldById()

Result< std::optional< NestedType::SchemaFieldConstRef > > iceberg::MapType::GetFieldById ( int32_t  field_id) const
overridevirtual

Get a field by field ID.

Note
This is O(1) complexity.

Implements iceberg::NestedType.

◆ GetFieldByIndex()

Result< std::optional< NestedType::SchemaFieldConstRef > > iceberg::MapType::GetFieldByIndex ( int32_t  index) const
overridevirtual

Get a field by index.

Note
This is O(1) complexity.

Implements iceberg::NestedType.

◆ GetFieldByName() [1/2]

Result< std::optional< NestedType::SchemaFieldConstRef > > iceberg::MapType::GetFieldByName ( std::string_view  name,
bool  case_sensitive 
) const
overridevirtual

Get a field by name. Return an error Status if the field name is not unique; prefer GetFieldById or GetFieldByIndex when possible.

Note
This is O(1) complexity.

Implements iceberg::NestedType.

◆ GetFieldByName() [2/2]

virtual Result< std::optional< SchemaFieldConstRef > > iceberg::NestedType::GetFieldByName ( std::string_view  name,
bool  case_sensitive 
) const
virtual

Get a field by name. Return an error Status if the field name is not unique; prefer GetFieldById or GetFieldByIndex when possible.

Note
This is O(1) complexity.

Implements iceberg::NestedType.

◆ ToString()

std::string iceberg::MapType::ToString ( ) const
overridevirtual

Get a user-readable string representation.

Implements iceberg::util::Formattable.

◆ type_id()

TypeId iceberg::MapType::type_id ( ) const
overridevirtual

Get the type ID.

Implements iceberg::Type.


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