Kùzu C++ API
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5#include <unordered_map>
6#include <unordered_set>
7#include <vector>
8
9#include "api.h"
10#include "cast.h"
11#include "copy_constructors.h"
12#include "interval_t.h"
13
14namespace kuzu {
15namespace main {
16class ClientContext;
17}
18namespace processor {
19class ParquetReader;
20};
21namespace common {
22
23class Serializer;
24class Deserializer;
25struct FileInfo;
26
27using sel_t = uint64_t;
28constexpr sel_t INVALID_SEL = UINT64_MAX;
29using hash_t = uint64_t;
30using page_idx_t = uint32_t;
32using page_offset_t = uint32_t;
33constexpr page_idx_t INVALID_PAGE_IDX = UINT32_MAX;
34using file_idx_t = uint32_t;
35constexpr file_idx_t INVALID_FILE_IDX = UINT32_MAX;
36using page_group_idx_t = uint32_t;
38using column_id_t = uint32_t;
39constexpr column_id_t INVALID_COLUMN_ID = UINT32_MAX;
41using idx_t = uint32_t;
42constexpr idx_t INVALID_IDX = UINT32_MAX;
43using block_idx_t = uint64_t;
44constexpr block_idx_t INVALID_BLOCK_IDX = UINT64_MAX;
45using struct_field_idx_t = uint8_t;
48using row_idx_t = uint64_t;
49constexpr row_idx_t INVALID_ROW_IDX = UINT64_MAX;
50constexpr uint32_t UNDEFINED_CAST_COST = UINT32_MAX;
51using node_group_idx_t = uint64_t;
53using partition_idx_t = uint64_t;
55using length_t = uint64_t;
56using list_size_t = uint32_t;
57using sequence_id_t = uint64_t;
58using oid_t = uint64_t;
59constexpr oid_t INVALID_OID = UINT64_MAX;
60
61using transaction_t = uint64_t;
62constexpr transaction_t INVALID_TRANSACTION = UINT64_MAX;
63using executor_id_t = uint64_t;
64using executor_info = std::unordered_map<executor_id_t, uint64_t>;
65
66// table id type alias
68using table_id_vector_t = std::vector<table_id_t>;
69using table_id_set_t = std::unordered_set<table_id_t>;
70template<typename T>
71using table_id_map_t = std::unordered_map<table_id_t, T>;
73// offset type alias
74using offset_t = uint64_t;
75constexpr offset_t INVALID_OFFSET = UINT64_MAX;
76// internal id type alias
77struct internalID_t;
80
81using cardinality_t = uint64_t;
82constexpr offset_t INVALID_LIMIT = UINT64_MAX;
83// System representation for internalID.
87
90
91 // comparison operators
92 bool operator==(const internalID_t& rhs) const;
93 bool operator!=(const internalID_t& rhs) const;
94 bool operator>(const internalID_t& rhs) const;
95 bool operator>=(const internalID_t& rhs) const;
96 bool operator<(const internalID_t& rhs) const;
97 bool operator<=(const internalID_t& rhs) const;
98};
99
100// System representation for a variable-sized overflow value.
102 // the size of the overflow buffer can be calculated as:
103 // numElements * sizeof(Element) + nullMap(4 bytes alignment)
104 uint64_t numElements = 0;
105 uint8_t* value = nullptr;
106};
107
115
117 int64_t pos;
118};
119
123
127
128struct int128_t;
129struct ku_string_t;
130
131template<typename T>
133 std::is_same_v<T, int8_t> || std::is_same_v<T, int16_t> || std::is_same_v<T, int32_t> ||
134 std::is_same_v<T, int64_t> || std::is_same_v<T, uint8_t> || std::is_same_v<T, uint16_t> ||
135 std::is_same_v<T, uint32_t> || std::is_same_v<T, uint64_t> || std::is_same_v<T, int128_t>;
136
137template<typename T>
138concept FloatingPointTypes = std::is_same_v<T, float> || std::is_same_v<T, double>;
139
140template<typename T>
141concept NumericTypes = IntegerTypes<T> || std::floating_point<T>;
142
143template<typename T>
144concept ComparableTypes = NumericTypes<T> || std::is_same_v<T, ku_string_t> ||
145 std::is_same_v<T, interval_t> || std::is_same_v<T, bool>;
146
147template<typename T>
148concept HashablePrimitive = ((std::integral<T> && !std::is_same_v<T, bool>) ||
149 std::floating_point<T> || std::is_same_v<T, int128_t>);
150template<typename T>
151concept IndexHashable = ((std::integral<T> && !std::is_same_v<T, bool>) || std::floating_point<T> ||
152 std::is_same_v<T, int128_t> || std::is_same_v<T, ku_string_t> ||
153 std::is_same_v<T, std::string_view> || std::same_as<T, std::string>);
154
155template<typename T>
156concept HashableNonNestedTypes = (std::integral<T> || std::floating_point<T> ||
157 std::is_same_v<T, int128_t> || std::is_same_v<T, internalID_t> ||
158 std::is_same_v<T, interval_t> || std::is_same_v<T, ku_string_t>);
159
160template<typename T>
162 (std::is_same_v<T, list_entry_t> || std::is_same_v<T, struct_entry_t>);
163
164template<typename T>
166
167enum class LogicalTypeID : uint8_t {
168 ANY = 0,
169 NODE = 10,
170 REL = 11,
171 RECURSIVE_REL = 12,
172 // SERIAL is a special data type that is used to represent a sequence of INT64 values that are
173 // incremented by 1 starting from 0.
174 SERIAL = 13,
175
176 BOOL = 22,
177 INT64 = 23,
178 INT32 = 24,
179 INT16 = 25,
180 INT8 = 26,
181 UINT64 = 27,
182 UINT32 = 28,
183 UINT16 = 29,
184 UINT8 = 30,
185 INT128 = 31,
186 DOUBLE = 32,
187 FLOAT = 33,
188 DATE = 34,
189 TIMESTAMP = 35,
190 TIMESTAMP_SEC = 36,
191 TIMESTAMP_MS = 37,
192 TIMESTAMP_NS = 38,
193 TIMESTAMP_TZ = 39,
194 INTERVAL = 40,
195 DECIMAL = 41,
196 INTERNAL_ID = 42,
197
198 STRING = 50,
199 BLOB = 51,
200
201 LIST = 52,
202 ARRAY = 53,
203 STRUCT = 54,
204 MAP = 55,
205 UNION = 56,
206 POINTER = 58,
207
208 UUID = 59,
209
210};
211
212enum class PhysicalTypeID : uint8_t {
213 // Fixed size types.
214 ANY = 0,
215 BOOL = 1,
216 INT64 = 2,
217 INT32 = 3,
218 INT16 = 4,
219 INT8 = 5,
220 UINT64 = 6,
221 UINT32 = 7,
222 UINT16 = 8,
223 UINT8 = 9,
224 INT128 = 10,
225 DOUBLE = 11,
226 FLOAT = 12,
227 INTERVAL = 13,
228 INTERNAL_ID = 14,
231
232 // Variable size types.
233 STRING = 20,
234 LIST = 22,
235 ARRAY = 23,
236 STRUCT = 24,
237 POINTER = 25,
238};
239
240class ExtraTypeInfo;
241class StructField;
242class StructTypeInfo;
243
244enum class TypeCategory : uint8_t { INTERNAL = 0, UDT = 1 };
245
247 friend struct LogicalTypeUtils;
248 friend struct DecimalType;
249 friend struct StructType;
250 friend struct ListType;
251 friend struct ArrayType;
252
253 KUZU_API LogicalType(const LogicalType& other);
254
255public:
256 KUZU_API LogicalType() : typeID{LogicalTypeID::ANY}, extraTypeInfo{nullptr} {
257 physicalType = getPhysicalType(this->typeID);
258 };
261
262 KUZU_API bool operator==(const LogicalType& other) const;
263 KUZU_API bool operator!=(const LogicalType& other) const;
264
265 KUZU_API std::string toString() const;
266 static bool isBuiltInType(const std::string& str);
267 static LogicalType convertFromString(const std::string& str, main::ClientContext* context);
268
269 KUZU_API LogicalTypeID getLogicalTypeID() const { return typeID; }
270 bool containsAny() const;
271 bool isInternalType() const { return category == TypeCategory::INTERNAL; }
272
273 KUZU_API PhysicalTypeID getPhysicalType() const { return physicalType; }
275 const std::unique_ptr<ExtraTypeInfo>& extraTypeInfo = nullptr);
276
277 void setExtraTypeInfo(std::unique_ptr<ExtraTypeInfo> typeInfo) {
278 extraTypeInfo = std::move(typeInfo);
279 }
280
281 const ExtraTypeInfo* getExtraTypeInfo() const { return extraTypeInfo.get(); }
282
283 void serialize(Serializer& serializer) const;
284
285 static LogicalType deserialize(Deserializer& deserializer);
286
287 KUZU_API static std::vector<LogicalType> copy(const std::vector<LogicalType>& types);
288 KUZU_API static std::vector<LogicalType> copy(const std::vector<LogicalType*>& types);
289
291
292 // NOTE: avoid using this if possible, this is a temporary hack for passing internal types
293 // TODO(Royi) remove this when float compression no longer relies on this or ColumnChunkData
294 // takes physical types instead of logical types
295 static LogicalType ANY(PhysicalTypeID physicalType) {
297 ret.physicalType = physicalType;
298 return ret;
299 }
300
321 static KUZU_API LogicalType DECIMAL(uint32_t precision, uint32_t scale);
328 static KUZU_API LogicalType STRUCT(std::vector<StructField>&& fields);
329
330 static KUZU_API LogicalType RECURSIVE_REL(std::unique_ptr<StructTypeInfo> typeInfo);
331
332 static KUZU_API LogicalType NODE(std::unique_ptr<StructTypeInfo> typeInfo);
333
334 static KUZU_API LogicalType REL(std::unique_ptr<StructTypeInfo> typeInfo);
335
336 static KUZU_API LogicalType UNION(std::vector<StructField>&& fields);
337
339 template<class T>
340 static inline LogicalType LIST(T&& childType) {
341 return LogicalType::LIST(LogicalType(std::forward<T>(childType)));
342 }
343
344 static KUZU_API LogicalType MAP(LogicalType keyType, LogicalType valueType);
345 template<class T>
346 static LogicalType MAP(T&& keyType, T&& valueType) {
347 return LogicalType::MAP(LogicalType(std::forward<T>(keyType)),
348 LogicalType(std::forward<T>(valueType)));
349 }
350
351 static KUZU_API LogicalType ARRAY(LogicalType childType, uint64_t numElements);
352 template<class T>
353 static LogicalType ARRAY(T&& childType, uint64_t numElements) {
354 return LogicalType::ARRAY(LogicalType(std::forward<T>(childType)), numElements);
355 }
356
357private:
358 friend struct CAPIHelper;
359 friend struct JavaAPIHelper;
361 explicit LogicalType(LogicalTypeID typeID, std::unique_ptr<ExtraTypeInfo> extraTypeInfo);
362
363private:
364 LogicalTypeID typeID;
365 PhysicalTypeID physicalType;
366 std::unique_ptr<ExtraTypeInfo> extraTypeInfo;
368};
369
371public:
372 virtual ~ExtraTypeInfo() = default;
373
374 void serialize(Serializer& serializer) const { serializeInternal(serializer); }
375
376 virtual bool containsAny() const = 0;
377
378 virtual bool operator==(const ExtraTypeInfo& other) const = 0;
379
380 virtual std::unique_ptr<ExtraTypeInfo> copy() const = 0;
381
382 template<class TARGET>
383 const TARGET* constPtrCast() const {
385 }
386
387protected:
388 virtual void serializeInternal(Serializer& serializer) const = 0;
389};
390
392public:
393 explicit UDTTypeInfo(std::string typeName) : typeName{std::move(typeName)} {}
394
395 std::string getTypeName() const { return typeName; }
396
397 bool containsAny() const override { return false; }
398
399 bool operator==(const ExtraTypeInfo& other) const override;
400
401 std::unique_ptr<ExtraTypeInfo> copy() const override;
402
403 static std::unique_ptr<ExtraTypeInfo> deserialize(Deserializer& deserializer);
404
405private:
406 void serializeInternal(Serializer& serializer) const override;
407
408private:
409 std::string typeName;
410};
411
412class DecimalTypeInfo final : public ExtraTypeInfo {
413public:
414 explicit DecimalTypeInfo(uint32_t precision = 18, uint32_t scale = 3)
416
417 uint32_t getPrecision() const { return precision; }
418 uint32_t getScale() const { return scale; }
419
420 bool containsAny() const override { return false; }
421
422 bool operator==(const ExtraTypeInfo& other) const override;
423
424 std::unique_ptr<ExtraTypeInfo> copy() const override;
425
426 static std::unique_ptr<ExtraTypeInfo> deserialize(Deserializer& deserializer);
427
428protected:
429 void serializeInternal(Serializer& serializer) const override;
430
431 uint32_t precision, scale;
432};
433
435public:
436 ListTypeInfo() = default;
438
439 const LogicalType& getChildType() const { return childType; }
440
441 bool containsAny() const override;
442
443 bool operator==(const ExtraTypeInfo& other) const override;
444
445 std::unique_ptr<ExtraTypeInfo> copy() const override;
446
447 static std::unique_ptr<ExtraTypeInfo> deserialize(Deserializer& deserializer);
448
449protected:
450 void serializeInternal(Serializer& serializer) const override;
451
452protected:
454};
455
456class ArrayTypeInfo final : public ListTypeInfo {
457public:
458 ArrayTypeInfo() : numElements{0} {};
459 explicit ArrayTypeInfo(LogicalType childType, uint64_t numElements)
460 : ListTypeInfo{std::move(childType)}, numElements{numElements} {}
461
462 uint64_t getNumElements() const { return numElements; }
463
464 bool operator==(const ExtraTypeInfo& other) const override;
465
466 static std::unique_ptr<ExtraTypeInfo> deserialize(Deserializer& deserializer);
467
468 std::unique_ptr<ExtraTypeInfo> copy() const override;
469
470private:
471 void serializeInternal(Serializer& serializer) const override;
472
473private:
474 uint64_t numElements;
475};
476
478public:
480 StructField(std::string name, LogicalType type)
481 : name{std::move(name)}, type{std::move(type)} {};
482
484
485 std::string getName() const { return name; }
486
487 const LogicalType& getType() const { return type; }
488
489 bool containsAny() const;
490
491 bool operator==(const StructField& other) const;
492 bool operator!=(const StructField& other) const { return !(*this == other); }
493
494 void serialize(Serializer& serializer) const;
495
496 static StructField deserialize(Deserializer& deserializer);
497
499
500private:
501 std::string name;
502 LogicalType type;
503};
504
505class StructTypeInfo final : public ExtraTypeInfo {
506public:
507 StructTypeInfo() = default;
508 explicit StructTypeInfo(std::vector<StructField>&& fields);
509 StructTypeInfo(const std::vector<std::string>& fieldNames,
510 const std::vector<LogicalType>& fieldTypes);
511
512 bool hasField(const std::string& fieldName) const;
513 struct_field_idx_t getStructFieldIdx(std::string fieldName) const;
515 const StructField& getStructField(const std::string& fieldName) const;
516 const std::vector<StructField>& getStructFields() const;
517
519 std::vector<const LogicalType*> getChildrenTypes() const;
520 // can't be a vector of refs since that can't be for-each looped through
521 std::vector<std::string> getChildrenNames() const;
522
523 bool containsAny() const override;
524
525 bool operator==(const ExtraTypeInfo& other) const override;
526
527 static std::unique_ptr<ExtraTypeInfo> deserialize(Deserializer& deserializer);
528 std::unique_ptr<ExtraTypeInfo> copy() const override;
529
530private:
531 void serializeInternal(Serializer& serializer) const override;
532
533private:
534 std::vector<StructField> fields;
535 std::unordered_map<std::string, struct_field_idx_t> fieldNameToIdxMap;
536};
537
538using logical_type_vec_t = std::vector<LogicalType>;
539
541 static uint32_t getPrecision(const LogicalType& type);
542 static uint32_t getScale(const LogicalType& type);
543 static std::string insertDecimalPoint(const std::string& value, uint32_t posFromEnd);
544};
545
547 static const LogicalType& getChildType(const LogicalType& type);
548};
549
551 static const LogicalType& getChildType(const LogicalType& type);
552 static uint64_t getNumElements(const LogicalType& type);
553};
554
556 static std::vector<const LogicalType*> getFieldTypes(const LogicalType& type);
557 // since the field types isn't stored as a vector of LogicalTypes, we can't return vector<>&
558
560
561 static const LogicalType& getFieldType(const LogicalType& type, const std::string& key);
562
563 static std::vector<std::string> getFieldNames(const LogicalType& type);
564
565 static uint64_t getNumFields(const LogicalType& type);
566
567 static const std::vector<StructField>& getFields(const LogicalType& type);
568
569 static bool hasField(const LogicalType& type, const std::string& key);
570
571 static const StructField& getField(const LogicalType& type, struct_field_idx_t idx);
572
573 static const StructField& getField(const LogicalType& type, const std::string& key);
574
575 static struct_field_idx_t getFieldIdx(const LogicalType& type, const std::string& key);
576};
577
579 static const LogicalType& getKeyType(const LogicalType& type);
580
581 static const LogicalType& getValueType(const LogicalType& type);
582};
583
585 static constexpr union_field_idx_t TAG_FIELD_IDX = 0;
586
587 static constexpr auto TAG_FIELD_TYPE = LogicalTypeID::INT8;
588
589 static constexpr char TAG_FIELD_NAME[] = "tag";
590
592
593 static std::string getFieldName(const LogicalType& type, union_field_idx_t idx);
594
595 static const LogicalType& getFieldType(const LogicalType& type, union_field_idx_t idx);
596
597 static uint64_t getNumFields(const LogicalType& type);
598};
599
601 static std::string toString(PhysicalTypeID physicalType);
602 static uint32_t getFixedTypeSize(PhysicalTypeID physicalType);
603};
604
606 static std::string toString(LogicalTypeID dataTypeID);
607 static std::string toString(const std::vector<LogicalType>& dataTypes);
608 static std::string toString(const std::vector<LogicalTypeID>& dataTypeIDs);
609 static uint32_t getRowLayoutSize(const LogicalType& logicalType);
610 static bool isDate(const LogicalType& dataType);
611 static bool isDate(const LogicalTypeID& dataType);
612 static bool isTimestamp(const LogicalType& dataType);
613 static bool isTimestamp(const LogicalTypeID& dataType);
614 static bool isUnsigned(const LogicalType& dataType);
615 static bool isUnsigned(const LogicalTypeID& dataType);
616 static bool isIntegral(const LogicalType& dataType);
617 static bool isIntegral(const LogicalTypeID& dataType);
618 static bool isNumerical(const LogicalType& dataType);
619 static bool isNumerical(const LogicalTypeID& dataType);
620 static bool isNested(const LogicalType& dataType);
621 static bool isNested(LogicalTypeID logicalTypeID);
622 static std::vector<LogicalTypeID> getAllValidComparableLogicalTypes();
623 static std::vector<LogicalTypeID> getNumericalLogicalTypeIDs();
624 static std::vector<LogicalTypeID> getIntegerTypeIDs();
625 static std::vector<LogicalTypeID> getFloatingPointTypeIDs();
626 static std::vector<LogicalTypeID> getAllValidLogicTypeIDs();
627 static std::vector<LogicalType> getAllValidLogicTypes();
628 static bool tryGetMaxLogicalType(const LogicalType& left, const LogicalType& right,
629 LogicalType& result);
630 static bool tryGetMaxLogicalType(const std::vector<LogicalType>& types, LogicalType& result);
631
632 // Differs from tryGetMaxLogicalType because it treats string as a maximal type, instead of a
633 // minimal type. as such, it will always succeed.
634 // Also combines structs by the union of their fields. As such, currently, it is not guaranteed
635 // for casting to work from input types to resulting types. Ideally this changes
636 static LogicalType combineTypes(const LogicalType& left, const LogicalType& right);
637
638 // makes a copy of the type with any occurences of ANY replaced with replacement
639 static LogicalType purgeAny(const LogicalType& type, const LogicalType& replacement);
640
641private:
642 static bool tryGetMaxLogicalTypeID(const LogicalTypeID& left, const LogicalTypeID& right,
643 LogicalTypeID& result);
644};
645
646enum class FileVersionType : uint8_t { ORIGINAL = 0, WAL_VERSION = 1 };
647
648} // namespace common
649} // namespace kuzu
#define KUZU_API
Definition api.h:25
Definition types.h:456
ArrayTypeInfo()
Definition types.h:458
uint64_t getNumElements() const
Definition types.h:462
ArrayTypeInfo(LogicalType childType, uint64_t numElements)
Definition types.h:459
static std::unique_ptr< ExtraTypeInfo > deserialize(Deserializer &deserializer)
bool operator==(const ExtraTypeInfo &other) const override
std::unique_ptr< ExtraTypeInfo > copy() const override
Definition types.h:412
uint32_t scale
Definition types.h:431
uint32_t getScale() const
Definition types.h:418
uint32_t precision
Definition types.h:431
bool containsAny() const override
Definition types.h:420
DecimalTypeInfo(uint32_t precision=18, uint32_t scale=3)
Definition types.h:414
void serializeInternal(Serializer &serializer) const override
static std::unique_ptr< ExtraTypeInfo > deserialize(Deserializer &deserializer)
uint32_t getPrecision() const
Definition types.h:417
std::unique_ptr< ExtraTypeInfo > copy() const override
bool operator==(const ExtraTypeInfo &other) const override
Definition types.h:370
virtual std::unique_ptr< ExtraTypeInfo > copy() const =0
const TARGET * constPtrCast() const
Definition types.h:383
virtual bool operator==(const ExtraTypeInfo &other) const =0
virtual ~ExtraTypeInfo()=default
virtual bool containsAny() const =0
virtual void serializeInternal(Serializer &serializer) const =0
void serialize(Serializer &serializer) const
Definition types.h:374
Definition types.h:434
const LogicalType & getChildType() const
Definition types.h:439
bool operator==(const ExtraTypeInfo &other) const override
static std::unique_ptr< ExtraTypeInfo > deserialize(Deserializer &deserializer)
void serializeInternal(Serializer &serializer) const override
bool containsAny() const override
ListTypeInfo(LogicalType childType)
Definition types.h:437
std::unique_ptr< ExtraTypeInfo > copy() const override
LogicalType childType
Definition types.h:453
Definition types.h:246
static LogicalType INT8()
Definition types.h:306
static LogicalType BOOL()
Definition types.h:301
KUZU_API std::string toString() const
friend class kuzu::processor::ParquetReader
Definition types.h:360
static LogicalType UUID()
Definition types.h:326
static LogicalType deserialize(Deserializer &deserializer)
KUZU_API LogicalType()
Definition types.h:256
static LogicalType UINT32()
Definition types.h:308
void setExtraTypeInfo(std::unique_ptr< ExtraTypeInfo > typeInfo)
Definition types.h:277
static LogicalType TIMESTAMP_SEC()
Definition types.h:317
static LogicalType INT32()
Definition types.h:304
static KUZU_API std::vector< LogicalType > copy(const std::vector< LogicalType * > &types)
static LogicalType INT128()
Definition types.h:311
static LogicalType FLOAT()
Definition types.h:313
static KUZU_API LogicalType UNION(std::vector< StructField > &&fields)
void serialize(Serializer &serializer) const
static LogicalType HASH()
Definition types.h:302
static LogicalType INT16()
Definition types.h:305
static LogicalType INTERVAL()
Definition types.h:320
static KUZU_API LogicalType LIST(LogicalType childType)
static LogicalType INT64()
Definition types.h:303
static KUZU_API LogicalType ARRAY(LogicalType childType, uint64_t numElements)
KUZU_API bool operator==(const LogicalType &other) const
static KUZU_API LogicalType DECIMAL(uint32_t precision, uint32_t scale)
static LogicalType LIST(T &&childType)
Definition types.h:340
static LogicalType INTERNAL_ID()
Definition types.h:322
static LogicalType DOUBLE()
Definition types.h:312
static LogicalType TIMESTAMP_NS()
Definition types.h:315
static LogicalType DATE()
Definition types.h:314
static KUZU_API LogicalType RECURSIVE_REL(std::unique_ptr< StructTypeInfo > typeInfo)
EXPLICIT_COPY_DEFAULT_MOVE(LogicalType)
KUZU_API LogicalTypeID getLogicalTypeID() const
Definition types.h:269
static LogicalType UINT64()
Definition types.h:307
static LogicalType STRING()
Definition types.h:324
friend struct CAPIHelper
Definition types.h:358
static LogicalType ANY()
Definition types.h:290
static LogicalType BLOB()
Definition types.h:325
static KUZU_API LogicalType STRUCT(std::vector< StructField > &&fields)
static KUZU_API LogicalType MAP(LogicalType keyType, LogicalType valueType)
static LogicalType TIMESTAMP_MS()
Definition types.h:316
static LogicalType TIMESTAMP()
Definition types.h:319
static bool isBuiltInType(const std::string &str)
friend struct JavaAPIHelper
Definition types.h:359
static LogicalType ARRAY(T &&childType, uint64_t numElements)
Definition types.h:353
KUZU_API LogicalType(LogicalTypeID typeID, TypeCategory info=TypeCategory::INTERNAL)
static LogicalType SERIAL()
Definition types.h:323
static LogicalType TIMESTAMP_TZ()
Definition types.h:318
static LogicalType MAP(T &&keyType, T &&valueType)
Definition types.h:346
const ExtraTypeInfo * getExtraTypeInfo() const
Definition types.h:281
static KUZU_API std::vector< LogicalType > copy(const std::vector< LogicalType > &types)
KUZU_API bool operator!=(const LogicalType &other) const
bool isInternalType() const
Definition types.h:271
static LogicalType convertFromString(const std::string &str, main::ClientContext *context)
static LogicalType ANY(PhysicalTypeID physicalType)
Definition types.h:295
static LogicalType POINTER()
Definition types.h:327
static LogicalType UINT16()
Definition types.h:309
static KUZU_API LogicalType REL(std::unique_ptr< StructTypeInfo > typeInfo)
KUZU_API PhysicalTypeID getPhysicalType() const
Definition types.h:273
static KUZU_API LogicalType NODE(std::unique_ptr< StructTypeInfo > typeInfo)
static LogicalType UINT8()
Definition types.h:310
static KUZU_API PhysicalTypeID getPhysicalType(LogicalTypeID logicalType, const std::unique_ptr< ExtraTypeInfo > &extraTypeInfo=nullptr)
Definition types.h:477
std::string getName() const
Definition types.h:485
StructField copy() const
DELETE_COPY_DEFAULT_MOVE(StructField)
StructField()
Definition types.h:479
const LogicalType & getType() const
Definition types.h:487
static StructField deserialize(Deserializer &deserializer)
bool operator==(const StructField &other) const
StructField(std::string name, LogicalType type)
Definition types.h:480
bool operator!=(const StructField &other) const
Definition types.h:492
void serialize(Serializer &serializer) const
Definition types.h:505
bool containsAny() const override
const StructField & getStructField(const std::string &fieldName) const
const LogicalType & getChildType(struct_field_idx_t idx) const
StructTypeInfo(std::vector< StructField > &&fields)
StructTypeInfo(const std::vector< std::string > &fieldNames, const std::vector< LogicalType > &fieldTypes)
const std::vector< StructField > & getStructFields() const
std::vector< std::string > getChildrenNames() const
const StructField & getStructField(struct_field_idx_t idx) const
struct_field_idx_t getStructFieldIdx(std::string fieldName) const
std::vector< const LogicalType * > getChildrenTypes() const
std::unique_ptr< ExtraTypeInfo > copy() const override
bool operator==(const ExtraTypeInfo &other) const override
bool hasField(const std::string &fieldName) const
static std::unique_ptr< ExtraTypeInfo > deserialize(Deserializer &deserializer)
Definition types.h:391
std::unique_ptr< ExtraTypeInfo > copy() const override
std::string getTypeName() const
Definition types.h:395
UDTTypeInfo(std::string typeName)
Definition types.h:393
bool containsAny() const override
Definition types.h:397
static std::unique_ptr< ExtraTypeInfo > deserialize(Deserializer &deserializer)
bool operator==(const ExtraTypeInfo &other) const override
Contain client side configuration. We make profiler associated per query, so profiler is not maintain...
Definition client_context.h:57
Definition types.h:144
Definition types.h:138
Definition types.h:161
Definition types.h:148
Definition types.h:165
Definition types.h:151
Definition types.h:132
Definition types.h:141
uint64_t length_t
Definition types.h:55
constexpr uint32_t UNDEFINED_CAST_COST
Definition types.h:50
constexpr page_idx_t INVALID_PAGE_IDX
Definition types.h:33
constexpr column_id_t ROW_IDX_COLUMN_ID
Definition types.h:40
page_group_idx_t frame_group_idx_t
Definition types.h:37
uint64_t cardinality_t
Definition types.h:81
uint64_t hash_t
Definition types.h:29
uint32_t idx_t
Definition types.h:41
constexpr offset_t INVALID_LIMIT
Definition types.h:82
page_idx_t frame_idx_t
Definition types.h:31
std::unordered_map< table_id_t, T > table_id_map_t
Definition types.h:71
uint64_t node_group_idx_t
Definition types.h:51
PhysicalTypeID
Definition types.h:212
FileVersionType
Definition types.h:646
constexpr struct_field_idx_t INVALID_STRUCT_FIELD_IDX
Definition types.h:47
uint32_t file_idx_t
Definition types.h:34
constexpr idx_t INVALID_IDX
Definition types.h:42
uint64_t oid_t
Definition types.h:58
uint64_t block_idx_t
Definition types.h:43
std::unordered_set< table_id_t > table_id_set_t
Definition types.h:69
constexpr node_group_idx_t INVALID_NODE_GROUP_IDX
Definition types.h:52
uint32_t page_group_idx_t
Definition types.h:36
constexpr transaction_t INVALID_TRANSACTION
Definition types.h:62
uint32_t column_id_t
Definition types.h:38
constexpr oid_t INVALID_OID
Definition types.h:59
TypeCategory
Definition types.h:244
uint32_t page_offset_t
Definition types.h:32
constexpr table_id_t INVALID_TABLE_ID
Definition types.h:72
std::unordered_map< executor_id_t, uint64_t > executor_info
Definition types.h:64
uint64_t transaction_t
Definition types.h:61
uint64_t partition_idx_t
Definition types.h:53
std::vector< LogicalType > logical_type_vec_t
Definition types.h:538
oid_t table_id_t
Definition types.h:67
constexpr file_idx_t INVALID_FILE_IDX
Definition types.h:35
struct_field_idx_t union_field_idx_t
Definition types.h:46
constexpr sel_t INVALID_SEL
Definition types.h:28
constexpr block_idx_t INVALID_BLOCK_IDX
Definition types.h:44
uint64_t executor_id_t
Definition types.h:63
constexpr offset_t INVALID_OFFSET
Definition types.h:75
constexpr partition_idx_t INVALID_PARTITION_IDX
Definition types.h:54
constexpr row_idx_t INVALID_ROW_IDX
Definition types.h:49
uint32_t page_idx_t
Definition types.h:30
uint32_t list_size_t
Definition types.h:56
constexpr column_id_t INVALID_COLUMN_ID
Definition types.h:39
uint64_t sel_t
Definition types.h:27
std::vector< table_id_t > table_id_vector_t
Definition types.h:68
uint64_t sequence_id_t
Definition types.h:57
LogicalTypeID
Definition types.h:167
uint64_t offset_t
Definition types.h:74
uint8_t struct_field_idx_t
Definition types.h:45
uint64_t row_idx_t
Definition types.h:48
TO ku_dynamic_cast(FROM *old)
Definition cast.h:11
Definition array_utils.h:7
Definition types.h:550
static uint64_t getNumElements(const LogicalType &type)
static const LogicalType & getChildType(const LogicalType &type)
Definition types.h:540
static uint32_t getPrecision(const LogicalType &type)
static uint32_t getScale(const LogicalType &type)
static std::string insertDecimalPoint(const std::string &value, uint32_t posFromEnd)
Definition types.h:546
static const LogicalType & getChildType(const LogicalType &type)
Definition types.h:605
static bool isUnsigned(const LogicalTypeID &dataType)
static bool tryGetMaxLogicalType(const LogicalType &left, const LogicalType &right, LogicalType &result)
static bool isIntegral(const LogicalTypeID &dataType)
static bool isNested(const LogicalType &dataType)
static bool isDate(const LogicalType &dataType)
static uint32_t getRowLayoutSize(const LogicalType &logicalType)
static std::vector< LogicalType > getAllValidLogicTypes()
static std::string toString(LogicalTypeID dataTypeID)
static std::vector< LogicalTypeID > getFloatingPointTypeIDs()
static bool isIntegral(const LogicalType &dataType)
static bool isDate(const LogicalTypeID &dataType)
static bool isUnsigned(const LogicalType &dataType)
static std::vector< LogicalTypeID > getNumericalLogicalTypeIDs()
static std::vector< LogicalTypeID > getAllValidComparableLogicalTypes()
static std::string toString(const std::vector< LogicalType > &dataTypes)
static bool tryGetMaxLogicalType(const std::vector< LogicalType > &types, LogicalType &result)
static bool isNested(LogicalTypeID logicalTypeID)
static bool isTimestamp(const LogicalType &dataType)
static std::vector< LogicalTypeID > getAllValidLogicTypeIDs()
static std::string toString(const std::vector< LogicalTypeID > &dataTypeIDs)
static LogicalType combineTypes(const LogicalType &left, const LogicalType &right)
static bool isTimestamp(const LogicalTypeID &dataType)
static bool isNumerical(const LogicalTypeID &dataType)
static LogicalType purgeAny(const LogicalType &type, const LogicalType &replacement)
static std::vector< LogicalTypeID > getIntegerTypeIDs()
static bool isNumerical(const LogicalType &dataType)
Definition types.h:578
static const LogicalType & getValueType(const LogicalType &type)
static const LogicalType & getKeyType(const LogicalType &type)
Definition types.h:600
static uint32_t getFixedTypeSize(PhysicalTypeID physicalType)
static std::string toString(PhysicalTypeID physicalType)
Definition types.h:555
static const StructField & getField(const LogicalType &type, const std::string &key)
static const std::vector< StructField > & getFields(const LogicalType &type)
static std::vector< const LogicalType * > getFieldTypes(const LogicalType &type)
static const LogicalType & getFieldType(const LogicalType &type, struct_field_idx_t idx)
static uint64_t getNumFields(const LogicalType &type)
static const StructField & getField(const LogicalType &type, struct_field_idx_t idx)
static struct_field_idx_t getFieldIdx(const LogicalType &type, const std::string &key)
static const LogicalType & getFieldType(const LogicalType &type, const std::string &key)
static bool hasField(const LogicalType &type, const std::string &key)
static std::vector< std::string > getFieldNames(const LogicalType &type)
Definition uuid.h:20
Definition types.h:584
static union_field_idx_t getInternalFieldIdx(union_field_idx_t idx)
static std::string getFieldName(const LogicalType &type, union_field_idx_t idx)
static const LogicalType & getFieldType(const LogicalType &type, union_field_idx_t idx)
static uint64_t getNumFields(const LogicalType &type)
Definition int128_t.h:20
Definition types.h:84
bool operator==(const internalID_t &rhs) const
internalID_t(offset_t offset, table_id_t tableID)
bool operator>(const internalID_t &rhs) const
offset_t offset
Definition types.h:85
bool operator>=(const internalID_t &rhs) const
table_id_t tableID
Definition types.h:86
bool operator!=(const internalID_t &rhs) const
bool operator<(const internalID_t &rhs) const
bool operator<=(const internalID_t &rhs) const
Definition ku_string.h:12
Definition types.h:108
offset_t offset
Definition types.h:109
list_entry_t(offset_t offset, list_size_t size)
Definition types.h:113
list_size_t size
Definition types.h:110
list_entry_t()
Definition types.h:112
Definition types.h:120
list_entry_t entry
Definition types.h:121
Definition types.h:101
uint64_t numElements
Definition types.h:104
uint8_t * value
Definition types.h:105
Definition types.h:116
int64_t pos
Definition types.h:117
Definition types.h:124
struct_entry_t entry
Definition types.h:125