136265 {
136266 const Vector *vector = &v_p;
136268 bool finished = false;
136269 while (!finished) {
136270 switch (vector->GetVectorType()) {
136271 case VectorType::CONSTANT_VECTOR:
136273 finished = true;
136274 break;
136275 case VectorType::FLAT_VECTOR:
136276 finished = true;
136277 break;
136278 case VectorType::FSST_VECTOR:
136279 finished = true;
136280 break;
136281
136282 case VectorType::DICTIONARY_VECTOR: {
136283 auto &sel_vector = DictionaryVector::SelVector(*vector);
136284 auto &child = DictionaryVector::Child(*vector);
136285 vector = &child;
136286 index = sel_vector.get_index(index);
136287 break;
136288 }
136289 case VectorType::SEQUENCE_VECTOR: {
136291 SequenceVector::GetSequence(*vector, start, increment);
136293 start +
static_cast<int64_t>(
static_cast<uint64_t>(increment) * index));
136294 }
136295 default:
136296 throw InternalException("Unimplemented vector type for Vector::GetValue");
136297 }
136298 }
136299 auto data = vector->data;
136300 auto &
validity = vector->validity;
136301 auto &
type = vector->GetType();
136302
136303 if (!
validity.RowIsValid(index)) {
136304 return Value(vector->GetType());
136305 }
136306
136307 if (vector->GetVectorType() == VectorType::FSST_VECTOR) {
136309 throw InternalException("FSST Vector with non-string datatype found!");
136310 }
136311 auto str_compressed =
reinterpret_cast<string_t *
>(
data)[index];
136312 auto decoder = FSSTVector::GetDecoder(*vector);
136313 auto &decompress_buffer = FSSTVector::GetDecompressBuffer(*vector);
136314 auto string_val = FSSTPrimitives::DecompressValue(decoder, str_compressed.GetData(), str_compressed.GetSize(),
136315 decompress_buffer);
136316 switch (vector->GetType().id()) {
136317 case LogicalTypeId::VARCHAR:
136318 return Value(std::move(string_val));
136319 case LogicalTypeId::BLOB:
136320 return Value::BLOB_RAW(string_val);
136321 default:
136322 throw InternalException("Unsupported vector type for FSST vector");
136323 }
136324 }
136325
136326 switch (vector->GetType().id()) {
136327 case LogicalTypeId::BOOLEAN:
136329 case LogicalTypeId::TINYINT:
136331 case LogicalTypeId::SMALLINT:
136333 case LogicalTypeId::INTEGER:
136335 case LogicalTypeId::DATE:
136337 case LogicalTypeId::TIME:
136339 case LogicalTypeId::TIME_NS:
136340 return Value::TIME_NS(
reinterpret_cast<dtime_ns_t *
>(
data)[index]);
136341 case LogicalTypeId::TIME_TZ:
136342 return Value::TIMETZ(
reinterpret_cast<dtime_tz_t *
>(
data)[index]);
136343 case LogicalTypeId::BIGINT:
136345 case LogicalTypeId::UTINYINT:
136347 case LogicalTypeId::USMALLINT:
136349 case LogicalTypeId::UINTEGER:
136351 case LogicalTypeId::UBIGINT:
136353 case LogicalTypeId::TIMESTAMP:
136357 case LogicalTypeId::TIMESTAMP_MS:
136359 case LogicalTypeId::TIMESTAMP_SEC:
136361 case LogicalTypeId::TIMESTAMP_TZ:
136363 case LogicalTypeId::HUGEINT:
136365 case LogicalTypeId::UHUGEINT:
136367 case LogicalTypeId::UUID:
136369 case LogicalTypeId::DECIMAL: {
136370 auto width = DecimalType::GetWidth(
type);
136371 auto scale = DecimalType::GetScale(
type);
136372 switch (
type.InternalType()) {
136374 return Value::DECIMAL(
reinterpret_cast<int16_t *
>(
data)[index], width, scale);
136376 return Value::DECIMAL(
reinterpret_cast<int32_t *
>(
data)[index], width, scale);
136378 return Value::DECIMAL(
reinterpret_cast<int64_t *
>(
data)[index], width, scale);
136379 case PhysicalType::INT128:
136380 return Value::DECIMAL(
reinterpret_cast<hugeint_t *
>(
data)[index], width, scale);
136381 default:
136382 throw InternalException("Physical type '%s' has a width bigger than 38, which is not supported",
136383 TypeIdToString(
type.InternalType()));
136384 }
136385 }
136386 case LogicalTypeId::ENUM: {
136387 switch (
type.InternalType()) {
136394 default:
136395 throw InternalException("ENUM can only have unsigned integers as physical types");
136396 }
136397 }
136398 case LogicalTypeId::POINTER:
136400 case LogicalTypeId::FLOAT:
136402 case LogicalTypeId::DOUBLE:
136404 case LogicalTypeId::INTERVAL:
136405 return Value::INTERVAL(
reinterpret_cast<interval_t *
>(
data)[index]);
136406 case LogicalTypeId::VARCHAR: {
136407 auto str =
reinterpret_cast<string_t *
>(
data)[index];
136408 return Value(str.GetString());
136409 }
136410 case LogicalTypeId::BLOB: {
136411 auto str =
reinterpret_cast<string_t *
>(
data)[index];
136412 return Value::BLOB(const_data_ptr_cast(str.GetData()), str.GetSize());
136413 }
136414 case LogicalTypeId::BIGNUM: {
136415 auto str =
reinterpret_cast<bignum_t *
>(
data)[index];
136416 return Value::BIGNUM(const_data_ptr_cast(str.data.GetData()), str.data.GetSize());
136417 }
136418 case LogicalTypeId::GEOMETRY: {
136419 auto str =
reinterpret_cast<string_t *
>(
data)[index];
136420 if (GeoType::HasCRS(
type)) {
136421 return Value::GEOMETRY(const_data_ptr_cast(str.GetData()), str.GetSize(), GeoType::GetCRS(
type));
136422 }
136423 return Value::GEOMETRY(const_data_ptr_cast(str.GetData()), str.GetSize());
136424 }
136425 case LogicalTypeId::AGGREGATE_STATE: {
136426 auto str =
reinterpret_cast<string_t *
>(
data)[index];
136428 }
136429 case LogicalTypeId::BIT: {
136430 auto str =
reinterpret_cast<string_t *
>(
data)[index];
136431 return Value::BIT(const_data_ptr_cast(str.GetData()), str.GetSize());
136432 }
136433 case LogicalTypeId::SQLNULL: {
136434 return Value();
136435 }
136436 case LogicalTypeId::MAP: {
136437 auto offlen =
reinterpret_cast<list_entry_t *
>(
data)[index];
136439 duckdb::vector<Value> children;
136440 for (
idx_t i = offlen.offset; i < offlen.offset + offlen.length; i++) {
136441 children.push_back(child_vec.GetValue(i));
136442 }
136443 return Value::MAP(ListType::GetChildType(
type), std::move(children));
136444 }
136445 case LogicalTypeId::UNION: {
136446
136447
136448 union_tag_t tag;
136451 auto members = UnionType::CopyMemberTypes(
type);
136453 } else {
136454 return Value(vector->GetType());
136455 }
136456 }
136457 case LogicalTypeId::VARIANT: {
136458 duckdb::vector<Value> children;
136464 }
136465 case LogicalTypeId::STRUCT: {
136466
136467 auto &child_entries = StructVector::GetEntries(*vector);
136468 duckdb::vector<Value> children;
136469 for (
idx_t child_idx = 0; child_idx < child_entries.size(); child_idx++) {
136470 auto &struct_child = child_entries[child_idx];
136471 children.push_back(struct_child->GetValue(index_p));
136472 }
136474 }
136475 case LogicalTypeId::LIST: {
136476 auto offlen =
reinterpret_cast<list_entry_t *
>(
data)[index];
136478 duckdb::vector<Value> children;
136479 for (
idx_t i = offlen.offset; i < offlen.offset + offlen.length; i++) {
136480 children.push_back(child_vec.GetValue(i));
136481 }
136482 return Value::LIST(ListType::GetChildType(
type), std::move(children));
136483 }
136484 case LogicalTypeId::ARRAY: {
136485 auto stride = ArrayType::GetSize(
type);
136486 auto offset =
index * stride;
136488 duckdb::vector<Value> children;
136489 for (
idx_t i = offset; i < offset + stride; i++) {
136490 children.push_back(child_vec.GetValue(i));
136491 }
136492 return Value::ARRAY(ArrayType::GetChildType(
type), std::move(children));
136493 }
136494 case LogicalTypeId::TYPE: {
136495 auto blob =
reinterpret_cast<string_t *
>(
data)[index];
136496 return Value::TYPE(blob);
136497 }
136498 default:
136499 throw InternalException("Unimplemented type for value access");
136500 }
136501}
static DUCKDB_API Value UNION(child_list_t< LogicalType > members, uint8_t tag, Value value)
Create a union value from a selected value and a tag from a set of alternatives.
Definition duckdb.cpp:132530
static DUCKDB_API Value INTEGER(int32_t value)
Create an integer Value from a specified value.
Definition duckdb.cpp:132139
static DUCKDB_API Value HUGEINT(hugeint_t value)
Create a hugeint Value from a specified value.
Definition duckdb.cpp:132153
static DUCKDB_API Value SMALLINT(int16_t value)
Create a smallint Value from a specified value.
Definition duckdb.cpp:132132
static DUCKDB_API Value BLOB(const_data_ptr_t data, idx_t len)
Create a blob Value from a data pointer and a length: no bytes are interpreted.
Definition duckdb.cpp:132586
static DUCKDB_API Value AGGREGATE_STATE(const LogicalType &type, const_data_ptr_t data, idx_t len)
Creates an aggregate state.
Definition duckdb.cpp:132648
static DUCKDB_API Value MAP(const LogicalType &child_type, vector< Value > values)
Create a map value with the given entries.
Definition duckdb.cpp:132466
static DUCKDB_API Value BOOLEAN(bool value)
Create a boolean Value from a specified value.
Definition duckdb.cpp:132118
static DUCKDB_API Value TIME(dtime_t time)
Create a time Value from a specified time.
Definition duckdb.cpp:132349
static DUCKDB_API Value TIMESTAMPNS(timestamp_ns_t timestamp)
Create a timestamp_ns Value from a specified value.
Definition duckdb.cpp:132395
static DUCKDB_API Value TIMESTAMP(date_t date, dtime_t time)
Create a timestamp Value from a specified date/time combination.
Definition duckdb.cpp:132409
static DUCKDB_API Value BIGINT(int64_t value)
Create a bigint Value from a specified value.
Definition duckdb.cpp:132146
static DUCKDB_API Value DOUBLE(double value)
Create a double Value from a specified value.
Definition duckdb.cpp:132317
static DUCKDB_API Value UHUGEINT(uhugeint_t value)
Create a uhugeint Value from a specified value.
Definition duckdb.cpp:132160
static DUCKDB_API Value POINTER(uintptr_t value)
Create a pointer Value from a specified value.
Definition duckdb.cpp:132331
static DUCKDB_API Value VARIANT(vector< Value > children)
Create a variant value with given list of internal variant data (keys/children/values/data).
Definition duckdb.cpp:132444
static DUCKDB_API Value USMALLINT(uint16_t value)
Create an unsigned smallint Value from a specified value.
Definition duckdb.cpp:132188
static DUCKDB_API Value UINTEGER(uint32_t value)
Create an unsigned integer Value from a specified value.
Definition duckdb.cpp:132195
static DUCKDB_API Value Numeric(const LogicalType &type, int64_t value)
Create a Numeric value of the specified type with the specified value.
Definition duckdb.cpp:133053
static DUCKDB_API Value BIT(const_data_ptr_t data, idx_t len)
Creates a bitstring by casting a specified string to a bitstring.
Definition duckdb.cpp:132655
static DUCKDB_API Value TIMESTAMPTZ(timestamp_tz_t timestamp)
Create a timestamp_tz Value from a specified value.
Definition duckdb.cpp:132402
static DUCKDB_API Value LIST(const LogicalType &child_type, vector< Value > values)
Create a list value with the given entries.
Definition duckdb.cpp:132555
static DUCKDB_API Value STRUCT(child_list_t< Value > values)
Create a struct value with given list of entries.
Definition duckdb.cpp:132434
static DUCKDB_API Value TIMESTAMPMS(timestamp_ms_t timestamp)
Create a timestamp_ms Value from a specified value.
Definition duckdb.cpp:132388
static DUCKDB_API Value UTINYINT(uint8_t value)
Create an unsigned tinyint Value from a specified value.
Definition duckdb.cpp:132181
static DUCKDB_API Value FLOAT(float value)
Create a float Value from a specified value.
Definition duckdb.cpp:132310
static DUCKDB_API Value TIMESTAMPSEC(timestamp_sec_t timestamp)
Create a timestamp_s Value from a specified value.
Definition duckdb.cpp:132381
static DUCKDB_API Value UUID(const string &value)
Create a uuid Value from a specified value.
Definition duckdb.cpp:132174
static DUCKDB_API Value DATE(date_t date)
Create a date Value from a specified date.
Definition duckdb.cpp:132338
static DUCKDB_API Value TINYINT(int8_t value)
Create a tinyint Value from a specified value.
Definition duckdb.cpp:132125
static DUCKDB_API Value UBIGINT(uint64_t value)
Create an unsigned bigint Value from a specified value.
Definition duckdb.cpp:132202
void scale(cv::Mat &mat, const cv::Mat &range, const T min, const T max)
@ TIMESTAMP_NS
us
Definition duckdb.hpp:2886
static DUCKDB_API bool TryGetTag(const Vector &vector, idx_t index, union_tag_t &tag)
Definition duckdb.cpp:138451
static DUCKDB_API const Vector & GetMember(const Vector &vector, idx_t member_index)
Get the member vector of a union vector by index.
Definition duckdb.cpp:138372
static DUCKDB_API Vector & GetKeys(Vector &vec)
Gets a reference to the 'keys' list (dictionary) of a Variant.
Definition duckdb.cpp:138595
static DUCKDB_API Vector & GetData(Vector &vec)
Gets a reference to the binary blob 'value', which encodes the data of the row.
Definition duckdb.cpp:138652
static DUCKDB_API Vector & GetChildren(Vector &vec)
Gets a reference to the 'children' list of a Variant.
Definition duckdb.cpp:138602
static DUCKDB_API Vector & GetValues(Vector &vec)
Gets a reference to the 'values' list of a Variant.
Definition duckdb.cpp:138627