5#include <unordered_map>
6#include <unordered_set>
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>;
145 std::is_same_v<T, interval_t> || std::is_same_v<T, bool>;
149 std::floating_point<T> || std::is_same_v<T, int128_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>);
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>);
162 (std::is_same_v<T, list_entry_t> || std::is_same_v<T, struct_entry_t>);
275 const std::unique_ptr<ExtraTypeInfo>& extraTypeInfo =
nullptr);
278 extraTypeInfo = std::move(typeInfo);
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);
297 ret.physicalType = physicalType;
366 std::unique_ptr<ExtraTypeInfo> extraTypeInfo;
380 virtual std::unique_ptr<ExtraTypeInfo>
copy()
const = 0;
382 template<
class TARGET>
393 explicit UDTTypeInfo(std::string typeName) : typeName{std::move(typeName)} {}
401 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
403 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
406 void serializeInternal(Serializer& serializer)
const override;
409 std::string typeName;
424 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
426 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
445 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
447 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
466 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
468 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
471 void serializeInternal(Serializer& serializer)
const override;
474 uint64_t numElements;
481 : name{std::move(name)}, type{std::move(type)} {};
510 const std::vector<LogicalType>& fieldTypes);
527 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
528 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
531 void serializeInternal(Serializer& serializer)
const override;
534 std::vector<StructField> fields;
535 std::unordered_map<std::string, struct_field_idx_t> fieldNameToIdxMap;
587 static constexpr auto TAG_FIELD_TYPE = LogicalTypeID::INT8;
589 static constexpr char TAG_FIELD_NAME[] =
"tag";
607 static std::string
toString(
const std::vector<LogicalType>& dataTypes);
608 static std::string
toString(
const std::vector<LogicalTypeID>& dataTypeIDs);
#define KUZU_API
Definition api.h:25
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
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
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
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)
std::string getName() const
Definition types.h:485
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
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)
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
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
static uint64_t getNumElements(const LogicalType &type)
static const LogicalType & getChildType(const LogicalType &type)
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)
static const LogicalType & getChildType(const LogicalType &type)
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)
static const LogicalType & getValueType(const LogicalType &type)
static const LogicalType & getKeyType(const LogicalType &type)
static uint32_t getFixedTypeSize(PhysicalTypeID physicalType)
static std::string toString(PhysicalTypeID physicalType)
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)
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)
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
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
list_entry_t entry
Definition types.h:121
uint64_t numElements
Definition types.h:104
uint8_t * value
Definition types.h:105
int64_t pos
Definition types.h:117
struct_entry_t entry
Definition types.h:125