5#include <unordered_map>
6#include <unordered_set>
22class NodeTableCatalogEntry;
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>;
148 std::is_same_v<T, interval_t> || std::is_same_v<T, bool>;
152 std::floating_point<T> || std::is_same_v<T, int128_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>);
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>);
165 (std::is_same_v<T, list_entry_t> || std::is_same_v<T, struct_entry_t>);
278 const std::unique_ptr<ExtraTypeInfo>& extraTypeInfo =
nullptr);
281 extraTypeInfo = std::move(typeInfo);
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);
300 ret.physicalType = physicalType;
369 std::unique_ptr<ExtraTypeInfo> extraTypeInfo;
383 virtual std::unique_ptr<ExtraTypeInfo>
copy()
const = 0;
385 template<
class TARGET>
396 explicit UDTTypeInfo(std::string typeName) : typeName{std::move(typeName)} {}
404 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
406 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
409 void serializeInternal(Serializer& serializer)
const override;
412 std::string typeName;
427 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
429 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
448 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
450 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
469 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
471 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
474 void serializeInternal(Serializer& serializer)
const override;
477 uint64_t numElements;
484 : name{std::move(name)}, type{std::move(type)} {};
513 const std::vector<LogicalType>& fieldTypes);
530 static std::unique_ptr<ExtraTypeInfo>
deserialize(Deserializer& deserializer);
531 std::unique_ptr<ExtraTypeInfo>
copy()
const override;
534 void serializeInternal(Serializer& serializer)
const override;
537 std::vector<StructField> fields;
538 std::unordered_map<std::string, struct_field_idx_t> fieldNameToIdxMap;
592 static constexpr auto TAG_FIELD_TYPE = LogicalTypeID::INT8;
594 static constexpr char TAG_FIELD_NAME[] =
"tag";
612 static std::string
toString(
const std::vector<LogicalType>& dataTypes);
613 static std::string
toString(
const std::vector<LogicalTypeID>& dataTypeIDs);
#define KUZU_API
Definition api.h:25
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
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
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
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)
std::string getName() const
Definition types.h:488
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
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: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
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
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 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)
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: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
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
list_entry_t entry
Definition types.h:124
uint64_t numElements
Definition types.h:107
uint8_t * value
Definition types.h:108
int64_t pos
Definition types.h:120
struct_entry_t entry
Definition types.h:128