5#include <unordered_map>
95 std::is_same_v<T, int8_t> || std::is_same_v<T, int16_t> || std::is_same_v<T, int32_t> ||
96 std::is_same_v<T, int64_t> || std::is_same_v<T, uint8_t> || std::is_same_v<T, uint16_t> ||
97 std::is_same_v<T, uint32_t> || std::is_same_v<T, uint64_t> || std::is_same_v<T, int128_t>;
104 std::is_same_v<T, interval_t> || std::is_same_v<T, bool>;
108 std::floating_point<T> || std::is_same_v<T, int128_t>);
110concept IndexHashable = ((std::integral<T> && !std::is_same_v<T, bool>) || std::floating_point<T> ||
111 std::is_same_v<T, int128_t> || std::is_same_v<T, ku_string_t> ||
112 std::is_same_v<T, std::string_view> || std::same_as<T, std::string>);
116 std::is_same_v<T, int128_t> || std::is_same_v<T, internalID_t> ||
117 std::is_same_v<T, interval_t> || std::is_same_v<T, ku_string_t>);
121 (std::is_same_v<T, list_entry_t> || std::is_same_v<T, struct_entry_t>);
229 const std::unique_ptr<ExtraTypeInfo>& extraTypeInfo =
nullptr);
232 extraTypeInfo = std::move(typeInfo);
239 KUZU_API static std::vector<LogicalType>
copy(
const std::vector<LogicalType>& types);
240 KUZU_API static std::vector<LogicalType>
copy(
const std::vector<LogicalType*>& types);
310 std::unique_ptr<ExtraTypeInfo> extraTypeInfo;
323 virtual std::unique_ptr<ExtraTypeInfo>
copy()
const = 0;
325 template<
class TARGET>
346 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
367 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
390 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
393 void serializeInternal(
Serializer& serializer)
const override;
396 uint64_t numElements;
403 : name{std::move(name)}, type{std::move(type)} {};
430 const std::vector<LogicalType>& fieldTypes);
448 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
451 void serializeInternal(
Serializer& serializer)
const override;
454 std::vector<StructField> fields;
455 std::unordered_map<std::string, struct_field_idx_t> fieldNameToIdxMap;
507 static constexpr auto TAG_FIELD_TYPE = LogicalTypeID::INT8;
509 static constexpr char TAG_FIELD_NAME[] =
"tag";
527 static std::string
toString(
const std::vector<LogicalType>& dataTypes);
528 static std::string
toString(
const std::vector<LogicalTypeID>& dataTypeIDs);
#define KUZU_API
Definition api.h:25
uint64_t getNumElements() const
Definition types.h:384
ArrayTypeInfo(LogicalType childType, uint64_t numElements)
Definition types.h:381
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:353
uint32_t getScale() const
Definition types.h:340
uint32_t precision
Definition types.h:353
bool containsAny() const override
Definition types.h:342
DecimalTypeInfo(uint32_t precision=18, uint32_t scale=3)
Definition types.h:336
void serializeInternal(Serializer &serializer) const override
static std::unique_ptr< ExtraTypeInfo > deserialize(Deserializer &deserializer)
uint32_t getPrecision() const
Definition types.h:339
std::unique_ptr< ExtraTypeInfo > copy() const override
bool operator==(const ExtraTypeInfo &other) const override
Definition deserializer.h:15
const LogicalType & getChildType() const
Definition types.h:361
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:359
std::unique_ptr< ExtraTypeInfo > copy() const override
LogicalType childType
Definition types.h:375
static LogicalType INT8()
Definition types.h:248
static LogicalType BOOL()
Definition types.h:243
KUZU_API std::string toString() const
friend class kuzu::processor::ParquetReader
Definition types.h:304
static LogicalType UUID()
Definition types.h:268
static LogicalType deserialize(Deserializer &deserializer)
KUZU_API LogicalType()
Definition types.h:211
static LogicalType UINT32()
Definition types.h:250
void setExtraTypeInfo(std::unique_ptr< ExtraTypeInfo > typeInfo)
Definition types.h:231
static LogicalType TIMESTAMP_SEC()
Definition types.h:259
static LogicalType INT32()
Definition types.h:246
static KUZU_API std::vector< LogicalType > copy(const std::vector< LogicalType * > &types)
static LogicalType INT128()
Definition types.h:253
static LogicalType FLOAT()
Definition types.h:255
static KUZU_API LogicalType UNION(std::vector< StructField > &&fields)
void serialize(Serializer &serializer) const
static LogicalType HASH()
Definition types.h:244
static LogicalType INT16()
Definition types.h:247
static LogicalType INTERVAL()
Definition types.h:262
static KUZU_API LogicalType LIST(LogicalType childType)
static LogicalType INT64()
Definition types.h:245
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:284
static LogicalType INTERNAL_ID()
Definition types.h:264
static LogicalType DOUBLE()
Definition types.h:254
static LogicalType fromString(const std::string &str)
static LogicalType TIMESTAMP_NS()
Definition types.h:257
static LogicalType DATE()
Definition types.h:256
static KUZU_API LogicalType RECURSIVE_REL(std::unique_ptr< StructTypeInfo > typeInfo)
EXPLICIT_COPY_DEFAULT_MOVE(LogicalType)
KUZU_API LogicalType(LogicalTypeID typeID)
KUZU_API LogicalTypeID getLogicalTypeID() const
Definition types.h:224
static LogicalType UINT64()
Definition types.h:249
static LogicalType STRING()
Definition types.h:266
friend struct CAPIHelper
Definition types.h:302
static LogicalType ANY()
Definition types.h:242
static LogicalType BLOB()
Definition types.h:267
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:258
static LogicalType TIMESTAMP()
Definition types.h:261
friend struct JavaAPIHelper
Definition types.h:303
static LogicalType ARRAY(T &&childType, uint64_t numElements)
Definition types.h:297
static LogicalType SERIAL()
Definition types.h:265
static bool tryConvertFromString(const std::string &str, LogicalType &type)
static LogicalType TIMESTAMP_TZ()
Definition types.h:260
static LogicalType MAP(T &&keyType, T &&valueType)
Definition types.h:290
static KUZU_API std::vector< LogicalType > copy(const std::vector< LogicalType > &types)
KUZU_API bool operator!=(const LogicalType &other) const
static LogicalType POINTER()
Definition types.h:269
static LogicalType UINT16()
Definition types.h:251
static KUZU_API LogicalType REL(std::unique_ptr< StructTypeInfo > typeInfo)
KUZU_API PhysicalTypeID getPhysicalType() const
Definition types.h:227
static KUZU_API LogicalType NODE(std::unique_ptr< StructTypeInfo > typeInfo)
static KUZU_API LogicalType RDF_VARIANT()
static LogicalType UINT8()
Definition types.h:252
static KUZU_API PhysicalTypeID getPhysicalType(LogicalTypeID logicalType, const std::unique_ptr< ExtraTypeInfo > &extraTypeInfo=nullptr)
Definition serializer.h:15
std::string getName() const
Definition types.h:405
StructField()
Definition types.h:401
const LogicalType & getType() const
Definition types.h:407
static StructField deserialize(Deserializer &deserializer)
bool operator==(const StructField &other) const
StructField(std::string name, LogicalType type)
Definition types.h:402
bool operator!=(const StructField &other) const
Definition types.h:412
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)
uint64_t length_t
Definition types.h:53
constexpr uint32_t UNDEFINED_CAST_COST
Definition types.h:48
constexpr page_idx_t INVALID_PAGE_IDX
Definition types.h:29
constexpr column_id_t ROW_IDX_COLUMN_ID
Definition types.h:38
page_group_idx_t frame_group_idx_t
Definition types.h:33
uint64_t hash_t
Definition types.h:25
uint32_t idx_t
Definition types.h:39
page_idx_t frame_idx_t
Definition types.h:27
uint64_t node_group_idx_t
Definition types.h:49
PhysicalTypeID
Definition types.h:171
FileVersionType
Definition types.h:556
constexpr struct_field_idx_t INVALID_STRUCT_FIELD_IDX
Definition types.h:45
uint32_t file_idx_t
Definition types.h:30
constexpr idx_t INVALID_IDX
Definition types.h:40
property_id_t column_id_t
Definition types.h:36
constexpr property_id_t INVALID_PROPERTY_ID
Definition types.h:35
uint64_t block_idx_t
Definition types.h:41
constexpr node_group_idx_t INVALID_NODE_GROUP_IDX
Definition types.h:50
uint32_t page_group_idx_t
Definition types.h:32
constexpr transaction_t INVALID_TRANSACTION
Definition types.h:58
uint32_t page_offset_t
Definition types.h:28
uint32_t property_id_t
Definition types.h:34
std::unordered_map< executor_id_t, uint64_t > executor_info
Definition types.h:60
uint64_t transaction_t
Definition types.h:57
uint64_t partition_idx_t
Definition types.h:51
std::vector< LogicalType > logical_type_vec_t
Definition types.h:458
constexpr file_idx_t INVALID_FILE_IDX
Definition types.h:31
struct_field_idx_t union_field_idx_t
Definition types.h:44
constexpr block_idx_t INVALID_BLOCK_IDX
Definition types.h:42
uint64_t executor_id_t
Definition types.h:59
constexpr offset_t INVALID_OFFSET
Definition internal_id_t.h:23
constexpr partition_idx_t INVALID_PARTITION_IDX
Definition types.h:52
constexpr row_idx_t INVALID_ROW_IDX
Definition types.h:47
uint32_t page_idx_t
Definition types.h:26
uint32_t list_size_t
Definition types.h:54
constexpr column_id_t INVALID_COLUMN_ID
Definition types.h:37
uint64_t sel_t
Definition types.h:24
uint64_t sequence_id_t
Definition types.h:55
TO ku_dynamic_cast(FROM old)
Definition cast.h:11
LogicalTypeID
Definition types.h:126
uint64_t offset_t
Definition internal_id_t.h:22
uint8_t struct_field_idx_t
Definition types.h:43
uint64_t row_idx_t
Definition types.h:46
Definition alter_type.h:5
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 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 bool isTimestamp(const LogicalTypeID &dataType)
static bool isNumerical(const LogicalTypeID &dataType)
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)
Definition ku_string.h:12
offset_t offset
Definition types.h:71
list_entry_t(offset_t offset, list_size_t size)
Definition types.h:75
list_size_t size
Definition types.h:72
list_entry_t()
Definition types.h:74
list_entry_t entry
Definition types.h:83
uint64_t numElements
Definition types.h:66
uint8_t * value
Definition types.h:67
int64_t pos
Definition types.h:79
struct_entry_t entry
Definition types.h:87