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