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::ArrowType Class Reference
Collaboration diagram for duckdb::ArrowType:

Public Member Functions

 ArrowType (LogicalType type_p, unique_ptr< ArrowTypeInfo > type_info=nullptr)
 From a DuckDB type.
 ArrowType (string error_message_p, bool not_implemented_p=false)
LogicalType GetDuckType (bool use_dictionary=false) const
void SetDictionary (unique_ptr< ArrowType > dictionary)
bool HasDictionary () const
const ArrowType & GetDictionary () const
bool RunEndEncoded () const
void SetRunEndEncoded ()
template<class T>
const T & GetTypeInfo () const
void ThrowIfInvalid () const
bool HasExtension () const
ArrowArrayPhysicalType GetPhysicalType () const

Static Public Member Functions

static unique_ptr< ArrowType > GetTypeFromFormat (string &format)
static unique_ptr< ArrowType > GetTypeFromFormat (ClientContext &context, ArrowSchema &schema, string &format)
static unique_ptr< ArrowType > GetTypeFromSchema (ClientContext &context, ArrowSchema &schema)
static unique_ptr< ArrowType > CreateListType (ClientContext &context, ArrowSchema &child, ArrowVariableSizeType size_type, bool view)
static unique_ptr< ArrowType > GetArrowLogicalType (ClientContext &context, ArrowSchema &schema)

Public Attributes

shared_ptr< ArrowTypeExtensionData > extension_data
 The Arrow Type Extension data, if any.

Protected Attributes

LogicalType type
unique_ptr< ArrowType > dictionary_type
 Hold the optional type if the array is a dictionary.
bool run_end_encoded = false
 Is run-end-encoded.
unique_ptr< ArrowTypeInfo > type_info
string error_message
 Error message in case of an invalid type (i.e., from an unsupported extension).
bool not_implemented = false
 In case of an error do we throw not implemented?

Constructor & Destructor Documentation

◆ ArrowType() [1/2]

duckdb::ArrowType::ArrowType ( LogicalType type_p,
unique_ptr< ArrowTypeInfo > type_info = nullptr )
inlineexplicit

From a DuckDB type.

37692 : type(std::move(type_p)), type_info(std::move(type_info)) {
37693 }

◆ ArrowType() [2/2]

duckdb::ArrowType::ArrowType ( string error_message_p,
bool not_implemented_p = false )
inlineexplicit
37695 : type(LogicalTypeId::INVALID), type_info(nullptr), error_message(std::move(error_message_p)),
37696 not_implemented(not_implemented_p) {
37697 }
bool not_implemented
In case of an error do we throw not implemented?
Definition duckdb.hpp:37742
string error_message
Error message in case of an invalid type (i.e., from an unsupported extension).
Definition duckdb.hpp:37740

Member Function Documentation

◆ GetDuckType()

LogicalType duckdb::ArrowType::GetDuckType ( bool use_dictionary = false) const
239337 {
239338 if (use_dictionary && dictionary_type) {
239339 return dictionary_type->GetDuckType();
239340 }
239341 if (!use_dictionary) {
239342 return type;
239343 }
239344 // Dictionaries can exist in arbitrarily nested schemas
239345 // have to reconstruct the type
239346 auto id = type.id();
239347 switch (id) {
239348 case LogicalTypeId::STRUCT: {
239349 auto &struct_info = type_info->Cast<ArrowStructInfo>();
239350 child_list_t<LogicalType> new_children;
239351 for (idx_t i = 0; i < struct_info.ChildCount(); i++) {
239352 auto &child = struct_info.GetChild(i);
239353 auto &child_name = StructType::GetChildName(type, i);
239354 new_children.emplace_back(std::make_pair(child_name, child.GetDuckType(true)));
239355 }
239356 return LogicalType::STRUCT(std::move(new_children));
239357 }
239358 case LogicalTypeId::LIST: {
239359 auto &list_info = type_info->Cast<ArrowListInfo>();
239360 auto &child = list_info.GetChild();
239361 return LogicalType::LIST(child.GetDuckType(true));
239362 }
239363 case LogicalTypeId::MAP: {
239364 auto &list_info = type_info->Cast<ArrowListInfo>();
239365 auto &struct_child = list_info.GetChild();
239366 auto struct_type = struct_child.GetDuckType(true);
239367 return LogicalType::MAP(StructType::GetChildType(struct_type, 0), StructType::GetChildType(struct_type, 1));
239368 }
239369 case LogicalTypeId::UNION: {
239370 auto &union_info = type_info->Cast<ArrowStructInfo>();
239371 child_list_t<LogicalType> new_children;
239372 for (idx_t i = 0; i < union_info.ChildCount(); i++) {
239373 auto &child = union_info.GetChild(i);
239374 auto &child_name = UnionType::GetMemberName(type, i);
239375 new_children.emplace_back(std::make_pair(child_name, child.GetDuckType(true)));
239376 }
239377 return LogicalType::UNION(std::move(new_children));
239378 }
239379 default: {
239380 return type;
239381 }
239382 }
239383}
unique_ptr< ArrowType > dictionary_type
Hold the optional type if the array is a dictionary.
Definition duckdb.hpp:37735
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ SetDictionary()

void duckdb::ArrowType::SetDictionary ( unique_ptr< ArrowType > dictionary)
239032 {
239033 D_ASSERT(!this->dictionary_type);
239034 dictionary_type = std::move(dictionary);
239035}

◆ HasDictionary()

bool duckdb::ArrowType::HasDictionary ( ) const
239037 {
239038 return dictionary_type != nullptr;
239039}

◆ GetDictionary()

const ArrowType & duckdb::ArrowType::GetDictionary ( ) const
239041 {
239042 D_ASSERT(dictionary_type);
239043 return *dictionary_type;
239044}

◆ RunEndEncoded()

bool duckdb::ArrowType::RunEndEncoded ( ) const
239058 {
239059 return run_end_encoded;
239060}
bool run_end_encoded
Is run-end-encoded.
Definition duckdb.hpp:37737

◆ SetRunEndEncoded()

void duckdb::ArrowType::SetRunEndEncoded ( )
239046 {
239047 D_ASSERT(type_info);
239048 D_ASSERT(type_info->type == ArrowTypeInfoType::STRUCT);
239049 auto &struct_info = type_info->Cast<ArrowStructInfo>();
239050 D_ASSERT(struct_info.ChildCount() == 2);
239051
239052 auto actual_type = struct_info.GetChild(1).GetDuckType();
239053 // Override the duckdb type to the actual type
239054 type = actual_type;
239055 run_end_encoded = true;
239056}

◆ GetTypeInfo()

template<class T>
const T & duckdb::ArrowType::GetTypeInfo ( ) const
inline
37710 {
37711 return type_info->Cast<T>();
37712 }

◆ ThrowIfInvalid()

void duckdb::ArrowType::ThrowIfInvalid ( ) const
239062 {
239063 if (type.id() == LogicalTypeId::INVALID) {
239064 if (not_implemented) {
239065 throw NotImplementedException(error_message);
239066 }
239067 throw InvalidInputException(error_message);
239068 }
239069}

◆ GetTypeFromFormat() [1/2]

unique_ptr< ArrowType > duckdb::ArrowType::GetTypeFromFormat ( string & format)
static

this can be either decimal128 or decimal 256 (e.g., d:38,0)

239071 {
239072 if (format == "n") {
239073 return make_uniq<ArrowType>(LogicalType::SQLNULL);
239074 } else if (format == "b") {
239075 return make_uniq<ArrowType>(LogicalType::BOOLEAN);
239076 } else if (format == "c") {
239077 return make_uniq<ArrowType>(LogicalType::TINYINT);
239078 } else if (format == "s") {
239079 return make_uniq<ArrowType>(LogicalType::SMALLINT);
239080 } else if (format == "i") {
239081 return make_uniq<ArrowType>(LogicalType::INTEGER);
239082 } else if (format == "l") {
239083 return make_uniq<ArrowType>(LogicalType::BIGINT);
239084 } else if (format == "C") {
239085 return make_uniq<ArrowType>(LogicalType::UTINYINT);
239086 } else if (format == "S") {
239087 return make_uniq<ArrowType>(LogicalType::USMALLINT);
239088 } else if (format == "I") {
239089 return make_uniq<ArrowType>(LogicalType::UINTEGER);
239090 } else if (format == "L") {
239091 return make_uniq<ArrowType>(LogicalType::UBIGINT);
239092 } else if (format == "f") {
239093 return make_uniq<ArrowType>(LogicalType::FLOAT);
239094 } else if (format == "g") {
239095 return make_uniq<ArrowType>(LogicalType::DOUBLE);
239096 } else if (format[0] == 'd') {
239097 auto extra_info = StringUtil::Split(format, ':');
239098 if (extra_info.size() != 2) {
239099 throw InvalidInputException(
239100 "Decimal format of Arrow object is incomplete, it is missing the scale and width. Current format: %s",
239101 format);
239102 }
239103 auto parameters = StringUtil::Split(extra_info[1], ",");
239104 // Parameters must always be 2 or 3 values (i.e., width, scale and an optional bit-width)
239105 if (parameters.size() != 2 && parameters.size() != 3) {
239106 throw InvalidInputException(
239107 "Decimal format of Arrow object is incomplete, it is missing the scale or width. Current format: %s",
239108 format);
239109 }
239110 uint64_t width = std::stoull(parameters[0]);
239111 uint64_t scale = std::stoull(parameters[1]);
239112 uint64_t bitwidth = 128;
239113 if (parameters.size() == 3) {
239114 // We have a bit-width defined
239115 bitwidth = std::stoull(parameters[2]);
239116 }
239117 if (width > 38 || bitwidth > 128) {
239118 throw NotImplementedException("Unsupported Internal Arrow Type for Decimal %s", format);
239119 }
239120 switch (bitwidth) {
239121 case 32:
239122 return make_uniq<ArrowType>(LogicalType::DECIMAL(NumericCast<uint8_t>(width), NumericCast<uint8_t>(scale)),
239123 make_uniq<ArrowDecimalInfo>(DecimalBitWidth::DECIMAL_32));
239124 case 64:
239125 return make_uniq<ArrowType>(LogicalType::DECIMAL(NumericCast<uint8_t>(width), NumericCast<uint8_t>(scale)),
239126 make_uniq<ArrowDecimalInfo>(DecimalBitWidth::DECIMAL_64));
239127 case 128:
239128 return make_uniq<ArrowType>(LogicalType::DECIMAL(NumericCast<uint8_t>(width), NumericCast<uint8_t>(scale)),
239129 make_uniq<ArrowDecimalInfo>(DecimalBitWidth::DECIMAL_128));
239130 case 256:
239131 return make_uniq<ArrowType>(LogicalType::DECIMAL(NumericCast<uint8_t>(width), NumericCast<uint8_t>(scale)),
239132 make_uniq<ArrowDecimalInfo>(DecimalBitWidth::DECIMAL_256));
239133 default:
239134 throw NotImplementedException("Unsupported bit-width value of %d for Arrow Decimal type", bitwidth);
239135 }
239136 } else if (format == "u") {
239137 return make_uniq<ArrowType>(LogicalType::VARCHAR, make_uniq<ArrowStringInfo>(ArrowVariableSizeType::NORMAL));
239138 } else if (format == "U") {
239139 return make_uniq<ArrowType>(LogicalType::VARCHAR,
239140 make_uniq<ArrowStringInfo>(ArrowVariableSizeType::SUPER_SIZE));
239141 } else if (format == "vu") {
239142 return make_uniq<ArrowType>(LogicalType::VARCHAR, make_uniq<ArrowStringInfo>(ArrowVariableSizeType::VIEW));
239143 } else if (format == "tsn:") {
239144 return make_uniq<ArrowType>(LogicalTypeId::TIMESTAMP_NS);
239145 } else if (format == "tsu:") {
239146 return make_uniq<ArrowType>(LogicalTypeId::TIMESTAMP);
239147 } else if (format == "tsm:") {
239148 return make_uniq<ArrowType>(LogicalTypeId::TIMESTAMP_MS);
239149 } else if (format == "tss:") {
239150 return make_uniq<ArrowType>(LogicalTypeId::TIMESTAMP_SEC);
239151 } else if (format == "tdD") {
239152 return make_uniq<ArrowType>(LogicalType::DATE, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::DAYS));
239153 } else if (format == "tdm") {
239154 return make_uniq<ArrowType>(LogicalType::DATE, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MILLISECONDS));
239155 } else if (format == "tts") {
239156 return make_uniq<ArrowType>(LogicalType::TIME, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::SECONDS));
239157 } else if (format == "ttm") {
239158 return make_uniq<ArrowType>(LogicalType::TIME, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MILLISECONDS));
239159 } else if (format == "ttu") {
239160 return make_uniq<ArrowType>(LogicalType::TIME, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MICROSECONDS));
239161 } else if (format == "ttn") {
239162 return make_uniq<ArrowType>(LogicalType::TIME_NS, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::NANOSECONDS));
239163 } else if (format == "tDs") {
239164 return make_uniq<ArrowType>(LogicalType::INTERVAL, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::SECONDS));
239165 } else if (format == "tDm") {
239166 return make_uniq<ArrowType>(LogicalType::INTERVAL,
239167 make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MILLISECONDS));
239168 } else if (format == "tDu") {
239169 return make_uniq<ArrowType>(LogicalType::INTERVAL,
239170 make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MICROSECONDS));
239171 } else if (format == "tDn") {
239172 return make_uniq<ArrowType>(LogicalType::INTERVAL,
239173 make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::NANOSECONDS));
239174 } else if (format == "tiD") {
239175 return make_uniq<ArrowType>(LogicalType::INTERVAL, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::DAYS));
239176 } else if (format == "tiM") {
239177 return make_uniq<ArrowType>(LogicalType::INTERVAL, make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MONTHS));
239178 } else if (format == "tin") {
239179 return make_uniq<ArrowType>(LogicalType::INTERVAL,
239180 make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MONTH_DAY_NANO));
239181 } else if (format == "z") {
239182 auto type_info = make_uniq<ArrowStringInfo>(ArrowVariableSizeType::NORMAL);
239183 return make_uniq<ArrowType>(LogicalType::BLOB, std::move(type_info));
239184 } else if (format == "Z") {
239185 auto type_info = make_uniq<ArrowStringInfo>(ArrowVariableSizeType::SUPER_SIZE);
239186 return make_uniq<ArrowType>(LogicalType::BLOB, std::move(type_info));
239187 } else if (format == "vz") {
239188 auto type_info = make_uniq<ArrowStringInfo>(ArrowVariableSizeType::VIEW);
239189 return make_uniq<ArrowType>(LogicalType::BLOB, std::move(type_info));
239190 } else if (format[0] == 'w') {
239191 // Arrow C Data Interface spec: fixed-size binary is "w:NN", colon always at position 1
239192 if (format.size() <= 2 || format[1] != ':') {
239193 throw InvalidInputException("Invalid Arrow fixed-size binary format string: \"%s\"", format);
239194 }
239195 string parameters = format.substr(2);
239196 auto fixed_size = NumericCast<idx_t>(std::stoi(parameters));
239197 auto type_info = make_uniq<ArrowStringInfo>(fixed_size);
239198 return make_uniq<ArrowType>(LogicalType::BLOB, std::move(type_info));
239199 } else if (format[0] == 't' && format[1] == 's') {
239200 // Timestamp with Timezone
239201 // TODO right now we just get the UTC value. We probably want to support this properly in the future
239202 unique_ptr<ArrowTypeInfo> type_info;
239203 if (format[2] == 'n') {
239204 type_info = make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::NANOSECONDS);
239205 } else if (format[2] == 'u') {
239206 type_info = make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MICROSECONDS);
239207 } else if (format[2] == 'm') {
239208 type_info = make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::MILLISECONDS);
239209 } else if (format[2] == 's') {
239210 type_info = make_uniq<ArrowDateTimeInfo>(ArrowDateTimeType::SECONDS);
239211 } else {
239212 throw NotImplementedException(" Timestamptz precision of not accepted");
239213 }
239214 return make_uniq<ArrowType>(LogicalType::TIMESTAMP_TZ, std::move(type_info));
239215 }
239216 return nullptr;
239217}
static DUCKDB_API vector< string > Split(const string &str, char delimiter)
Split the input string based on newline char.
Definition duckdb.cpp:109734
std::basic_string< Char > format(const S &format_str, Args &&... args)
Definition duckdb.cpp:16295
void scale(cv::Mat &mat, const cv::Mat &range, const T min, const T max)
::uint64_t uint64_t
@ TIMESTAMP_NS
us
Definition duckdb.hpp:2886
Here is the call graph for this function:

◆ GetTypeFromFormat() [2/2]

unique_ptr< ArrowType > duckdb::ArrowType::GetTypeFromFormat ( ClientContext & context,
ArrowSchema & schema,
string & format )
static
239219 {
239220 auto type = GetTypeFromFormat(format);
239221
239222 if (type) {
239223 return type;
239224 }
239225 if (format == "+l") {
239226 return CreateListType(context, *schema.children[0], ArrowVariableSizeType::NORMAL, false);
239227 } else if (format == "+L") {
239228 return CreateListType(context, *schema.children[0], ArrowVariableSizeType::SUPER_SIZE, false);
239229 } else if (format == "+vl") {
239230 return CreateListType(context, *schema.children[0], ArrowVariableSizeType::NORMAL, true);
239231 } else if (format == "+vL") {
239232 return CreateListType(context, *schema.children[0], ArrowVariableSizeType::SUPER_SIZE, true);
239233 } else if (format[0] == '+' && format[1] == 'w') {
239234 // Arrow C Data Interface spec: fixed-size list is "+w:NN", colon always at position 2
239235 if (format.size() <= 3 || format[2] != ':') {
239236 throw InvalidInputException("Invalid Arrow fixed-size list format string: \"%s\"", format);
239237 }
239238 std::string parameters = format.substr(3);
239239 auto fixed_size = NumericCast<idx_t>(std::stoi(parameters));
239240 auto child_type = GetArrowLogicalType(context, *schema.children[0]);
239241
239242 auto array_type = LogicalType::ARRAY(child_type->GetDuckType(), fixed_size);
239243 auto type_info = make_uniq<ArrowArrayInfo>(std::move(child_type), fixed_size);
239244 return make_uniq<ArrowType>(array_type, std::move(type_info));
239245 } else if (format == "+s") {
239246 child_list_t<LogicalType> child_types;
239247 vector<shared_ptr<ArrowType>> children;
239248 if (schema.n_children == 0) {
239249 throw InvalidInputException(
239250 "Attempted to convert a STRUCT with no fields to DuckDB which is not supported");
239251 }
239252 for (idx_t type_idx = 0; type_idx < static_cast<idx_t>(schema.n_children); type_idx++) {
239253 children.emplace_back(GetArrowLogicalType(context, *schema.children[type_idx]));
239254 child_types.emplace_back(schema.children[type_idx]->name, children.back()->GetDuckType());
239255 }
239256 auto type_info = make_uniq<ArrowStructInfo>(std::move(children));
239257 auto struct_type = make_uniq<ArrowType>(LogicalType::STRUCT(std::move(child_types)), std::move(type_info));
239258 return struct_type;
239259 } else if (format[0] == '+' && format[1] == 'u') {
239260 if (format[2] != 's') {
239261 throw NotImplementedException("Unsupported Internal Arrow Type: \"%c\" Union", format[2]);
239262 }
239263 D_ASSERT(format[3] == ':');
239264
239265 std::string prefix = "+us:";
239266 // TODO: what are these type ids actually for?
239267 auto type_ids = StringUtil::Split(format.substr(prefix.size()), ',');
239268
239269 child_list_t<LogicalType> members;
239270 vector<shared_ptr<ArrowType>> children;
239271 if (schema.n_children == 0) {
239272 throw InvalidInputException("Attempted to convert a UNION with no fields to DuckDB which is not supported");
239273 }
239274 for (idx_t type_idx = 0; type_idx < static_cast<idx_t>(schema.n_children); type_idx++) {
239275 auto type = schema.children[type_idx];
239276
239277 children.emplace_back(GetArrowLogicalType(context, *type));
239278 members.emplace_back(type->name, children.back()->GetDuckType());
239279 }
239280
239281 auto type_info = make_uniq<ArrowStructInfo>(std::move(children));
239282 auto union_type = make_uniq<ArrowType>(LogicalType::UNION(members), std::move(type_info));
239283 return union_type;
239284 } else if (format == "+r") {
239285 child_list_t<LogicalType> members;
239286 vector<shared_ptr<ArrowType>> children;
239287 idx_t n_children = static_cast<idx_t>(schema.n_children);
239288 D_ASSERT(n_children == 2);
239289 D_ASSERT(string(schema.children[0]->name) == "run_ends");
239290 D_ASSERT(string(schema.children[1]->name) == "values");
239291 for (idx_t i = 0; i < n_children; i++) {
239292 auto type = schema.children[i];
239293 children.emplace_back(GetArrowLogicalType(context, *type));
239294 members.emplace_back(type->name, children.back()->GetDuckType());
239295 }
239296
239297 auto type_info = make_uniq<ArrowStructInfo>(std::move(children));
239298 auto struct_type = make_uniq<ArrowType>(LogicalType::STRUCT(members), std::move(type_info));
239299 struct_type->SetRunEndEncoded();
239300 return struct_type;
239301 } else if (format == "+m") {
239302 auto &arrow_struct_type = *schema.children[0];
239303 D_ASSERT(arrow_struct_type.n_children == 2);
239304 auto key_type = GetArrowLogicalType(context, *arrow_struct_type.children[0]);
239305 auto value_type = GetArrowLogicalType(context, *arrow_struct_type.children[1]);
239306 child_list_t<LogicalType> key_value;
239307 key_value.emplace_back(std::make_pair("key", key_type->GetDuckType()));
239308 key_value.emplace_back(std::make_pair("value", value_type->GetDuckType()));
239309
239310 auto map_type = LogicalType::MAP(key_type->GetDuckType(), value_type->GetDuckType());
239311 vector<shared_ptr<ArrowType>> children;
239312 children.reserve(2);
239313 children.push_back(std::move(key_type));
239314 children.push_back(std::move(value_type));
239315 auto inner_struct = make_uniq<ArrowType>(LogicalType::STRUCT(std::move(key_value)),
239316 make_uniq<ArrowStructInfo>(std::move(children)));
239317 auto map_type_info = ArrowListInfo::List(std::move(inner_struct), ArrowVariableSizeType::NORMAL);
239318 return make_uniq<ArrowType>(map_type, std::move(map_type_info));
239319 }
239320 throw NotImplementedException("Unsupported Internal Arrow Type %s", format);
239321}
static unique_ptr< ArrowType > GetTypeFromFormat(string &format)
Definition duckdb.cpp:239071
R value_type

◆ GetTypeFromSchema()

unique_ptr< ArrowType > duckdb::ArrowType::GetTypeFromSchema ( ClientContext & context,
ArrowSchema & schema )
static
239408 {
239409 auto format = string(schema.format);
239410 // Let's first figure out if this type is an extension type
239411 ArrowSchemaMetadata schema_metadata(schema.metadata);
239412 auto &config = DBConfig::GetConfig(context);
239413 auto arrow_type = GetTypeFromFormat(context, schema, format);
239414 if (schema_metadata.HasExtension()) {
239415 auto extension_info = schema_metadata.GetExtensionInfo(string(format));
239416 if (config.HasArrowExtension(extension_info)) {
239417 auto extension = config.GetArrowExtension(extension_info);
239418 arrow_type = extension.GetType(context, schema, schema_metadata);
239419 arrow_type->extension_data = extension.GetTypeExtension();
239420 }
239421 }
239422
239423 return arrow_type;
239424}
const char * format
Array type description.
Definition duckdb.hpp:11265

◆ CreateListType()

unique_ptr< ArrowType > duckdb::ArrowType::CreateListType ( ClientContext & context,
ArrowSchema & child,
ArrowVariableSizeType size_type,
bool view )
static
239324 {
239325 auto child_type = GetArrowLogicalType(context, child);
239326
239327 unique_ptr<ArrowTypeInfo> type_info;
239328 auto type = LogicalType::LIST(child_type->GetDuckType());
239329 if (view) {
239330 type_info = ArrowListInfo::ListView(std::move(child_type), size_type);
239331 } else {
239332 type_info = ArrowListInfo::List(std::move(child_type), size_type);
239333 }
239334 return make_uniq<ArrowType>(type, std::move(type_info));
239335}

◆ GetArrowLogicalType()

unique_ptr< ArrowType > duckdb::ArrowType::GetArrowLogicalType ( ClientContext & context,
ArrowSchema & schema )
static
239385 {
239386 auto arrow_type = ArrowType::GetTypeFromSchema(context, schema);
239387 if (schema.dictionary) {
239388 auto dictionary = GetArrowLogicalType(context, *schema.dictionary);
239389 arrow_type->SetDictionary(std::move(dictionary));
239390 }
239391 return arrow_type;
239392}

◆ HasExtension()

bool duckdb::ArrowType::HasExtension ( ) const
239394 {
239395 return extension_data.get() != nullptr;
239396}
shared_ptr< ArrowTypeExtensionData > extension_data
The Arrow Type Extension data, if any.
Definition duckdb.hpp:37730

◆ GetPhysicalType()

ArrowArrayPhysicalType duckdb::ArrowType::GetPhysicalType ( ) const
239398 {
239399 if (HasDictionary()) {
239400 return ArrowArrayPhysicalType::DICTIONARY_ENCODED;
239401 }
239402 if (RunEndEncoded()) {
239403 return ArrowArrayPhysicalType::RUN_END_ENCODED;
239404 }
239405 return ArrowArrayPhysicalType::DEFAULT;
239406}

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