239071 {
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') {
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",
239102 }
239104
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",
239109 }
239110 uint64_t width = std::stoull(parameters[0]);
239113 if (parameters.size() == 3) {
239114
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:") {
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
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));
239200
239201
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)
@ TIMESTAMP_NS
us
Definition duckdb.hpp:2886