Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::ArrowTypeExtension Class Reference
Collaboration diagram for duckdb::ArrowTypeExtension:

Public Member Functions

 ArrowTypeExtension (ArrowExtensionMetadata &extension_metadata, unique_ptr< ArrowType > type)
 This type is not registered, so we just use whatever is the format and hope for the best.
 
 ArrowTypeExtension (string extension_name, string arrow_format, shared_ptr< ArrowTypeExtensionData > type)
 We either have simple extensions where we only return one type.
 
 ArrowTypeExtension (string vendor_name, string type_name, string arrow_format, shared_ptr< ArrowTypeExtensionData > type)
 
 ArrowTypeExtension (string extension_name, populate_arrow_schema_t populate_arrow_schema, get_type_t get_type, shared_ptr< ArrowTypeExtensionData > type)
 We have complex extensions, where we can return multiple types, hence we must have callback functions to do so.
 
 ArrowTypeExtension (string vendor_name, string type_name, populate_arrow_schema_t populate_arrow_schema, get_type_t get_type, shared_ptr< ArrowTypeExtensionData > type, cast_arrow_duck_t arrow_to_duckdb, cast_duck_arrow_t duckdb_to_arrow)
 
ArrowExtensionMetadata GetInfo () const
 
unique_ptr< ArrowTypeGetType (ClientContext &context, const ArrowSchema &schema, const ArrowSchemaMetadata &schema_metadata) const
 
shared_ptr< ArrowTypeExtensionDataGetTypeExtension () const
 
LogicalTypeId GetLogicalTypeId () const
 
LogicalType GetLogicalType () const
 
bool HasType () const
 

Static Public Member Functions

static void PopulateArrowSchema (DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, const LogicalType &duckdb_type, ClientContext &context, const ArrowTypeExtension &extension)
 

Public Attributes

populate_arrow_schema_t populate_arrow_schema = nullptr
 (Optional) Callback to a function that sets up the arrow schema production
 
get_type_t get_type = nullptr
 (Optional) Callback to a function that sets up the arrow schema production
 

Private Attributes

ArrowExtensionMetadata extension_metadata
 Extension Info from Arrow.
 
shared_ptr< ArrowTypeExtensionDatatype_extension
 Arrow Extension Type.
 

Constructor & Destructor Documentation

◆ ArrowTypeExtension() [1/6]

duckdb::ArrowTypeExtension::ArrowTypeExtension ( )
inline
37820{};

◆ ArrowTypeExtension() [2/6]

duckdb::ArrowTypeExtension::ArrowTypeExtension ( ArrowExtensionMetadata extension_metadata,
unique_ptr< ArrowType type 
)
explicit

This type is not registered, so we just use whatever is the format and hope for the best.

44988 type_extension = make_shared_ptr<ArrowTypeExtensionData>(type->GetDuckType());
44989}
shared_ptr< ArrowTypeExtensionData > type_extension
Arrow Extension Type.
Definition duckdb.hpp:37861
ArrowExtensionMetadata extension_metadata
Extension Info from Arrow.
Definition duckdb.hpp:37859

◆ ArrowTypeExtension() [3/6]

duckdb::ArrowTypeExtension::ArrowTypeExtension ( string  extension_name,
string  arrow_format,
shared_ptr< ArrowTypeExtensionData type 
)

We either have simple extensions where we only return one type.

44983 : extension_metadata(std::move(extension_name), {}, {}, std::move(arrow_format)), type_extension(std::move(type)) {
44984}

◆ ArrowTypeExtension() [4/6]

duckdb::ArrowTypeExtension::ArrowTypeExtension ( string  vendor_name,
string  type_name,
string  arrow_format,
shared_ptr< ArrowTypeExtensionData type 
)
45072 std::move(type_name), std::move(arrow_format)),
45073 type_extension(std::move(type)) {
45074}
static constexpr const char * ARROW_EXTENSION_NON_CANONICAL
Arrow Extension for non-canonical types.
Definition duckdb.hpp:37795

◆ ArrowTypeExtension() [5/6]

duckdb::ArrowTypeExtension::ArrowTypeExtension ( string  extension_name,
populate_arrow_schema_t  populate_arrow_schema,
get_type_t  get_type,
shared_ptr< ArrowTypeExtensionData type 
)

We have complex extensions, where we can return multiple types, hence we must have callback functions to do so.

45079 extension_metadata(std::move(extension_name), {}, {}, {}), type_extension(std::move(type)) {
45080}
get_type_t get_type
(Optional) Callback to a function that sets up the arrow schema production
Definition duckdb.hpp:37855
populate_arrow_schema_t populate_arrow_schema
(Optional) Callback to a function that sets up the arrow schema production
Definition duckdb.hpp:37853

◆ ArrowTypeExtension() [6/6]

duckdb::ArrowTypeExtension::ArrowTypeExtension ( string  vendor_name,
string  type_name,
populate_arrow_schema_t  populate_arrow_schema,
get_type_t  get_type,
shared_ptr< ArrowTypeExtensionData type,
cast_arrow_duck_t  arrow_to_duckdb,
cast_duck_arrow_t  duckdb_to_arrow 
)
45088 std::move(type_name), {}),
45089 type_extension(std::move(type)) {
45090 type_extension->arrow_to_duckdb = arrow_to_duckdb;
45091 type_extension->duckdb_to_arrow = duckdb_to_arrow;
45092}

Member Function Documentation

◆ GetInfo()

ArrowExtensionMetadata duckdb::ArrowTypeExtension::GetInfo ( ) const
45094 {
45095 return extension_metadata;
45096}

◆ GetType()

unique_ptr< ArrowType > duckdb::ArrowTypeExtension::GetType ( ClientContext context,
const ArrowSchema schema,
const ArrowSchemaMetadata schema_metadata 
) const
45099 {
45100 if (get_type) {
45101 return get_type(context, schema, schema_metadata);
45102 }
45103 // FIXME: THis is not good
45104 auto duckdb_type = type_extension->GetDuckDBType();
45105 return make_uniq<ArrowType>(duckdb_type);
45106}

◆ GetTypeExtension()

shared_ptr< ArrowTypeExtensionData > duckdb::ArrowTypeExtension::GetTypeExtension ( ) const
45108 {
45109 return type_extension;
45110}

◆ GetLogicalTypeId()

LogicalTypeId duckdb::ArrowTypeExtension::GetLogicalTypeId ( ) const
45112 {
45113 return type_extension->GetDuckDBType().id();
45114}

◆ GetLogicalType()

LogicalType duckdb::ArrowTypeExtension::GetLogicalType ( ) const
45116 {
45117 return type_extension->GetDuckDBType();
45118}

◆ HasType()

bool duckdb::ArrowTypeExtension::HasType ( ) const
45120 {
45121 return type_extension.get() != nullptr;
45122}

◆ PopulateArrowSchema()

void duckdb::ArrowTypeExtension::PopulateArrowSchema ( DuckDBArrowSchemaHolder root_holder,
ArrowSchema child,
const LogicalType duckdb_type,
ClientContext context,
const ArrowTypeExtension extension 
)
static
45126 {
45127 if (extension.populate_arrow_schema) {
45128 extension.populate_arrow_schema(root_holder, child, duckdb_type, context, extension);
45129 return;
45130 }
45131
45132 auto format = make_unsafe_uniq_array<char>(extension.extension_metadata.GetArrowFormat().size() + 1);
45133 idx_t i = 0;
45134 for (const auto &c : extension.extension_metadata.GetArrowFormat()) {
45135 format[i++] = c;
45136 }
45137 format[i++] = '\0';
45138 // We do the default way of populating the schema
45139 root_holder.extension_format.emplace_back(std::move(format));
45140
45141 child.format = root_holder.extension_format.back().get();
45142 ArrowSchemaMetadata schema_metadata;
45143 if (extension.extension_metadata.IsCanonical()) {
45144 schema_metadata = ArrowSchemaMetadata::ArrowCanonicalType(extension.extension_metadata.GetExtensionName());
45145 } else {
45146 schema_metadata = ArrowSchemaMetadata::NonCanonicalType(extension.extension_metadata.GetTypeName(),
45147 extension.extension_metadata.GetVendorName());
45148 }
45149 root_holder.metadata_info.emplace_back(schema_metadata.SerializeMetadata());
45150 child.metadata = root_holder.metadata_info.back().get();
45151}
static ArrowSchemaMetadata ArrowCanonicalType(const string &extension_name)
Creates the metadata based on an extension name.
Definition duckdb.cpp:46317
static ArrowSchemaMetadata NonCanonicalType(const string &type_name, const string &vendor_name)
Creates the metadata based on an extension name.
Definition duckdb.cpp:46324
const char * format
Array type description.
Definition duckdb.hpp:11265

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