From 35f22dfd4c4d99656b5b3ccecdb9828e473716ec Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Mon, 23 Sep 2024 16:27:46 +0200 Subject: [PATCH 01/19] Rework enum util --- scripts/generate_enum_util.py | 31 +- src/common/enum_util.cpp | 9373 ++++++--------------- src/common/string_util.cpp | 18 + src/include/duckdb/common/string_util.hpp | 8 + 4 files changed, 2554 insertions(+), 6876 deletions(-) diff --git a/scripts/generate_enum_util.py b/scripts/generate_enum_util.py index 4c4bdf3b84c2..eba300012d6f 100644 --- a/scripts/generate_enum_util.py +++ b/scripts/generate_enum_util.py @@ -186,27 +186,26 @@ def remove_prefix(str, prefix): f.write("namespace duckdb {\n\n") for enum_name, enum_type, enum_members in enums: + enum_string_array = "Get" + enum_name + "Values()" + enum_count = str(len(enum_members)) # Write the enum from string + f.write(f"const StringUtil::EnumStringLiteral *{enum_string_array} {{\n") + f.write(f"\tstatic constexpr StringUtil::EnumStringLiteral values[] {{\n") + for count, (key, strings) in enumerate(enum_members): + if count > 0: + f.write(",\n") + f.write(f"\t\t{{ static_cast({enum_name}::{key}), \"{strings[0]}\" }}") + f.write("\n\t};"); + f.write("\n\treturn values;") + f.write("\n}\n\n") f.write(f"template<>\nconst char* EnumUtil::ToChars<{enum_name}>({enum_name} value) {{\n") - f.write("\tswitch(value) {\n") - for key, strings in enum_members: - # Always use the first string as the enum string - f.write(f"\tcase {enum_name}::{key}:\n\t\treturn \"{strings[0]}\";\n") - f.write( - f"\tdefault:\n\t\tthrow NotImplementedException(StringUtil::Format(\"Enum value: \'%d\' not implemented in ToChars<{enum_name}>\", value));\n" - ) - f.write("\t}\n") + f.write(f"\treturn StringUtil::EnumToString({enum_string_array}, {enum_count}, static_cast(value));\n"); f.write("}\n\n") # Write the string to enum f.write(f"template<>\n{enum_name} EnumUtil::FromString<{enum_name}>(const char *value) {{\n") - for key, strings in enum_members: - cond = " || ".join([f'StringUtil::Equals(value, "{string}")' for string in strings]) - f.write(f'\tif ({cond}) {{\n\t\treturn {enum_name}::{key};\n\t}}\n') - f.write( - f"\tthrow NotImplementedException(StringUtil::Format(\"Enum value: \'%s\' not implemented in FromString<{enum_name}>\", value));\n" - ) - - f.write("}\n\n") + enum_count = str(len(enum_members)) + f.write(f"\treturn static_cast<{enum_name}>(StringUtil::StringToEnum({enum_string_array}, {enum_count}, value));") + f.write("\n}\n\n") f.write("}\n\n") diff --git a/src/common/enum_util.cpp b/src/common/enum_util.cpp index 499801eb8edb..bc2cf5fba5b2 100644 --- a/src/common/enum_util.cpp +++ b/src/common/enum_util.cpp @@ -143,8168 +143,3821 @@ namespace duckdb { +const StringUtil::EnumStringLiteral *GetAccessModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AccessMode::UNDEFINED), "UNDEFINED" }, + { static_cast(AccessMode::AUTOMATIC), "AUTOMATIC" }, + { static_cast(AccessMode::READ_ONLY), "READ_ONLY" }, + { static_cast(AccessMode::READ_WRITE), "READ_WRITE" } + }; + return values; +} + template<> const char* EnumUtil::ToChars(AccessMode value) { - switch(value) { - case AccessMode::UNDEFINED: - return "UNDEFINED"; - case AccessMode::AUTOMATIC: - return "AUTOMATIC"; - case AccessMode::READ_ONLY: - return "READ_ONLY"; - case AccessMode::READ_WRITE: - return "READ_WRITE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAccessModeValues(), 4, static_cast(value)); } template<> AccessMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "UNDEFINED")) { - return AccessMode::UNDEFINED; - } - if (StringUtil::Equals(value, "AUTOMATIC")) { - return AccessMode::AUTOMATIC; - } - if (StringUtil::Equals(value, "READ_ONLY")) { - return AccessMode::READ_ONLY; - } - if (StringUtil::Equals(value, "READ_WRITE")) { - return AccessMode::READ_WRITE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAccessModeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetAggregateCombineTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AggregateCombineType::PRESERVE_INPUT), "PRESERVE_INPUT" }, + { static_cast(AggregateCombineType::ALLOW_DESTRUCTIVE), "ALLOW_DESTRUCTIVE" } + }; + return values; } template<> const char* EnumUtil::ToChars(AggregateCombineType value) { - switch(value) { - case AggregateCombineType::PRESERVE_INPUT: - return "PRESERVE_INPUT"; - case AggregateCombineType::ALLOW_DESTRUCTIVE: - return "ALLOW_DESTRUCTIVE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAggregateCombineTypeValues(), 2, static_cast(value)); } template<> AggregateCombineType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "PRESERVE_INPUT")) { - return AggregateCombineType::PRESERVE_INPUT; - } - if (StringUtil::Equals(value, "ALLOW_DESTRUCTIVE")) { - return AggregateCombineType::ALLOW_DESTRUCTIVE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAggregateCombineTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAggregateHandlingValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AggregateHandling::STANDARD_HANDLING), "STANDARD_HANDLING" }, + { static_cast(AggregateHandling::NO_AGGREGATES_ALLOWED), "NO_AGGREGATES_ALLOWED" }, + { static_cast(AggregateHandling::FORCE_AGGREGATES), "FORCE_AGGREGATES" } + }; + return values; } template<> const char* EnumUtil::ToChars(AggregateHandling value) { - switch(value) { - case AggregateHandling::STANDARD_HANDLING: - return "STANDARD_HANDLING"; - case AggregateHandling::NO_AGGREGATES_ALLOWED: - return "NO_AGGREGATES_ALLOWED"; - case AggregateHandling::FORCE_AGGREGATES: - return "FORCE_AGGREGATES"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAggregateHandlingValues(), 3, static_cast(value)); } template<> AggregateHandling EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STANDARD_HANDLING")) { - return AggregateHandling::STANDARD_HANDLING; - } - if (StringUtil::Equals(value, "NO_AGGREGATES_ALLOWED")) { - return AggregateHandling::NO_AGGREGATES_ALLOWED; - } - if (StringUtil::Equals(value, "FORCE_AGGREGATES")) { - return AggregateHandling::FORCE_AGGREGATES; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAggregateHandlingValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetAggregateOrderDependentValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AggregateOrderDependent::ORDER_DEPENDENT), "ORDER_DEPENDENT" }, + { static_cast(AggregateOrderDependent::NOT_ORDER_DEPENDENT), "NOT_ORDER_DEPENDENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(AggregateOrderDependent value) { - switch(value) { - case AggregateOrderDependent::ORDER_DEPENDENT: - return "ORDER_DEPENDENT"; - case AggregateOrderDependent::NOT_ORDER_DEPENDENT: - return "NOT_ORDER_DEPENDENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAggregateOrderDependentValues(), 2, static_cast(value)); } template<> AggregateOrderDependent EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ORDER_DEPENDENT")) { - return AggregateOrderDependent::ORDER_DEPENDENT; - } - if (StringUtil::Equals(value, "NOT_ORDER_DEPENDENT")) { - return AggregateOrderDependent::NOT_ORDER_DEPENDENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAggregateOrderDependentValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAggregateTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AggregateType::NON_DISTINCT), "NON_DISTINCT" }, + { static_cast(AggregateType::DISTINCT), "DISTINCT" } + }; + return values; } template<> const char* EnumUtil::ToChars(AggregateType value) { - switch(value) { - case AggregateType::NON_DISTINCT: - return "NON_DISTINCT"; - case AggregateType::DISTINCT: - return "DISTINCT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAggregateTypeValues(), 2, static_cast(value)); } template<> AggregateType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NON_DISTINCT")) { - return AggregateType::NON_DISTINCT; - } - if (StringUtil::Equals(value, "DISTINCT")) { - return AggregateType::DISTINCT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAggregateTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAlterForeignKeyTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AlterForeignKeyType::AFT_ADD), "AFT_ADD" }, + { static_cast(AlterForeignKeyType::AFT_DELETE), "AFT_DELETE" } + }; + return values; } template<> const char* EnumUtil::ToChars(AlterForeignKeyType value) { - switch(value) { - case AlterForeignKeyType::AFT_ADD: - return "AFT_ADD"; - case AlterForeignKeyType::AFT_DELETE: - return "AFT_DELETE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAlterForeignKeyTypeValues(), 2, static_cast(value)); } template<> AlterForeignKeyType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "AFT_ADD")) { - return AlterForeignKeyType::AFT_ADD; - } - if (StringUtil::Equals(value, "AFT_DELETE")) { - return AlterForeignKeyType::AFT_DELETE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAlterForeignKeyTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAlterScalarFunctionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AlterScalarFunctionType::INVALID), "INVALID" }, + { static_cast(AlterScalarFunctionType::ADD_FUNCTION_OVERLOADS), "ADD_FUNCTION_OVERLOADS" } + }; + return values; } template<> const char* EnumUtil::ToChars(AlterScalarFunctionType value) { - switch(value) { - case AlterScalarFunctionType::INVALID: - return "INVALID"; - case AlterScalarFunctionType::ADD_FUNCTION_OVERLOADS: - return "ADD_FUNCTION_OVERLOADS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAlterScalarFunctionTypeValues(), 2, static_cast(value)); } template<> AlterScalarFunctionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return AlterScalarFunctionType::INVALID; - } - if (StringUtil::Equals(value, "ADD_FUNCTION_OVERLOADS")) { - return AlterScalarFunctionType::ADD_FUNCTION_OVERLOADS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAlterScalarFunctionTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAlterTableFunctionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AlterTableFunctionType::INVALID), "INVALID" }, + { static_cast(AlterTableFunctionType::ADD_FUNCTION_OVERLOADS), "ADD_FUNCTION_OVERLOADS" } + }; + return values; } template<> const char* EnumUtil::ToChars(AlterTableFunctionType value) { - switch(value) { - case AlterTableFunctionType::INVALID: - return "INVALID"; - case AlterTableFunctionType::ADD_FUNCTION_OVERLOADS: - return "ADD_FUNCTION_OVERLOADS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAlterTableFunctionTypeValues(), 2, static_cast(value)); } template<> AlterTableFunctionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return AlterTableFunctionType::INVALID; - } - if (StringUtil::Equals(value, "ADD_FUNCTION_OVERLOADS")) { - return AlterTableFunctionType::ADD_FUNCTION_OVERLOADS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAlterTableFunctionTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAlterTableTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AlterTableType::INVALID), "INVALID" }, + { static_cast(AlterTableType::RENAME_COLUMN), "RENAME_COLUMN" }, + { static_cast(AlterTableType::RENAME_TABLE), "RENAME_TABLE" }, + { static_cast(AlterTableType::ADD_COLUMN), "ADD_COLUMN" }, + { static_cast(AlterTableType::REMOVE_COLUMN), "REMOVE_COLUMN" }, + { static_cast(AlterTableType::ALTER_COLUMN_TYPE), "ALTER_COLUMN_TYPE" }, + { static_cast(AlterTableType::SET_DEFAULT), "SET_DEFAULT" }, + { static_cast(AlterTableType::FOREIGN_KEY_CONSTRAINT), "FOREIGN_KEY_CONSTRAINT" }, + { static_cast(AlterTableType::SET_NOT_NULL), "SET_NOT_NULL" }, + { static_cast(AlterTableType::DROP_NOT_NULL), "DROP_NOT_NULL" }, + { static_cast(AlterTableType::SET_COLUMN_COMMENT), "SET_COLUMN_COMMENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(AlterTableType value) { - switch(value) { - case AlterTableType::INVALID: - return "INVALID"; - case AlterTableType::RENAME_COLUMN: - return "RENAME_COLUMN"; - case AlterTableType::RENAME_TABLE: - return "RENAME_TABLE"; - case AlterTableType::ADD_COLUMN: - return "ADD_COLUMN"; - case AlterTableType::REMOVE_COLUMN: - return "REMOVE_COLUMN"; - case AlterTableType::ALTER_COLUMN_TYPE: - return "ALTER_COLUMN_TYPE"; - case AlterTableType::SET_DEFAULT: - return "SET_DEFAULT"; - case AlterTableType::FOREIGN_KEY_CONSTRAINT: - return "FOREIGN_KEY_CONSTRAINT"; - case AlterTableType::SET_NOT_NULL: - return "SET_NOT_NULL"; - case AlterTableType::DROP_NOT_NULL: - return "DROP_NOT_NULL"; - case AlterTableType::SET_COLUMN_COMMENT: - return "SET_COLUMN_COMMENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAlterTableTypeValues(), 11, static_cast(value)); } template<> AlterTableType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return AlterTableType::INVALID; - } - if (StringUtil::Equals(value, "RENAME_COLUMN")) { - return AlterTableType::RENAME_COLUMN; - } - if (StringUtil::Equals(value, "RENAME_TABLE")) { - return AlterTableType::RENAME_TABLE; - } - if (StringUtil::Equals(value, "ADD_COLUMN")) { - return AlterTableType::ADD_COLUMN; - } - if (StringUtil::Equals(value, "REMOVE_COLUMN")) { - return AlterTableType::REMOVE_COLUMN; - } - if (StringUtil::Equals(value, "ALTER_COLUMN_TYPE")) { - return AlterTableType::ALTER_COLUMN_TYPE; - } - if (StringUtil::Equals(value, "SET_DEFAULT")) { - return AlterTableType::SET_DEFAULT; - } - if (StringUtil::Equals(value, "FOREIGN_KEY_CONSTRAINT")) { - return AlterTableType::FOREIGN_KEY_CONSTRAINT; - } - if (StringUtil::Equals(value, "SET_NOT_NULL")) { - return AlterTableType::SET_NOT_NULL; - } - if (StringUtil::Equals(value, "DROP_NOT_NULL")) { - return AlterTableType::DROP_NOT_NULL; - } - if (StringUtil::Equals(value, "SET_COLUMN_COMMENT")) { - return AlterTableType::SET_COLUMN_COMMENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAlterTableTypeValues(), 11, value)); +} + +const StringUtil::EnumStringLiteral *GetAlterTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AlterType::INVALID), "INVALID" }, + { static_cast(AlterType::ALTER_TABLE), "ALTER_TABLE" }, + { static_cast(AlterType::ALTER_VIEW), "ALTER_VIEW" }, + { static_cast(AlterType::ALTER_SEQUENCE), "ALTER_SEQUENCE" }, + { static_cast(AlterType::CHANGE_OWNERSHIP), "CHANGE_OWNERSHIP" }, + { static_cast(AlterType::ALTER_SCALAR_FUNCTION), "ALTER_SCALAR_FUNCTION" }, + { static_cast(AlterType::ALTER_TABLE_FUNCTION), "ALTER_TABLE_FUNCTION" }, + { static_cast(AlterType::SET_COMMENT), "SET_COMMENT" }, + { static_cast(AlterType::SET_COLUMN_COMMENT), "SET_COLUMN_COMMENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(AlterType value) { - switch(value) { - case AlterType::INVALID: - return "INVALID"; - case AlterType::ALTER_TABLE: - return "ALTER_TABLE"; - case AlterType::ALTER_VIEW: - return "ALTER_VIEW"; - case AlterType::ALTER_SEQUENCE: - return "ALTER_SEQUENCE"; - case AlterType::CHANGE_OWNERSHIP: - return "CHANGE_OWNERSHIP"; - case AlterType::ALTER_SCALAR_FUNCTION: - return "ALTER_SCALAR_FUNCTION"; - case AlterType::ALTER_TABLE_FUNCTION: - return "ALTER_TABLE_FUNCTION"; - case AlterType::SET_COMMENT: - return "SET_COMMENT"; - case AlterType::SET_COLUMN_COMMENT: - return "SET_COLUMN_COMMENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAlterTypeValues(), 9, static_cast(value)); } template<> AlterType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return AlterType::INVALID; - } - if (StringUtil::Equals(value, "ALTER_TABLE")) { - return AlterType::ALTER_TABLE; - } - if (StringUtil::Equals(value, "ALTER_VIEW")) { - return AlterType::ALTER_VIEW; - } - if (StringUtil::Equals(value, "ALTER_SEQUENCE")) { - return AlterType::ALTER_SEQUENCE; - } - if (StringUtil::Equals(value, "CHANGE_OWNERSHIP")) { - return AlterType::CHANGE_OWNERSHIP; - } - if (StringUtil::Equals(value, "ALTER_SCALAR_FUNCTION")) { - return AlterType::ALTER_SCALAR_FUNCTION; - } - if (StringUtil::Equals(value, "ALTER_TABLE_FUNCTION")) { - return AlterType::ALTER_TABLE_FUNCTION; - } - if (StringUtil::Equals(value, "SET_COMMENT")) { - return AlterType::SET_COMMENT; - } - if (StringUtil::Equals(value, "SET_COLUMN_COMMENT")) { - return AlterType::SET_COLUMN_COMMENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAlterTypeValues(), 9, value)); +} + +const StringUtil::EnumStringLiteral *GetAlterViewTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AlterViewType::INVALID), "INVALID" }, + { static_cast(AlterViewType::RENAME_VIEW), "RENAME_VIEW" } + }; + return values; } template<> const char* EnumUtil::ToChars(AlterViewType value) { - switch(value) { - case AlterViewType::INVALID: - return "INVALID"; - case AlterViewType::RENAME_VIEW: - return "RENAME_VIEW"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAlterViewTypeValues(), 2, static_cast(value)); } template<> AlterViewType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return AlterViewType::INVALID; - } - if (StringUtil::Equals(value, "RENAME_VIEW")) { - return AlterViewType::RENAME_VIEW; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAlterViewTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetAppenderTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AppenderType::LOGICAL), "LOGICAL" }, + { static_cast(AppenderType::PHYSICAL), "PHYSICAL" } + }; + return values; } template<> const char* EnumUtil::ToChars(AppenderType value) { - switch(value) { - case AppenderType::LOGICAL: - return "LOGICAL"; - case AppenderType::PHYSICAL: - return "PHYSICAL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetAppenderTypeValues(), 2, static_cast(value)); } template<> AppenderType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LOGICAL")) { - return AppenderType::LOGICAL; - } - if (StringUtil::Equals(value, "PHYSICAL")) { - return AppenderType::PHYSICAL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetAppenderTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetArrowDateTimeTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ArrowDateTimeType::MILLISECONDS), "MILLISECONDS" }, + { static_cast(ArrowDateTimeType::MICROSECONDS), "MICROSECONDS" }, + { static_cast(ArrowDateTimeType::NANOSECONDS), "NANOSECONDS" }, + { static_cast(ArrowDateTimeType::SECONDS), "SECONDS" }, + { static_cast(ArrowDateTimeType::DAYS), "DAYS" }, + { static_cast(ArrowDateTimeType::MONTHS), "MONTHS" }, + { static_cast(ArrowDateTimeType::MONTH_DAY_NANO), "MONTH_DAY_NANO" } + }; + return values; } template<> const char* EnumUtil::ToChars(ArrowDateTimeType value) { - switch(value) { - case ArrowDateTimeType::MILLISECONDS: - return "MILLISECONDS"; - case ArrowDateTimeType::MICROSECONDS: - return "MICROSECONDS"; - case ArrowDateTimeType::NANOSECONDS: - return "NANOSECONDS"; - case ArrowDateTimeType::SECONDS: - return "SECONDS"; - case ArrowDateTimeType::DAYS: - return "DAYS"; - case ArrowDateTimeType::MONTHS: - return "MONTHS"; - case ArrowDateTimeType::MONTH_DAY_NANO: - return "MONTH_DAY_NANO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetArrowDateTimeTypeValues(), 7, static_cast(value)); } template<> ArrowDateTimeType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "MILLISECONDS")) { - return ArrowDateTimeType::MILLISECONDS; - } - if (StringUtil::Equals(value, "MICROSECONDS")) { - return ArrowDateTimeType::MICROSECONDS; - } - if (StringUtil::Equals(value, "NANOSECONDS")) { - return ArrowDateTimeType::NANOSECONDS; - } - if (StringUtil::Equals(value, "SECONDS")) { - return ArrowDateTimeType::SECONDS; - } - if (StringUtil::Equals(value, "DAYS")) { - return ArrowDateTimeType::DAYS; - } - if (StringUtil::Equals(value, "MONTHS")) { - return ArrowDateTimeType::MONTHS; - } - if (StringUtil::Equals(value, "MONTH_DAY_NANO")) { - return ArrowDateTimeType::MONTH_DAY_NANO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetArrowDateTimeTypeValues(), 7, value)); +} + +const StringUtil::EnumStringLiteral *GetArrowOffsetSizeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ArrowOffsetSize::REGULAR), "REGULAR" }, + { static_cast(ArrowOffsetSize::LARGE), "LARGE" } + }; + return values; } template<> const char* EnumUtil::ToChars(ArrowOffsetSize value) { - switch(value) { - case ArrowOffsetSize::REGULAR: - return "REGULAR"; - case ArrowOffsetSize::LARGE: - return "LARGE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetArrowOffsetSizeValues(), 2, static_cast(value)); } template<> ArrowOffsetSize EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "REGULAR")) { - return ArrowOffsetSize::REGULAR; - } - if (StringUtil::Equals(value, "LARGE")) { - return ArrowOffsetSize::LARGE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetArrowOffsetSizeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetArrowTypeInfoTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ArrowTypeInfoType::LIST), "LIST" }, + { static_cast(ArrowTypeInfoType::STRUCT), "STRUCT" }, + { static_cast(ArrowTypeInfoType::DATE_TIME), "DATE_TIME" }, + { static_cast(ArrowTypeInfoType::STRING), "STRING" }, + { static_cast(ArrowTypeInfoType::ARRAY), "ARRAY" } + }; + return values; } template<> const char* EnumUtil::ToChars(ArrowTypeInfoType value) { - switch(value) { - case ArrowTypeInfoType::LIST: - return "LIST"; - case ArrowTypeInfoType::STRUCT: - return "STRUCT"; - case ArrowTypeInfoType::DATE_TIME: - return "DATE_TIME"; - case ArrowTypeInfoType::STRING: - return "STRING"; - case ArrowTypeInfoType::ARRAY: - return "ARRAY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetArrowTypeInfoTypeValues(), 5, static_cast(value)); } template<> ArrowTypeInfoType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LIST")) { - return ArrowTypeInfoType::LIST; - } - if (StringUtil::Equals(value, "STRUCT")) { - return ArrowTypeInfoType::STRUCT; - } - if (StringUtil::Equals(value, "DATE_TIME")) { - return ArrowTypeInfoType::DATE_TIME; - } - if (StringUtil::Equals(value, "STRING")) { - return ArrowTypeInfoType::STRING; - } - if (StringUtil::Equals(value, "ARRAY")) { - return ArrowTypeInfoType::ARRAY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetArrowTypeInfoTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetArrowVariableSizeTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ArrowVariableSizeType::NORMAL), "NORMAL" }, + { static_cast(ArrowVariableSizeType::FIXED_SIZE), "FIXED_SIZE" }, + { static_cast(ArrowVariableSizeType::SUPER_SIZE), "SUPER_SIZE" }, + { static_cast(ArrowVariableSizeType::VIEW), "VIEW" } + }; + return values; } template<> const char* EnumUtil::ToChars(ArrowVariableSizeType value) { - switch(value) { - case ArrowVariableSizeType::NORMAL: - return "NORMAL"; - case ArrowVariableSizeType::FIXED_SIZE: - return "FIXED_SIZE"; - case ArrowVariableSizeType::SUPER_SIZE: - return "SUPER_SIZE"; - case ArrowVariableSizeType::VIEW: - return "VIEW"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetArrowVariableSizeTypeValues(), 4, static_cast(value)); } template<> ArrowVariableSizeType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NORMAL")) { - return ArrowVariableSizeType::NORMAL; - } - if (StringUtil::Equals(value, "FIXED_SIZE")) { - return ArrowVariableSizeType::FIXED_SIZE; - } - if (StringUtil::Equals(value, "SUPER_SIZE")) { - return ArrowVariableSizeType::SUPER_SIZE; - } - if (StringUtil::Equals(value, "VIEW")) { - return ArrowVariableSizeType::VIEW; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetArrowVariableSizeTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetBinderTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(BinderType::REGULAR_BINDER), "REGULAR_BINDER" }, + { static_cast(BinderType::VIEW_BINDER), "VIEW_BINDER" } + }; + return values; } template<> const char* EnumUtil::ToChars(BinderType value) { - switch(value) { - case BinderType::REGULAR_BINDER: - return "REGULAR_BINDER"; - case BinderType::VIEW_BINDER: - return "VIEW_BINDER"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetBinderTypeValues(), 2, static_cast(value)); } template<> BinderType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "REGULAR_BINDER")) { - return BinderType::REGULAR_BINDER; - } - if (StringUtil::Equals(value, "VIEW_BINDER")) { - return BinderType::VIEW_BINDER; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetBinderTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetBindingModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(BindingMode::STANDARD_BINDING), "STANDARD_BINDING" }, + { static_cast(BindingMode::EXTRACT_NAMES), "EXTRACT_NAMES" }, + { static_cast(BindingMode::EXTRACT_REPLACEMENT_SCANS), "EXTRACT_REPLACEMENT_SCANS" } + }; + return values; } template<> const char* EnumUtil::ToChars(BindingMode value) { - switch(value) { - case BindingMode::STANDARD_BINDING: - return "STANDARD_BINDING"; - case BindingMode::EXTRACT_NAMES: - return "EXTRACT_NAMES"; - case BindingMode::EXTRACT_REPLACEMENT_SCANS: - return "EXTRACT_REPLACEMENT_SCANS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetBindingModeValues(), 3, static_cast(value)); } template<> BindingMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STANDARD_BINDING")) { - return BindingMode::STANDARD_BINDING; - } - if (StringUtil::Equals(value, "EXTRACT_NAMES")) { - return BindingMode::EXTRACT_NAMES; - } - if (StringUtil::Equals(value, "EXTRACT_REPLACEMENT_SCANS")) { - return BindingMode::EXTRACT_REPLACEMENT_SCANS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetBindingModeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetBitpackingModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(BitpackingMode::INVALID), "INVALID" }, + { static_cast(BitpackingMode::AUTO), "AUTO" }, + { static_cast(BitpackingMode::CONSTANT), "CONSTANT" }, + { static_cast(BitpackingMode::CONSTANT_DELTA), "CONSTANT_DELTA" }, + { static_cast(BitpackingMode::DELTA_FOR), "DELTA_FOR" }, + { static_cast(BitpackingMode::FOR), "FOR" } + }; + return values; } template<> const char* EnumUtil::ToChars(BitpackingMode value) { - switch(value) { - case BitpackingMode::INVALID: - return "INVALID"; - case BitpackingMode::AUTO: - return "AUTO"; - case BitpackingMode::CONSTANT: - return "CONSTANT"; - case BitpackingMode::CONSTANT_DELTA: - return "CONSTANT_DELTA"; - case BitpackingMode::DELTA_FOR: - return "DELTA_FOR"; - case BitpackingMode::FOR: - return "FOR"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetBitpackingModeValues(), 6, static_cast(value)); } template<> BitpackingMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return BitpackingMode::INVALID; - } - if (StringUtil::Equals(value, "AUTO")) { - return BitpackingMode::AUTO; - } - if (StringUtil::Equals(value, "CONSTANT")) { - return BitpackingMode::CONSTANT; - } - if (StringUtil::Equals(value, "CONSTANT_DELTA")) { - return BitpackingMode::CONSTANT_DELTA; - } - if (StringUtil::Equals(value, "DELTA_FOR")) { - return BitpackingMode::DELTA_FOR; - } - if (StringUtil::Equals(value, "FOR")) { - return BitpackingMode::FOR; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetBitpackingModeValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetBlockStateValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(BlockState::BLOCK_UNLOADED), "BLOCK_UNLOADED" }, + { static_cast(BlockState::BLOCK_LOADED), "BLOCK_LOADED" } + }; + return values; } template<> const char* EnumUtil::ToChars(BlockState value) { - switch(value) { - case BlockState::BLOCK_UNLOADED: - return "BLOCK_UNLOADED"; - case BlockState::BLOCK_LOADED: - return "BLOCK_LOADED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetBlockStateValues(), 2, static_cast(value)); } template<> BlockState EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BLOCK_UNLOADED")) { - return BlockState::BLOCK_UNLOADED; - } - if (StringUtil::Equals(value, "BLOCK_LOADED")) { - return BlockState::BLOCK_LOADED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetBlockStateValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetCAPIResultSetTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CAPIResultSetType::CAPI_RESULT_TYPE_NONE), "CAPI_RESULT_TYPE_NONE" }, + { static_cast(CAPIResultSetType::CAPI_RESULT_TYPE_MATERIALIZED), "CAPI_RESULT_TYPE_MATERIALIZED" }, + { static_cast(CAPIResultSetType::CAPI_RESULT_TYPE_STREAMING), "CAPI_RESULT_TYPE_STREAMING" }, + { static_cast(CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED), "CAPI_RESULT_TYPE_DEPRECATED" } + }; + return values; } template<> const char* EnumUtil::ToChars(CAPIResultSetType value) { - switch(value) { - case CAPIResultSetType::CAPI_RESULT_TYPE_NONE: - return "CAPI_RESULT_TYPE_NONE"; - case CAPIResultSetType::CAPI_RESULT_TYPE_MATERIALIZED: - return "CAPI_RESULT_TYPE_MATERIALIZED"; - case CAPIResultSetType::CAPI_RESULT_TYPE_STREAMING: - return "CAPI_RESULT_TYPE_STREAMING"; - case CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED: - return "CAPI_RESULT_TYPE_DEPRECATED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCAPIResultSetTypeValues(), 4, static_cast(value)); } template<> CAPIResultSetType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CAPI_RESULT_TYPE_NONE")) { - return CAPIResultSetType::CAPI_RESULT_TYPE_NONE; - } - if (StringUtil::Equals(value, "CAPI_RESULT_TYPE_MATERIALIZED")) { - return CAPIResultSetType::CAPI_RESULT_TYPE_MATERIALIZED; - } - if (StringUtil::Equals(value, "CAPI_RESULT_TYPE_STREAMING")) { - return CAPIResultSetType::CAPI_RESULT_TYPE_STREAMING; - } - if (StringUtil::Equals(value, "CAPI_RESULT_TYPE_DEPRECATED")) { - return CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCAPIResultSetTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetCSVStateValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CSVState::STANDARD), "STANDARD" }, + { static_cast(CSVState::DELIMITER), "DELIMITER" }, + { static_cast(CSVState::RECORD_SEPARATOR), "RECORD_SEPARATOR" }, + { static_cast(CSVState::CARRIAGE_RETURN), "CARRIAGE_RETURN" }, + { static_cast(CSVState::QUOTED), "QUOTED" }, + { static_cast(CSVState::UNQUOTED), "UNQUOTED" }, + { static_cast(CSVState::ESCAPE), "ESCAPE" }, + { static_cast(CSVState::INVALID), "INVALID" }, + { static_cast(CSVState::NOT_SET), "NOT_SET" }, + { static_cast(CSVState::QUOTED_NEW_LINE), "QUOTED_NEW_LINE" }, + { static_cast(CSVState::EMPTY_SPACE), "EMPTY_SPACE" }, + { static_cast(CSVState::COMMENT), "COMMENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(CSVState value) { - switch(value) { - case CSVState::STANDARD: - return "STANDARD"; - case CSVState::DELIMITER: - return "DELIMITER"; - case CSVState::RECORD_SEPARATOR: - return "RECORD_SEPARATOR"; - case CSVState::CARRIAGE_RETURN: - return "CARRIAGE_RETURN"; - case CSVState::QUOTED: - return "QUOTED"; - case CSVState::UNQUOTED: - return "UNQUOTED"; - case CSVState::ESCAPE: - return "ESCAPE"; - case CSVState::INVALID: - return "INVALID"; - case CSVState::NOT_SET: - return "NOT_SET"; - case CSVState::QUOTED_NEW_LINE: - return "QUOTED_NEW_LINE"; - case CSVState::EMPTY_SPACE: - return "EMPTY_SPACE"; - case CSVState::COMMENT: - return "COMMENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCSVStateValues(), 12, static_cast(value)); } template<> CSVState EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STANDARD")) { - return CSVState::STANDARD; - } - if (StringUtil::Equals(value, "DELIMITER")) { - return CSVState::DELIMITER; - } - if (StringUtil::Equals(value, "RECORD_SEPARATOR")) { - return CSVState::RECORD_SEPARATOR; - } - if (StringUtil::Equals(value, "CARRIAGE_RETURN")) { - return CSVState::CARRIAGE_RETURN; - } - if (StringUtil::Equals(value, "QUOTED")) { - return CSVState::QUOTED; - } - if (StringUtil::Equals(value, "UNQUOTED")) { - return CSVState::UNQUOTED; - } - if (StringUtil::Equals(value, "ESCAPE")) { - return CSVState::ESCAPE; - } - if (StringUtil::Equals(value, "INVALID")) { - return CSVState::INVALID; - } - if (StringUtil::Equals(value, "NOT_SET")) { - return CSVState::NOT_SET; - } - if (StringUtil::Equals(value, "QUOTED_NEW_LINE")) { - return CSVState::QUOTED_NEW_LINE; - } - if (StringUtil::Equals(value, "EMPTY_SPACE")) { - return CSVState::EMPTY_SPACE; - } - if (StringUtil::Equals(value, "COMMENT")) { - return CSVState::COMMENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCSVStateValues(), 12, value)); +} + +const StringUtil::EnumStringLiteral *GetCTEMaterializeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CTEMaterialize::CTE_MATERIALIZE_DEFAULT), "CTE_MATERIALIZE_DEFAULT" }, + { static_cast(CTEMaterialize::CTE_MATERIALIZE_ALWAYS), "CTE_MATERIALIZE_ALWAYS" }, + { static_cast(CTEMaterialize::CTE_MATERIALIZE_NEVER), "CTE_MATERIALIZE_NEVER" } + }; + return values; } template<> const char* EnumUtil::ToChars(CTEMaterialize value) { - switch(value) { - case CTEMaterialize::CTE_MATERIALIZE_DEFAULT: - return "CTE_MATERIALIZE_DEFAULT"; - case CTEMaterialize::CTE_MATERIALIZE_ALWAYS: - return "CTE_MATERIALIZE_ALWAYS"; - case CTEMaterialize::CTE_MATERIALIZE_NEVER: - return "CTE_MATERIALIZE_NEVER"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCTEMaterializeValues(), 3, static_cast(value)); } template<> CTEMaterialize EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CTE_MATERIALIZE_DEFAULT")) { - return CTEMaterialize::CTE_MATERIALIZE_DEFAULT; - } - if (StringUtil::Equals(value, "CTE_MATERIALIZE_ALWAYS")) { - return CTEMaterialize::CTE_MATERIALIZE_ALWAYS; - } - if (StringUtil::Equals(value, "CTE_MATERIALIZE_NEVER")) { - return CTEMaterialize::CTE_MATERIALIZE_NEVER; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCTEMaterializeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetCatalogLookupBehaviorValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CatalogLookupBehavior::STANDARD), "STANDARD" }, + { static_cast(CatalogLookupBehavior::LOWER_PRIORITY), "LOWER_PRIORITY" }, + { static_cast(CatalogLookupBehavior::NEVER_LOOKUP), "NEVER_LOOKUP" } + }; + return values; } template<> const char* EnumUtil::ToChars(CatalogLookupBehavior value) { - switch(value) { - case CatalogLookupBehavior::STANDARD: - return "STANDARD"; - case CatalogLookupBehavior::LOWER_PRIORITY: - return "LOWER_PRIORITY"; - case CatalogLookupBehavior::NEVER_LOOKUP: - return "NEVER_LOOKUP"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCatalogLookupBehaviorValues(), 3, static_cast(value)); } template<> CatalogLookupBehavior EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STANDARD")) { - return CatalogLookupBehavior::STANDARD; - } - if (StringUtil::Equals(value, "LOWER_PRIORITY")) { - return CatalogLookupBehavior::LOWER_PRIORITY; - } - if (StringUtil::Equals(value, "NEVER_LOOKUP")) { - return CatalogLookupBehavior::NEVER_LOOKUP; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCatalogLookupBehaviorValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetCatalogTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CatalogType::INVALID), "INVALID" }, + { static_cast(CatalogType::TABLE_ENTRY), "TABLE_ENTRY" }, + { static_cast(CatalogType::SCHEMA_ENTRY), "SCHEMA_ENTRY" }, + { static_cast(CatalogType::VIEW_ENTRY), "VIEW_ENTRY" }, + { static_cast(CatalogType::INDEX_ENTRY), "INDEX_ENTRY" }, + { static_cast(CatalogType::PREPARED_STATEMENT), "PREPARED_STATEMENT" }, + { static_cast(CatalogType::SEQUENCE_ENTRY), "SEQUENCE_ENTRY" }, + { static_cast(CatalogType::COLLATION_ENTRY), "COLLATION_ENTRY" }, + { static_cast(CatalogType::TYPE_ENTRY), "TYPE_ENTRY" }, + { static_cast(CatalogType::DATABASE_ENTRY), "DATABASE_ENTRY" }, + { static_cast(CatalogType::TABLE_FUNCTION_ENTRY), "TABLE_FUNCTION_ENTRY" }, + { static_cast(CatalogType::SCALAR_FUNCTION_ENTRY), "SCALAR_FUNCTION_ENTRY" }, + { static_cast(CatalogType::AGGREGATE_FUNCTION_ENTRY), "AGGREGATE_FUNCTION_ENTRY" }, + { static_cast(CatalogType::PRAGMA_FUNCTION_ENTRY), "PRAGMA_FUNCTION_ENTRY" }, + { static_cast(CatalogType::COPY_FUNCTION_ENTRY), "COPY_FUNCTION_ENTRY" }, + { static_cast(CatalogType::MACRO_ENTRY), "MACRO_ENTRY" }, + { static_cast(CatalogType::TABLE_MACRO_ENTRY), "TABLE_MACRO_ENTRY" }, + { static_cast(CatalogType::DELETED_ENTRY), "DELETED_ENTRY" }, + { static_cast(CatalogType::RENAMED_ENTRY), "RENAMED_ENTRY" }, + { static_cast(CatalogType::SECRET_ENTRY), "SECRET_ENTRY" }, + { static_cast(CatalogType::SECRET_TYPE_ENTRY), "SECRET_TYPE_ENTRY" }, + { static_cast(CatalogType::SECRET_FUNCTION_ENTRY), "SECRET_FUNCTION_ENTRY" }, + { static_cast(CatalogType::DEPENDENCY_ENTRY), "DEPENDENCY_ENTRY" } + }; + return values; } template<> const char* EnumUtil::ToChars(CatalogType value) { - switch(value) { - case CatalogType::INVALID: - return "INVALID"; - case CatalogType::TABLE_ENTRY: - return "TABLE_ENTRY"; - case CatalogType::SCHEMA_ENTRY: - return "SCHEMA_ENTRY"; - case CatalogType::VIEW_ENTRY: - return "VIEW_ENTRY"; - case CatalogType::INDEX_ENTRY: - return "INDEX_ENTRY"; - case CatalogType::PREPARED_STATEMENT: - return "PREPARED_STATEMENT"; - case CatalogType::SEQUENCE_ENTRY: - return "SEQUENCE_ENTRY"; - case CatalogType::COLLATION_ENTRY: - return "COLLATION_ENTRY"; - case CatalogType::TYPE_ENTRY: - return "TYPE_ENTRY"; - case CatalogType::DATABASE_ENTRY: - return "DATABASE_ENTRY"; - case CatalogType::TABLE_FUNCTION_ENTRY: - return "TABLE_FUNCTION_ENTRY"; - case CatalogType::SCALAR_FUNCTION_ENTRY: - return "SCALAR_FUNCTION_ENTRY"; - case CatalogType::AGGREGATE_FUNCTION_ENTRY: - return "AGGREGATE_FUNCTION_ENTRY"; - case CatalogType::PRAGMA_FUNCTION_ENTRY: - return "PRAGMA_FUNCTION_ENTRY"; - case CatalogType::COPY_FUNCTION_ENTRY: - return "COPY_FUNCTION_ENTRY"; - case CatalogType::MACRO_ENTRY: - return "MACRO_ENTRY"; - case CatalogType::TABLE_MACRO_ENTRY: - return "TABLE_MACRO_ENTRY"; - case CatalogType::DELETED_ENTRY: - return "DELETED_ENTRY"; - case CatalogType::RENAMED_ENTRY: - return "RENAMED_ENTRY"; - case CatalogType::SECRET_ENTRY: - return "SECRET_ENTRY"; - case CatalogType::SECRET_TYPE_ENTRY: - return "SECRET_TYPE_ENTRY"; - case CatalogType::SECRET_FUNCTION_ENTRY: - return "SECRET_FUNCTION_ENTRY"; - case CatalogType::DEPENDENCY_ENTRY: - return "DEPENDENCY_ENTRY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCatalogTypeValues(), 23, static_cast(value)); } template<> CatalogType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return CatalogType::INVALID; - } - if (StringUtil::Equals(value, "TABLE_ENTRY")) { - return CatalogType::TABLE_ENTRY; - } - if (StringUtil::Equals(value, "SCHEMA_ENTRY")) { - return CatalogType::SCHEMA_ENTRY; - } - if (StringUtil::Equals(value, "VIEW_ENTRY")) { - return CatalogType::VIEW_ENTRY; - } - if (StringUtil::Equals(value, "INDEX_ENTRY")) { - return CatalogType::INDEX_ENTRY; - } - if (StringUtil::Equals(value, "PREPARED_STATEMENT")) { - return CatalogType::PREPARED_STATEMENT; - } - if (StringUtil::Equals(value, "SEQUENCE_ENTRY")) { - return CatalogType::SEQUENCE_ENTRY; - } - if (StringUtil::Equals(value, "COLLATION_ENTRY")) { - return CatalogType::COLLATION_ENTRY; - } - if (StringUtil::Equals(value, "TYPE_ENTRY")) { - return CatalogType::TYPE_ENTRY; - } - if (StringUtil::Equals(value, "DATABASE_ENTRY")) { - return CatalogType::DATABASE_ENTRY; - } - if (StringUtil::Equals(value, "TABLE_FUNCTION_ENTRY")) { - return CatalogType::TABLE_FUNCTION_ENTRY; - } - if (StringUtil::Equals(value, "SCALAR_FUNCTION_ENTRY")) { - return CatalogType::SCALAR_FUNCTION_ENTRY; - } - if (StringUtil::Equals(value, "AGGREGATE_FUNCTION_ENTRY")) { - return CatalogType::AGGREGATE_FUNCTION_ENTRY; - } - if (StringUtil::Equals(value, "PRAGMA_FUNCTION_ENTRY")) { - return CatalogType::PRAGMA_FUNCTION_ENTRY; - } - if (StringUtil::Equals(value, "COPY_FUNCTION_ENTRY")) { - return CatalogType::COPY_FUNCTION_ENTRY; - } - if (StringUtil::Equals(value, "MACRO_ENTRY")) { - return CatalogType::MACRO_ENTRY; - } - if (StringUtil::Equals(value, "TABLE_MACRO_ENTRY")) { - return CatalogType::TABLE_MACRO_ENTRY; - } - if (StringUtil::Equals(value, "DELETED_ENTRY")) { - return CatalogType::DELETED_ENTRY; - } - if (StringUtil::Equals(value, "RENAMED_ENTRY")) { - return CatalogType::RENAMED_ENTRY; - } - if (StringUtil::Equals(value, "SECRET_ENTRY")) { - return CatalogType::SECRET_ENTRY; - } - if (StringUtil::Equals(value, "SECRET_TYPE_ENTRY")) { - return CatalogType::SECRET_TYPE_ENTRY; - } - if (StringUtil::Equals(value, "SECRET_FUNCTION_ENTRY")) { - return CatalogType::SECRET_FUNCTION_ENTRY; - } - if (StringUtil::Equals(value, "DEPENDENCY_ENTRY")) { - return CatalogType::DEPENDENCY_ENTRY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCatalogTypeValues(), 23, value)); +} + +const StringUtil::EnumStringLiteral *GetCheckpointAbortValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CheckpointAbort::NO_ABORT), "NO_ABORT" }, + { static_cast(CheckpointAbort::DEBUG_ABORT_BEFORE_TRUNCATE), "DEBUG_ABORT_BEFORE_TRUNCATE" }, + { static_cast(CheckpointAbort::DEBUG_ABORT_BEFORE_HEADER), "DEBUG_ABORT_BEFORE_HEADER" }, + { static_cast(CheckpointAbort::DEBUG_ABORT_AFTER_FREE_LIST_WRITE), "DEBUG_ABORT_AFTER_FREE_LIST_WRITE" } + }; + return values; } template<> const char* EnumUtil::ToChars(CheckpointAbort value) { - switch(value) { - case CheckpointAbort::NO_ABORT: - return "NO_ABORT"; - case CheckpointAbort::DEBUG_ABORT_BEFORE_TRUNCATE: - return "DEBUG_ABORT_BEFORE_TRUNCATE"; - case CheckpointAbort::DEBUG_ABORT_BEFORE_HEADER: - return "DEBUG_ABORT_BEFORE_HEADER"; - case CheckpointAbort::DEBUG_ABORT_AFTER_FREE_LIST_WRITE: - return "DEBUG_ABORT_AFTER_FREE_LIST_WRITE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCheckpointAbortValues(), 4, static_cast(value)); } template<> CheckpointAbort EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_ABORT")) { - return CheckpointAbort::NO_ABORT; - } - if (StringUtil::Equals(value, "DEBUG_ABORT_BEFORE_TRUNCATE")) { - return CheckpointAbort::DEBUG_ABORT_BEFORE_TRUNCATE; - } - if (StringUtil::Equals(value, "DEBUG_ABORT_BEFORE_HEADER")) { - return CheckpointAbort::DEBUG_ABORT_BEFORE_HEADER; - } - if (StringUtil::Equals(value, "DEBUG_ABORT_AFTER_FREE_LIST_WRITE")) { - return CheckpointAbort::DEBUG_ABORT_AFTER_FREE_LIST_WRITE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCheckpointAbortValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetChunkInfoTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ChunkInfoType::CONSTANT_INFO), "CONSTANT_INFO" }, + { static_cast(ChunkInfoType::VECTOR_INFO), "VECTOR_INFO" }, + { static_cast(ChunkInfoType::EMPTY_INFO), "EMPTY_INFO" } + }; + return values; } template<> const char* EnumUtil::ToChars(ChunkInfoType value) { - switch(value) { - case ChunkInfoType::CONSTANT_INFO: - return "CONSTANT_INFO"; - case ChunkInfoType::VECTOR_INFO: - return "VECTOR_INFO"; - case ChunkInfoType::EMPTY_INFO: - return "EMPTY_INFO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetChunkInfoTypeValues(), 3, static_cast(value)); } template<> ChunkInfoType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CONSTANT_INFO")) { - return ChunkInfoType::CONSTANT_INFO; - } - if (StringUtil::Equals(value, "VECTOR_INFO")) { - return ChunkInfoType::VECTOR_INFO; - } - if (StringUtil::Equals(value, "EMPTY_INFO")) { - return ChunkInfoType::EMPTY_INFO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetChunkInfoTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetColumnDataAllocatorTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ColumnDataAllocatorType::BUFFER_MANAGER_ALLOCATOR), "BUFFER_MANAGER_ALLOCATOR" }, + { static_cast(ColumnDataAllocatorType::IN_MEMORY_ALLOCATOR), "IN_MEMORY_ALLOCATOR" }, + { static_cast(ColumnDataAllocatorType::HYBRID), "HYBRID" } + }; + return values; } template<> const char* EnumUtil::ToChars(ColumnDataAllocatorType value) { - switch(value) { - case ColumnDataAllocatorType::BUFFER_MANAGER_ALLOCATOR: - return "BUFFER_MANAGER_ALLOCATOR"; - case ColumnDataAllocatorType::IN_MEMORY_ALLOCATOR: - return "IN_MEMORY_ALLOCATOR"; - case ColumnDataAllocatorType::HYBRID: - return "HYBRID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetColumnDataAllocatorTypeValues(), 3, static_cast(value)); } template<> ColumnDataAllocatorType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BUFFER_MANAGER_ALLOCATOR")) { - return ColumnDataAllocatorType::BUFFER_MANAGER_ALLOCATOR; - } - if (StringUtil::Equals(value, "IN_MEMORY_ALLOCATOR")) { - return ColumnDataAllocatorType::IN_MEMORY_ALLOCATOR; - } - if (StringUtil::Equals(value, "HYBRID")) { - return ColumnDataAllocatorType::HYBRID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetColumnDataAllocatorTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetColumnDataScanPropertiesValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ColumnDataScanProperties::INVALID), "INVALID" }, + { static_cast(ColumnDataScanProperties::ALLOW_ZERO_COPY), "ALLOW_ZERO_COPY" }, + { static_cast(ColumnDataScanProperties::DISALLOW_ZERO_COPY), "DISALLOW_ZERO_COPY" } + }; + return values; } template<> const char* EnumUtil::ToChars(ColumnDataScanProperties value) { - switch(value) { - case ColumnDataScanProperties::INVALID: - return "INVALID"; - case ColumnDataScanProperties::ALLOW_ZERO_COPY: - return "ALLOW_ZERO_COPY"; - case ColumnDataScanProperties::DISALLOW_ZERO_COPY: - return "DISALLOW_ZERO_COPY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetColumnDataScanPropertiesValues(), 3, static_cast(value)); } template<> ColumnDataScanProperties EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return ColumnDataScanProperties::INVALID; - } - if (StringUtil::Equals(value, "ALLOW_ZERO_COPY")) { - return ColumnDataScanProperties::ALLOW_ZERO_COPY; - } - if (StringUtil::Equals(value, "DISALLOW_ZERO_COPY")) { - return ColumnDataScanProperties::DISALLOW_ZERO_COPY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetColumnDataScanPropertiesValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetColumnSegmentTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ColumnSegmentType::TRANSIENT), "TRANSIENT" }, + { static_cast(ColumnSegmentType::PERSISTENT), "PERSISTENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(ColumnSegmentType value) { - switch(value) { - case ColumnSegmentType::TRANSIENT: - return "TRANSIENT"; - case ColumnSegmentType::PERSISTENT: - return "PERSISTENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetColumnSegmentTypeValues(), 2, static_cast(value)); } template<> ColumnSegmentType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "TRANSIENT")) { - return ColumnSegmentType::TRANSIENT; - } - if (StringUtil::Equals(value, "PERSISTENT")) { - return ColumnSegmentType::PERSISTENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetColumnSegmentTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetCompressedMaterializationDirectionValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CompressedMaterializationDirection::INVALID), "INVALID" }, + { static_cast(CompressedMaterializationDirection::COMPRESS), "COMPRESS" }, + { static_cast(CompressedMaterializationDirection::DECOMPRESS), "DECOMPRESS" } + }; + return values; } template<> const char* EnumUtil::ToChars(CompressedMaterializationDirection value) { - switch(value) { - case CompressedMaterializationDirection::INVALID: - return "INVALID"; - case CompressedMaterializationDirection::COMPRESS: - return "COMPRESS"; - case CompressedMaterializationDirection::DECOMPRESS: - return "DECOMPRESS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCompressedMaterializationDirectionValues(), 3, static_cast(value)); } template<> CompressedMaterializationDirection EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return CompressedMaterializationDirection::INVALID; - } - if (StringUtil::Equals(value, "COMPRESS")) { - return CompressedMaterializationDirection::COMPRESS; - } - if (StringUtil::Equals(value, "DECOMPRESS")) { - return CompressedMaterializationDirection::DECOMPRESS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCompressedMaterializationDirectionValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetCompressionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CompressionType::COMPRESSION_AUTO), "COMPRESSION_AUTO" }, + { static_cast(CompressionType::COMPRESSION_UNCOMPRESSED), "COMPRESSION_UNCOMPRESSED" }, + { static_cast(CompressionType::COMPRESSION_CONSTANT), "COMPRESSION_CONSTANT" }, + { static_cast(CompressionType::COMPRESSION_RLE), "COMPRESSION_RLE" }, + { static_cast(CompressionType::COMPRESSION_DICTIONARY), "COMPRESSION_DICTIONARY" }, + { static_cast(CompressionType::COMPRESSION_PFOR_DELTA), "COMPRESSION_PFOR_DELTA" }, + { static_cast(CompressionType::COMPRESSION_BITPACKING), "COMPRESSION_BITPACKING" }, + { static_cast(CompressionType::COMPRESSION_FSST), "COMPRESSION_FSST" }, + { static_cast(CompressionType::COMPRESSION_CHIMP), "COMPRESSION_CHIMP" }, + { static_cast(CompressionType::COMPRESSION_PATAS), "COMPRESSION_PATAS" }, + { static_cast(CompressionType::COMPRESSION_ALP), "COMPRESSION_ALP" }, + { static_cast(CompressionType::COMPRESSION_ALPRD), "COMPRESSION_ALPRD" }, + { static_cast(CompressionType::COMPRESSION_COUNT), "COMPRESSION_COUNT" } + }; + return values; } template<> const char* EnumUtil::ToChars(CompressionType value) { - switch(value) { - case CompressionType::COMPRESSION_AUTO: - return "COMPRESSION_AUTO"; - case CompressionType::COMPRESSION_UNCOMPRESSED: - return "COMPRESSION_UNCOMPRESSED"; - case CompressionType::COMPRESSION_CONSTANT: - return "COMPRESSION_CONSTANT"; - case CompressionType::COMPRESSION_RLE: - return "COMPRESSION_RLE"; - case CompressionType::COMPRESSION_DICTIONARY: - return "COMPRESSION_DICTIONARY"; - case CompressionType::COMPRESSION_PFOR_DELTA: - return "COMPRESSION_PFOR_DELTA"; - case CompressionType::COMPRESSION_BITPACKING: - return "COMPRESSION_BITPACKING"; - case CompressionType::COMPRESSION_FSST: - return "COMPRESSION_FSST"; - case CompressionType::COMPRESSION_CHIMP: - return "COMPRESSION_CHIMP"; - case CompressionType::COMPRESSION_PATAS: - return "COMPRESSION_PATAS"; - case CompressionType::COMPRESSION_ALP: - return "COMPRESSION_ALP"; - case CompressionType::COMPRESSION_ALPRD: - return "COMPRESSION_ALPRD"; - case CompressionType::COMPRESSION_COUNT: - return "COMPRESSION_COUNT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCompressionTypeValues(), 13, static_cast(value)); } template<> CompressionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "COMPRESSION_AUTO")) { - return CompressionType::COMPRESSION_AUTO; - } - if (StringUtil::Equals(value, "COMPRESSION_UNCOMPRESSED")) { - return CompressionType::COMPRESSION_UNCOMPRESSED; - } - if (StringUtil::Equals(value, "COMPRESSION_CONSTANT")) { - return CompressionType::COMPRESSION_CONSTANT; - } - if (StringUtil::Equals(value, "COMPRESSION_RLE")) { - return CompressionType::COMPRESSION_RLE; - } - if (StringUtil::Equals(value, "COMPRESSION_DICTIONARY")) { - return CompressionType::COMPRESSION_DICTIONARY; - } - if (StringUtil::Equals(value, "COMPRESSION_PFOR_DELTA")) { - return CompressionType::COMPRESSION_PFOR_DELTA; - } - if (StringUtil::Equals(value, "COMPRESSION_BITPACKING")) { - return CompressionType::COMPRESSION_BITPACKING; - } - if (StringUtil::Equals(value, "COMPRESSION_FSST")) { - return CompressionType::COMPRESSION_FSST; - } - if (StringUtil::Equals(value, "COMPRESSION_CHIMP")) { - return CompressionType::COMPRESSION_CHIMP; - } - if (StringUtil::Equals(value, "COMPRESSION_PATAS")) { - return CompressionType::COMPRESSION_PATAS; - } - if (StringUtil::Equals(value, "COMPRESSION_ALP")) { - return CompressionType::COMPRESSION_ALP; - } - if (StringUtil::Equals(value, "COMPRESSION_ALPRD")) { - return CompressionType::COMPRESSION_ALPRD; - } - if (StringUtil::Equals(value, "COMPRESSION_COUNT")) { - return CompressionType::COMPRESSION_COUNT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCompressionTypeValues(), 13, value)); +} + +const StringUtil::EnumStringLiteral *GetConflictManagerModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ConflictManagerMode::SCAN), "SCAN" }, + { static_cast(ConflictManagerMode::THROW), "THROW" } + }; + return values; } template<> const char* EnumUtil::ToChars(ConflictManagerMode value) { - switch(value) { - case ConflictManagerMode::SCAN: - return "SCAN"; - case ConflictManagerMode::THROW: - return "THROW"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetConflictManagerModeValues(), 2, static_cast(value)); } template<> ConflictManagerMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SCAN")) { - return ConflictManagerMode::SCAN; - } - if (StringUtil::Equals(value, "THROW")) { - return ConflictManagerMode::THROW; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetConflictManagerModeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetConstraintTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ConstraintType::INVALID), "INVALID" }, + { static_cast(ConstraintType::NOT_NULL), "NOT_NULL" }, + { static_cast(ConstraintType::CHECK), "CHECK" }, + { static_cast(ConstraintType::UNIQUE), "UNIQUE" }, + { static_cast(ConstraintType::FOREIGN_KEY), "FOREIGN_KEY" } + }; + return values; } template<> const char* EnumUtil::ToChars(ConstraintType value) { - switch(value) { - case ConstraintType::INVALID: - return "INVALID"; - case ConstraintType::NOT_NULL: - return "NOT_NULL"; - case ConstraintType::CHECK: - return "CHECK"; - case ConstraintType::UNIQUE: - return "UNIQUE"; - case ConstraintType::FOREIGN_KEY: - return "FOREIGN_KEY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetConstraintTypeValues(), 5, static_cast(value)); } template<> ConstraintType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return ConstraintType::INVALID; - } - if (StringUtil::Equals(value, "NOT_NULL")) { - return ConstraintType::NOT_NULL; - } - if (StringUtil::Equals(value, "CHECK")) { - return ConstraintType::CHECK; - } - if (StringUtil::Equals(value, "UNIQUE")) { - return ConstraintType::UNIQUE; - } - if (StringUtil::Equals(value, "FOREIGN_KEY")) { - return ConstraintType::FOREIGN_KEY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetConstraintTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetCopyFunctionReturnTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CopyFunctionReturnType::CHANGED_ROWS), "CHANGED_ROWS" }, + { static_cast(CopyFunctionReturnType::CHANGED_ROWS_AND_FILE_LIST), "CHANGED_ROWS_AND_FILE_LIST" } + }; + return values; } template<> const char* EnumUtil::ToChars(CopyFunctionReturnType value) { - switch(value) { - case CopyFunctionReturnType::CHANGED_ROWS: - return "CHANGED_ROWS"; - case CopyFunctionReturnType::CHANGED_ROWS_AND_FILE_LIST: - return "CHANGED_ROWS_AND_FILE_LIST"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCopyFunctionReturnTypeValues(), 2, static_cast(value)); } template<> CopyFunctionReturnType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CHANGED_ROWS")) { - return CopyFunctionReturnType::CHANGED_ROWS; - } - if (StringUtil::Equals(value, "CHANGED_ROWS_AND_FILE_LIST")) { - return CopyFunctionReturnType::CHANGED_ROWS_AND_FILE_LIST; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCopyFunctionReturnTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetCopyOverwriteModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CopyOverwriteMode::COPY_ERROR_ON_CONFLICT), "COPY_ERROR_ON_CONFLICT" }, + { static_cast(CopyOverwriteMode::COPY_OVERWRITE), "COPY_OVERWRITE" }, + { static_cast(CopyOverwriteMode::COPY_OVERWRITE_OR_IGNORE), "COPY_OVERWRITE_OR_IGNORE" }, + { static_cast(CopyOverwriteMode::COPY_APPEND), "COPY_APPEND" } + }; + return values; } template<> const char* EnumUtil::ToChars(CopyOverwriteMode value) { - switch(value) { - case CopyOverwriteMode::COPY_ERROR_ON_CONFLICT: - return "COPY_ERROR_ON_CONFLICT"; - case CopyOverwriteMode::COPY_OVERWRITE: - return "COPY_OVERWRITE"; - case CopyOverwriteMode::COPY_OVERWRITE_OR_IGNORE: - return "COPY_OVERWRITE_OR_IGNORE"; - case CopyOverwriteMode::COPY_APPEND: - return "COPY_APPEND"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCopyOverwriteModeValues(), 4, static_cast(value)); } template<> CopyOverwriteMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "COPY_ERROR_ON_CONFLICT")) { - return CopyOverwriteMode::COPY_ERROR_ON_CONFLICT; - } - if (StringUtil::Equals(value, "COPY_OVERWRITE")) { - return CopyOverwriteMode::COPY_OVERWRITE; - } - if (StringUtil::Equals(value, "COPY_OVERWRITE_OR_IGNORE")) { - return CopyOverwriteMode::COPY_OVERWRITE_OR_IGNORE; - } - if (StringUtil::Equals(value, "COPY_APPEND")) { - return CopyOverwriteMode::COPY_APPEND; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCopyOverwriteModeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetCopyToTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(CopyToType::COPY_TO_FILE), "COPY_TO_FILE" }, + { static_cast(CopyToType::EXPORT_DATABASE), "EXPORT_DATABASE" } + }; + return values; } template<> const char* EnumUtil::ToChars(CopyToType value) { - switch(value) { - case CopyToType::COPY_TO_FILE: - return "COPY_TO_FILE"; - case CopyToType::EXPORT_DATABASE: - return "EXPORT_DATABASE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetCopyToTypeValues(), 2, static_cast(value)); } template<> CopyToType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "COPY_TO_FILE")) { - return CopyToType::COPY_TO_FILE; - } - if (StringUtil::Equals(value, "EXPORT_DATABASE")) { - return CopyToType::EXPORT_DATABASE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetCopyToTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetDataFileTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DataFileType::FILE_DOES_NOT_EXIST), "FILE_DOES_NOT_EXIST" }, + { static_cast(DataFileType::DUCKDB_FILE), "DUCKDB_FILE" }, + { static_cast(DataFileType::SQLITE_FILE), "SQLITE_FILE" }, + { static_cast(DataFileType::PARQUET_FILE), "PARQUET_FILE" } + }; + return values; } template<> const char* EnumUtil::ToChars(DataFileType value) { - switch(value) { - case DataFileType::FILE_DOES_NOT_EXIST: - return "FILE_DOES_NOT_EXIST"; - case DataFileType::DUCKDB_FILE: - return "DUCKDB_FILE"; - case DataFileType::SQLITE_FILE: - return "SQLITE_FILE"; - case DataFileType::PARQUET_FILE: - return "PARQUET_FILE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDataFileTypeValues(), 4, static_cast(value)); } template<> DataFileType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "FILE_DOES_NOT_EXIST")) { - return DataFileType::FILE_DOES_NOT_EXIST; - } - if (StringUtil::Equals(value, "DUCKDB_FILE")) { - return DataFileType::DUCKDB_FILE; - } - if (StringUtil::Equals(value, "SQLITE_FILE")) { - return DataFileType::SQLITE_FILE; - } - if (StringUtil::Equals(value, "PARQUET_FILE")) { - return DataFileType::PARQUET_FILE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDataFileTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetDatePartSpecifierValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DatePartSpecifier::YEAR), "YEAR" }, + { static_cast(DatePartSpecifier::MONTH), "MONTH" }, + { static_cast(DatePartSpecifier::DAY), "DAY" }, + { static_cast(DatePartSpecifier::DECADE), "DECADE" }, + { static_cast(DatePartSpecifier::CENTURY), "CENTURY" }, + { static_cast(DatePartSpecifier::MILLENNIUM), "MILLENNIUM" }, + { static_cast(DatePartSpecifier::MICROSECONDS), "MICROSECONDS" }, + { static_cast(DatePartSpecifier::MILLISECONDS), "MILLISECONDS" }, + { static_cast(DatePartSpecifier::SECOND), "SECOND" }, + { static_cast(DatePartSpecifier::MINUTE), "MINUTE" }, + { static_cast(DatePartSpecifier::HOUR), "HOUR" }, + { static_cast(DatePartSpecifier::DOW), "DOW" }, + { static_cast(DatePartSpecifier::ISODOW), "ISODOW" }, + { static_cast(DatePartSpecifier::WEEK), "WEEK" }, + { static_cast(DatePartSpecifier::ISOYEAR), "ISOYEAR" }, + { static_cast(DatePartSpecifier::QUARTER), "QUARTER" }, + { static_cast(DatePartSpecifier::DOY), "DOY" }, + { static_cast(DatePartSpecifier::YEARWEEK), "YEARWEEK" }, + { static_cast(DatePartSpecifier::ERA), "ERA" }, + { static_cast(DatePartSpecifier::TIMEZONE), "TIMEZONE" }, + { static_cast(DatePartSpecifier::TIMEZONE_HOUR), "TIMEZONE_HOUR" }, + { static_cast(DatePartSpecifier::TIMEZONE_MINUTE), "TIMEZONE_MINUTE" }, + { static_cast(DatePartSpecifier::EPOCH), "EPOCH" }, + { static_cast(DatePartSpecifier::JULIAN_DAY), "JULIAN_DAY" }, + { static_cast(DatePartSpecifier::INVALID), "INVALID" } + }; + return values; } template<> const char* EnumUtil::ToChars(DatePartSpecifier value) { - switch(value) { - case DatePartSpecifier::YEAR: - return "YEAR"; - case DatePartSpecifier::MONTH: - return "MONTH"; - case DatePartSpecifier::DAY: - return "DAY"; - case DatePartSpecifier::DECADE: - return "DECADE"; - case DatePartSpecifier::CENTURY: - return "CENTURY"; - case DatePartSpecifier::MILLENNIUM: - return "MILLENNIUM"; - case DatePartSpecifier::MICROSECONDS: - return "MICROSECONDS"; - case DatePartSpecifier::MILLISECONDS: - return "MILLISECONDS"; - case DatePartSpecifier::SECOND: - return "SECOND"; - case DatePartSpecifier::MINUTE: - return "MINUTE"; - case DatePartSpecifier::HOUR: - return "HOUR"; - case DatePartSpecifier::DOW: - return "DOW"; - case DatePartSpecifier::ISODOW: - return "ISODOW"; - case DatePartSpecifier::WEEK: - return "WEEK"; - case DatePartSpecifier::ISOYEAR: - return "ISOYEAR"; - case DatePartSpecifier::QUARTER: - return "QUARTER"; - case DatePartSpecifier::DOY: - return "DOY"; - case DatePartSpecifier::YEARWEEK: - return "YEARWEEK"; - case DatePartSpecifier::ERA: - return "ERA"; - case DatePartSpecifier::TIMEZONE: - return "TIMEZONE"; - case DatePartSpecifier::TIMEZONE_HOUR: - return "TIMEZONE_HOUR"; - case DatePartSpecifier::TIMEZONE_MINUTE: - return "TIMEZONE_MINUTE"; - case DatePartSpecifier::EPOCH: - return "EPOCH"; - case DatePartSpecifier::JULIAN_DAY: - return "JULIAN_DAY"; - case DatePartSpecifier::INVALID: - return "INVALID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDatePartSpecifierValues(), 25, static_cast(value)); } template<> DatePartSpecifier EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "YEAR")) { - return DatePartSpecifier::YEAR; - } - if (StringUtil::Equals(value, "MONTH")) { - return DatePartSpecifier::MONTH; - } - if (StringUtil::Equals(value, "DAY")) { - return DatePartSpecifier::DAY; - } - if (StringUtil::Equals(value, "DECADE")) { - return DatePartSpecifier::DECADE; - } - if (StringUtil::Equals(value, "CENTURY")) { - return DatePartSpecifier::CENTURY; - } - if (StringUtil::Equals(value, "MILLENNIUM")) { - return DatePartSpecifier::MILLENNIUM; - } - if (StringUtil::Equals(value, "MICROSECONDS")) { - return DatePartSpecifier::MICROSECONDS; - } - if (StringUtil::Equals(value, "MILLISECONDS")) { - return DatePartSpecifier::MILLISECONDS; - } - if (StringUtil::Equals(value, "SECOND")) { - return DatePartSpecifier::SECOND; - } - if (StringUtil::Equals(value, "MINUTE")) { - return DatePartSpecifier::MINUTE; - } - if (StringUtil::Equals(value, "HOUR")) { - return DatePartSpecifier::HOUR; - } - if (StringUtil::Equals(value, "DOW")) { - return DatePartSpecifier::DOW; - } - if (StringUtil::Equals(value, "ISODOW")) { - return DatePartSpecifier::ISODOW; - } - if (StringUtil::Equals(value, "WEEK")) { - return DatePartSpecifier::WEEK; - } - if (StringUtil::Equals(value, "ISOYEAR")) { - return DatePartSpecifier::ISOYEAR; - } - if (StringUtil::Equals(value, "QUARTER")) { - return DatePartSpecifier::QUARTER; - } - if (StringUtil::Equals(value, "DOY")) { - return DatePartSpecifier::DOY; - } - if (StringUtil::Equals(value, "YEARWEEK")) { - return DatePartSpecifier::YEARWEEK; - } - if (StringUtil::Equals(value, "ERA")) { - return DatePartSpecifier::ERA; - } - if (StringUtil::Equals(value, "TIMEZONE")) { - return DatePartSpecifier::TIMEZONE; - } - if (StringUtil::Equals(value, "TIMEZONE_HOUR")) { - return DatePartSpecifier::TIMEZONE_HOUR; - } - if (StringUtil::Equals(value, "TIMEZONE_MINUTE")) { - return DatePartSpecifier::TIMEZONE_MINUTE; - } - if (StringUtil::Equals(value, "EPOCH")) { - return DatePartSpecifier::EPOCH; - } - if (StringUtil::Equals(value, "JULIAN_DAY")) { - return DatePartSpecifier::JULIAN_DAY; - } - if (StringUtil::Equals(value, "INVALID")) { - return DatePartSpecifier::INVALID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDatePartSpecifierValues(), 25, value)); +} + +const StringUtil::EnumStringLiteral *GetDebugInitializeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DebugInitialize::NO_INITIALIZE), "NO_INITIALIZE" }, + { static_cast(DebugInitialize::DEBUG_ZERO_INITIALIZE), "DEBUG_ZERO_INITIALIZE" }, + { static_cast(DebugInitialize::DEBUG_ONE_INITIALIZE), "DEBUG_ONE_INITIALIZE" } + }; + return values; } template<> const char* EnumUtil::ToChars(DebugInitialize value) { - switch(value) { - case DebugInitialize::NO_INITIALIZE: - return "NO_INITIALIZE"; - case DebugInitialize::DEBUG_ZERO_INITIALIZE: - return "DEBUG_ZERO_INITIALIZE"; - case DebugInitialize::DEBUG_ONE_INITIALIZE: - return "DEBUG_ONE_INITIALIZE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDebugInitializeValues(), 3, static_cast(value)); } template<> DebugInitialize EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_INITIALIZE")) { - return DebugInitialize::NO_INITIALIZE; - } - if (StringUtil::Equals(value, "DEBUG_ZERO_INITIALIZE")) { - return DebugInitialize::DEBUG_ZERO_INITIALIZE; - } - if (StringUtil::Equals(value, "DEBUG_ONE_INITIALIZE")) { - return DebugInitialize::DEBUG_ONE_INITIALIZE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDebugInitializeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetDefaultOrderByNullTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DefaultOrderByNullType::INVALID), "INVALID" }, + { static_cast(DefaultOrderByNullType::NULLS_FIRST), "NULLS_FIRST" }, + { static_cast(DefaultOrderByNullType::NULLS_LAST), "NULLS_LAST" }, + { static_cast(DefaultOrderByNullType::NULLS_FIRST_ON_ASC_LAST_ON_DESC), "NULLS_FIRST_ON_ASC_LAST_ON_DESC" }, + { static_cast(DefaultOrderByNullType::NULLS_LAST_ON_ASC_FIRST_ON_DESC), "NULLS_LAST_ON_ASC_FIRST_ON_DESC" } + }; + return values; } template<> const char* EnumUtil::ToChars(DefaultOrderByNullType value) { - switch(value) { - case DefaultOrderByNullType::INVALID: - return "INVALID"; - case DefaultOrderByNullType::NULLS_FIRST: - return "NULLS_FIRST"; - case DefaultOrderByNullType::NULLS_LAST: - return "NULLS_LAST"; - case DefaultOrderByNullType::NULLS_FIRST_ON_ASC_LAST_ON_DESC: - return "NULLS_FIRST_ON_ASC_LAST_ON_DESC"; - case DefaultOrderByNullType::NULLS_LAST_ON_ASC_FIRST_ON_DESC: - return "NULLS_LAST_ON_ASC_FIRST_ON_DESC"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDefaultOrderByNullTypeValues(), 5, static_cast(value)); } template<> DefaultOrderByNullType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return DefaultOrderByNullType::INVALID; - } - if (StringUtil::Equals(value, "NULLS_FIRST")) { - return DefaultOrderByNullType::NULLS_FIRST; - } - if (StringUtil::Equals(value, "NULLS_LAST")) { - return DefaultOrderByNullType::NULLS_LAST; - } - if (StringUtil::Equals(value, "NULLS_FIRST_ON_ASC_LAST_ON_DESC")) { - return DefaultOrderByNullType::NULLS_FIRST_ON_ASC_LAST_ON_DESC; - } - if (StringUtil::Equals(value, "NULLS_LAST_ON_ASC_FIRST_ON_DESC")) { - return DefaultOrderByNullType::NULLS_LAST_ON_ASC_FIRST_ON_DESC; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDefaultOrderByNullTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetDependencyEntryTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DependencyEntryType::SUBJECT), "SUBJECT" }, + { static_cast(DependencyEntryType::DEPENDENT), "DEPENDENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(DependencyEntryType value) { - switch(value) { - case DependencyEntryType::SUBJECT: - return "SUBJECT"; - case DependencyEntryType::DEPENDENT: - return "DEPENDENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDependencyEntryTypeValues(), 2, static_cast(value)); } template<> DependencyEntryType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SUBJECT")) { - return DependencyEntryType::SUBJECT; - } - if (StringUtil::Equals(value, "DEPENDENT")) { - return DependencyEntryType::DEPENDENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDependencyEntryTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetDeprecatedIndexTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DeprecatedIndexType::INVALID), "INVALID" }, + { static_cast(DeprecatedIndexType::ART), "ART" }, + { static_cast(DeprecatedIndexType::EXTENSION), "EXTENSION" } + }; + return values; } template<> const char* EnumUtil::ToChars(DeprecatedIndexType value) { - switch(value) { - case DeprecatedIndexType::INVALID: - return "INVALID"; - case DeprecatedIndexType::ART: - return "ART"; - case DeprecatedIndexType::EXTENSION: - return "EXTENSION"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDeprecatedIndexTypeValues(), 3, static_cast(value)); } template<> DeprecatedIndexType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return DeprecatedIndexType::INVALID; - } - if (StringUtil::Equals(value, "ART")) { - return DeprecatedIndexType::ART; - } - if (StringUtil::Equals(value, "EXTENSION")) { - return DeprecatedIndexType::EXTENSION; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDeprecatedIndexTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetDestroyBufferUponValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DestroyBufferUpon::BLOCK), "BLOCK" }, + { static_cast(DestroyBufferUpon::EVICTION), "EVICTION" }, + { static_cast(DestroyBufferUpon::UNPIN), "UNPIN" } + }; + return values; } template<> const char* EnumUtil::ToChars(DestroyBufferUpon value) { - switch(value) { - case DestroyBufferUpon::BLOCK: - return "BLOCK"; - case DestroyBufferUpon::EVICTION: - return "EVICTION"; - case DestroyBufferUpon::UNPIN: - return "UNPIN"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDestroyBufferUponValues(), 3, static_cast(value)); } template<> DestroyBufferUpon EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BLOCK")) { - return DestroyBufferUpon::BLOCK; - } - if (StringUtil::Equals(value, "EVICTION")) { - return DestroyBufferUpon::EVICTION; - } - if (StringUtil::Equals(value, "UNPIN")) { - return DestroyBufferUpon::UNPIN; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDestroyBufferUponValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetDistinctTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(DistinctType::DISTINCT), "DISTINCT" }, + { static_cast(DistinctType::DISTINCT_ON), "DISTINCT_ON" } + }; + return values; } template<> const char* EnumUtil::ToChars(DistinctType value) { - switch(value) { - case DistinctType::DISTINCT: - return "DISTINCT"; - case DistinctType::DISTINCT_ON: - return "DISTINCT_ON"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetDistinctTypeValues(), 2, static_cast(value)); } template<> DistinctType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "DISTINCT")) { - return DistinctType::DISTINCT; - } - if (StringUtil::Equals(value, "DISTINCT_ON")) { - return DistinctType::DISTINCT_ON; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetDistinctTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetErrorTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ErrorType::UNSIGNED_EXTENSION), "UNSIGNED_EXTENSION" }, + { static_cast(ErrorType::INVALIDATED_TRANSACTION), "INVALIDATED_TRANSACTION" }, + { static_cast(ErrorType::INVALIDATED_DATABASE), "INVALIDATED_DATABASE" }, + { static_cast(ErrorType::ERROR_COUNT), "ERROR_COUNT" }, + { static_cast(ErrorType::INVALID), "INVALID" } + }; + return values; } template<> const char* EnumUtil::ToChars(ErrorType value) { - switch(value) { - case ErrorType::UNSIGNED_EXTENSION: - return "UNSIGNED_EXTENSION"; - case ErrorType::INVALIDATED_TRANSACTION: - return "INVALIDATED_TRANSACTION"; - case ErrorType::INVALIDATED_DATABASE: - return "INVALIDATED_DATABASE"; - case ErrorType::ERROR_COUNT: - return "ERROR_COUNT"; - case ErrorType::INVALID: - return "INVALID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetErrorTypeValues(), 5, static_cast(value)); } template<> ErrorType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "UNSIGNED_EXTENSION")) { - return ErrorType::UNSIGNED_EXTENSION; - } - if (StringUtil::Equals(value, "INVALIDATED_TRANSACTION")) { - return ErrorType::INVALIDATED_TRANSACTION; - } - if (StringUtil::Equals(value, "INVALIDATED_DATABASE")) { - return ErrorType::INVALIDATED_DATABASE; - } - if (StringUtil::Equals(value, "ERROR_COUNT")) { - return ErrorType::ERROR_COUNT; - } - if (StringUtil::Equals(value, "INVALID")) { - return ErrorType::INVALID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetErrorTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetExceptionFormatValueTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExceptionFormatValueType::FORMAT_VALUE_TYPE_DOUBLE), "FORMAT_VALUE_TYPE_DOUBLE" }, + { static_cast(ExceptionFormatValueType::FORMAT_VALUE_TYPE_INTEGER), "FORMAT_VALUE_TYPE_INTEGER" }, + { static_cast(ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING), "FORMAT_VALUE_TYPE_STRING" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExceptionFormatValueType value) { - switch(value) { - case ExceptionFormatValueType::FORMAT_VALUE_TYPE_DOUBLE: - return "FORMAT_VALUE_TYPE_DOUBLE"; - case ExceptionFormatValueType::FORMAT_VALUE_TYPE_INTEGER: - return "FORMAT_VALUE_TYPE_INTEGER"; - case ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING: - return "FORMAT_VALUE_TYPE_STRING"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExceptionFormatValueTypeValues(), 3, static_cast(value)); } template<> ExceptionFormatValueType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "FORMAT_VALUE_TYPE_DOUBLE")) { - return ExceptionFormatValueType::FORMAT_VALUE_TYPE_DOUBLE; - } - if (StringUtil::Equals(value, "FORMAT_VALUE_TYPE_INTEGER")) { - return ExceptionFormatValueType::FORMAT_VALUE_TYPE_INTEGER; - } - if (StringUtil::Equals(value, "FORMAT_VALUE_TYPE_STRING")) { - return ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExceptionFormatValueTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetExceptionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExceptionType::INVALID), "INVALID" }, + { static_cast(ExceptionType::OUT_OF_RANGE), "OUT_OF_RANGE" }, + { static_cast(ExceptionType::CONVERSION), "CONVERSION" }, + { static_cast(ExceptionType::UNKNOWN_TYPE), "UNKNOWN_TYPE" }, + { static_cast(ExceptionType::DECIMAL), "DECIMAL" }, + { static_cast(ExceptionType::MISMATCH_TYPE), "MISMATCH_TYPE" }, + { static_cast(ExceptionType::DIVIDE_BY_ZERO), "DIVIDE_BY_ZERO" }, + { static_cast(ExceptionType::OBJECT_SIZE), "OBJECT_SIZE" }, + { static_cast(ExceptionType::INVALID_TYPE), "INVALID_TYPE" }, + { static_cast(ExceptionType::SERIALIZATION), "SERIALIZATION" }, + { static_cast(ExceptionType::TRANSACTION), "TRANSACTION" }, + { static_cast(ExceptionType::NOT_IMPLEMENTED), "NOT_IMPLEMENTED" }, + { static_cast(ExceptionType::EXPRESSION), "EXPRESSION" }, + { static_cast(ExceptionType::CATALOG), "CATALOG" }, + { static_cast(ExceptionType::PARSER), "PARSER" }, + { static_cast(ExceptionType::PLANNER), "PLANNER" }, + { static_cast(ExceptionType::SCHEDULER), "SCHEDULER" }, + { static_cast(ExceptionType::EXECUTOR), "EXECUTOR" }, + { static_cast(ExceptionType::CONSTRAINT), "CONSTRAINT" }, + { static_cast(ExceptionType::INDEX), "INDEX" }, + { static_cast(ExceptionType::STAT), "STAT" }, + { static_cast(ExceptionType::CONNECTION), "CONNECTION" }, + { static_cast(ExceptionType::SYNTAX), "SYNTAX" }, + { static_cast(ExceptionType::SETTINGS), "SETTINGS" }, + { static_cast(ExceptionType::BINDER), "BINDER" }, + { static_cast(ExceptionType::NETWORK), "NETWORK" }, + { static_cast(ExceptionType::OPTIMIZER), "OPTIMIZER" }, + { static_cast(ExceptionType::NULL_POINTER), "NULL_POINTER" }, + { static_cast(ExceptionType::IO), "IO" }, + { static_cast(ExceptionType::INTERRUPT), "INTERRUPT" }, + { static_cast(ExceptionType::FATAL), "FATAL" }, + { static_cast(ExceptionType::INTERNAL), "INTERNAL" }, + { static_cast(ExceptionType::INVALID_INPUT), "INVALID_INPUT" }, + { static_cast(ExceptionType::OUT_OF_MEMORY), "OUT_OF_MEMORY" }, + { static_cast(ExceptionType::PERMISSION), "PERMISSION" }, + { static_cast(ExceptionType::PARAMETER_NOT_RESOLVED), "PARAMETER_NOT_RESOLVED" }, + { static_cast(ExceptionType::PARAMETER_NOT_ALLOWED), "PARAMETER_NOT_ALLOWED" }, + { static_cast(ExceptionType::DEPENDENCY), "DEPENDENCY" }, + { static_cast(ExceptionType::HTTP), "HTTP" }, + { static_cast(ExceptionType::MISSING_EXTENSION), "MISSING_EXTENSION" }, + { static_cast(ExceptionType::AUTOLOAD), "AUTOLOAD" }, + { static_cast(ExceptionType::SEQUENCE), "SEQUENCE" }, + { static_cast(ExceptionType::INVALID_CONFIGURATION), "INVALID_CONFIGURATION" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExceptionType value) { - switch(value) { - case ExceptionType::INVALID: - return "INVALID"; - case ExceptionType::OUT_OF_RANGE: - return "OUT_OF_RANGE"; - case ExceptionType::CONVERSION: - return "CONVERSION"; - case ExceptionType::UNKNOWN_TYPE: - return "UNKNOWN_TYPE"; - case ExceptionType::DECIMAL: - return "DECIMAL"; - case ExceptionType::MISMATCH_TYPE: - return "MISMATCH_TYPE"; - case ExceptionType::DIVIDE_BY_ZERO: - return "DIVIDE_BY_ZERO"; - case ExceptionType::OBJECT_SIZE: - return "OBJECT_SIZE"; - case ExceptionType::INVALID_TYPE: - return "INVALID_TYPE"; - case ExceptionType::SERIALIZATION: - return "SERIALIZATION"; - case ExceptionType::TRANSACTION: - return "TRANSACTION"; - case ExceptionType::NOT_IMPLEMENTED: - return "NOT_IMPLEMENTED"; - case ExceptionType::EXPRESSION: - return "EXPRESSION"; - case ExceptionType::CATALOG: - return "CATALOG"; - case ExceptionType::PARSER: - return "PARSER"; - case ExceptionType::PLANNER: - return "PLANNER"; - case ExceptionType::SCHEDULER: - return "SCHEDULER"; - case ExceptionType::EXECUTOR: - return "EXECUTOR"; - case ExceptionType::CONSTRAINT: - return "CONSTRAINT"; - case ExceptionType::INDEX: - return "INDEX"; - case ExceptionType::STAT: - return "STAT"; - case ExceptionType::CONNECTION: - return "CONNECTION"; - case ExceptionType::SYNTAX: - return "SYNTAX"; - case ExceptionType::SETTINGS: - return "SETTINGS"; - case ExceptionType::BINDER: - return "BINDER"; - case ExceptionType::NETWORK: - return "NETWORK"; - case ExceptionType::OPTIMIZER: - return "OPTIMIZER"; - case ExceptionType::NULL_POINTER: - return "NULL_POINTER"; - case ExceptionType::IO: - return "IO"; - case ExceptionType::INTERRUPT: - return "INTERRUPT"; - case ExceptionType::FATAL: - return "FATAL"; - case ExceptionType::INTERNAL: - return "INTERNAL"; - case ExceptionType::INVALID_INPUT: - return "INVALID_INPUT"; - case ExceptionType::OUT_OF_MEMORY: - return "OUT_OF_MEMORY"; - case ExceptionType::PERMISSION: - return "PERMISSION"; - case ExceptionType::PARAMETER_NOT_RESOLVED: - return "PARAMETER_NOT_RESOLVED"; - case ExceptionType::PARAMETER_NOT_ALLOWED: - return "PARAMETER_NOT_ALLOWED"; - case ExceptionType::DEPENDENCY: - return "DEPENDENCY"; - case ExceptionType::HTTP: - return "HTTP"; - case ExceptionType::MISSING_EXTENSION: - return "MISSING_EXTENSION"; - case ExceptionType::AUTOLOAD: - return "AUTOLOAD"; - case ExceptionType::SEQUENCE: - return "SEQUENCE"; - case ExceptionType::INVALID_CONFIGURATION: - return "INVALID_CONFIGURATION"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExceptionTypeValues(), 43, static_cast(value)); } template<> ExceptionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return ExceptionType::INVALID; - } - if (StringUtil::Equals(value, "OUT_OF_RANGE")) { - return ExceptionType::OUT_OF_RANGE; - } - if (StringUtil::Equals(value, "CONVERSION")) { - return ExceptionType::CONVERSION; - } - if (StringUtil::Equals(value, "UNKNOWN_TYPE")) { - return ExceptionType::UNKNOWN_TYPE; - } - if (StringUtil::Equals(value, "DECIMAL")) { - return ExceptionType::DECIMAL; - } - if (StringUtil::Equals(value, "MISMATCH_TYPE")) { - return ExceptionType::MISMATCH_TYPE; - } - if (StringUtil::Equals(value, "DIVIDE_BY_ZERO")) { - return ExceptionType::DIVIDE_BY_ZERO; - } - if (StringUtil::Equals(value, "OBJECT_SIZE")) { - return ExceptionType::OBJECT_SIZE; - } - if (StringUtil::Equals(value, "INVALID_TYPE")) { - return ExceptionType::INVALID_TYPE; - } - if (StringUtil::Equals(value, "SERIALIZATION")) { - return ExceptionType::SERIALIZATION; - } - if (StringUtil::Equals(value, "TRANSACTION")) { - return ExceptionType::TRANSACTION; - } - if (StringUtil::Equals(value, "NOT_IMPLEMENTED")) { - return ExceptionType::NOT_IMPLEMENTED; - } - if (StringUtil::Equals(value, "EXPRESSION")) { - return ExceptionType::EXPRESSION; - } - if (StringUtil::Equals(value, "CATALOG")) { - return ExceptionType::CATALOG; - } - if (StringUtil::Equals(value, "PARSER")) { - return ExceptionType::PARSER; - } - if (StringUtil::Equals(value, "PLANNER")) { - return ExceptionType::PLANNER; - } - if (StringUtil::Equals(value, "SCHEDULER")) { - return ExceptionType::SCHEDULER; - } - if (StringUtil::Equals(value, "EXECUTOR")) { - return ExceptionType::EXECUTOR; - } - if (StringUtil::Equals(value, "CONSTRAINT")) { - return ExceptionType::CONSTRAINT; - } - if (StringUtil::Equals(value, "INDEX")) { - return ExceptionType::INDEX; - } - if (StringUtil::Equals(value, "STAT")) { - return ExceptionType::STAT; - } - if (StringUtil::Equals(value, "CONNECTION")) { - return ExceptionType::CONNECTION; - } - if (StringUtil::Equals(value, "SYNTAX")) { - return ExceptionType::SYNTAX; - } - if (StringUtil::Equals(value, "SETTINGS")) { - return ExceptionType::SETTINGS; - } - if (StringUtil::Equals(value, "BINDER")) { - return ExceptionType::BINDER; - } - if (StringUtil::Equals(value, "NETWORK")) { - return ExceptionType::NETWORK; - } - if (StringUtil::Equals(value, "OPTIMIZER")) { - return ExceptionType::OPTIMIZER; - } - if (StringUtil::Equals(value, "NULL_POINTER")) { - return ExceptionType::NULL_POINTER; - } - if (StringUtil::Equals(value, "IO")) { - return ExceptionType::IO; - } - if (StringUtil::Equals(value, "INTERRUPT")) { - return ExceptionType::INTERRUPT; - } - if (StringUtil::Equals(value, "FATAL")) { - return ExceptionType::FATAL; - } - if (StringUtil::Equals(value, "INTERNAL")) { - return ExceptionType::INTERNAL; - } - if (StringUtil::Equals(value, "INVALID_INPUT")) { - return ExceptionType::INVALID_INPUT; - } - if (StringUtil::Equals(value, "OUT_OF_MEMORY")) { - return ExceptionType::OUT_OF_MEMORY; - } - if (StringUtil::Equals(value, "PERMISSION")) { - return ExceptionType::PERMISSION; - } - if (StringUtil::Equals(value, "PARAMETER_NOT_RESOLVED")) { - return ExceptionType::PARAMETER_NOT_RESOLVED; - } - if (StringUtil::Equals(value, "PARAMETER_NOT_ALLOWED")) { - return ExceptionType::PARAMETER_NOT_ALLOWED; - } - if (StringUtil::Equals(value, "DEPENDENCY")) { - return ExceptionType::DEPENDENCY; - } - if (StringUtil::Equals(value, "HTTP")) { - return ExceptionType::HTTP; - } - if (StringUtil::Equals(value, "MISSING_EXTENSION")) { - return ExceptionType::MISSING_EXTENSION; - } - if (StringUtil::Equals(value, "AUTOLOAD")) { - return ExceptionType::AUTOLOAD; - } - if (StringUtil::Equals(value, "SEQUENCE")) { - return ExceptionType::SEQUENCE; - } - if (StringUtil::Equals(value, "INVALID_CONFIGURATION")) { - return ExceptionType::INVALID_CONFIGURATION; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExceptionTypeValues(), 43, value)); +} + +const StringUtil::EnumStringLiteral *GetExplainFormatValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExplainFormat::DEFAULT), "DEFAULT" }, + { static_cast(ExplainFormat::TEXT), "TEXT" }, + { static_cast(ExplainFormat::JSON), "JSON" }, + { static_cast(ExplainFormat::HTML), "HTML" }, + { static_cast(ExplainFormat::GRAPHVIZ), "GRAPHVIZ" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExplainFormat value) { - switch(value) { - case ExplainFormat::DEFAULT: - return "DEFAULT"; - case ExplainFormat::TEXT: - return "TEXT"; - case ExplainFormat::JSON: - return "JSON"; - case ExplainFormat::HTML: - return "HTML"; - case ExplainFormat::GRAPHVIZ: - return "GRAPHVIZ"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExplainFormatValues(), 5, static_cast(value)); } template<> ExplainFormat EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "DEFAULT")) { - return ExplainFormat::DEFAULT; - } - if (StringUtil::Equals(value, "TEXT")) { - return ExplainFormat::TEXT; - } - if (StringUtil::Equals(value, "JSON")) { - return ExplainFormat::JSON; - } - if (StringUtil::Equals(value, "HTML")) { - return ExplainFormat::HTML; - } - if (StringUtil::Equals(value, "GRAPHVIZ")) { - return ExplainFormat::GRAPHVIZ; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExplainFormatValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetExplainOutputTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExplainOutputType::ALL), "ALL" }, + { static_cast(ExplainOutputType::OPTIMIZED_ONLY), "OPTIMIZED_ONLY" }, + { static_cast(ExplainOutputType::PHYSICAL_ONLY), "PHYSICAL_ONLY" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExplainOutputType value) { - switch(value) { - case ExplainOutputType::ALL: - return "ALL"; - case ExplainOutputType::OPTIMIZED_ONLY: - return "OPTIMIZED_ONLY"; - case ExplainOutputType::PHYSICAL_ONLY: - return "PHYSICAL_ONLY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExplainOutputTypeValues(), 3, static_cast(value)); } template<> ExplainOutputType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ALL")) { - return ExplainOutputType::ALL; - } - if (StringUtil::Equals(value, "OPTIMIZED_ONLY")) { - return ExplainOutputType::OPTIMIZED_ONLY; - } - if (StringUtil::Equals(value, "PHYSICAL_ONLY")) { - return ExplainOutputType::PHYSICAL_ONLY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExplainOutputTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetExplainTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExplainType::EXPLAIN_STANDARD), "EXPLAIN_STANDARD" }, + { static_cast(ExplainType::EXPLAIN_ANALYZE), "EXPLAIN_ANALYZE" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExplainType value) { - switch(value) { - case ExplainType::EXPLAIN_STANDARD: - return "EXPLAIN_STANDARD"; - case ExplainType::EXPLAIN_ANALYZE: - return "EXPLAIN_ANALYZE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExplainTypeValues(), 2, static_cast(value)); } template<> ExplainType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "EXPLAIN_STANDARD")) { - return ExplainType::EXPLAIN_STANDARD; - } - if (StringUtil::Equals(value, "EXPLAIN_ANALYZE")) { - return ExplainType::EXPLAIN_ANALYZE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExplainTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetExponentTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExponentType::NONE), "NONE" }, + { static_cast(ExponentType::POSITIVE), "POSITIVE" }, + { static_cast(ExponentType::NEGATIVE), "NEGATIVE" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExponentType value) { - switch(value) { - case ExponentType::NONE: - return "NONE"; - case ExponentType::POSITIVE: - return "POSITIVE"; - case ExponentType::NEGATIVE: - return "NEGATIVE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExponentTypeValues(), 3, static_cast(value)); } template<> ExponentType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NONE")) { - return ExponentType::NONE; - } - if (StringUtil::Equals(value, "POSITIVE")) { - return ExponentType::POSITIVE; - } - if (StringUtil::Equals(value, "NEGATIVE")) { - return ExponentType::NEGATIVE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExponentTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetExpressionClassValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExpressionClass::INVALID), "INVALID" }, + { static_cast(ExpressionClass::AGGREGATE), "AGGREGATE" }, + { static_cast(ExpressionClass::CASE), "CASE" }, + { static_cast(ExpressionClass::CAST), "CAST" }, + { static_cast(ExpressionClass::COLUMN_REF), "COLUMN_REF" }, + { static_cast(ExpressionClass::COMPARISON), "COMPARISON" }, + { static_cast(ExpressionClass::CONJUNCTION), "CONJUNCTION" }, + { static_cast(ExpressionClass::CONSTANT), "CONSTANT" }, + { static_cast(ExpressionClass::DEFAULT), "DEFAULT" }, + { static_cast(ExpressionClass::FUNCTION), "FUNCTION" }, + { static_cast(ExpressionClass::OPERATOR), "OPERATOR" }, + { static_cast(ExpressionClass::STAR), "STAR" }, + { static_cast(ExpressionClass::SUBQUERY), "SUBQUERY" }, + { static_cast(ExpressionClass::WINDOW), "WINDOW" }, + { static_cast(ExpressionClass::PARAMETER), "PARAMETER" }, + { static_cast(ExpressionClass::COLLATE), "COLLATE" }, + { static_cast(ExpressionClass::LAMBDA), "LAMBDA" }, + { static_cast(ExpressionClass::POSITIONAL_REFERENCE), "POSITIONAL_REFERENCE" }, + { static_cast(ExpressionClass::BETWEEN), "BETWEEN" }, + { static_cast(ExpressionClass::LAMBDA_REF), "LAMBDA_REF" }, + { static_cast(ExpressionClass::BOUND_AGGREGATE), "BOUND_AGGREGATE" }, + { static_cast(ExpressionClass::BOUND_CASE), "BOUND_CASE" }, + { static_cast(ExpressionClass::BOUND_CAST), "BOUND_CAST" }, + { static_cast(ExpressionClass::BOUND_COLUMN_REF), "BOUND_COLUMN_REF" }, + { static_cast(ExpressionClass::BOUND_COMPARISON), "BOUND_COMPARISON" }, + { static_cast(ExpressionClass::BOUND_CONJUNCTION), "BOUND_CONJUNCTION" }, + { static_cast(ExpressionClass::BOUND_CONSTANT), "BOUND_CONSTANT" }, + { static_cast(ExpressionClass::BOUND_DEFAULT), "BOUND_DEFAULT" }, + { static_cast(ExpressionClass::BOUND_FUNCTION), "BOUND_FUNCTION" }, + { static_cast(ExpressionClass::BOUND_OPERATOR), "BOUND_OPERATOR" }, + { static_cast(ExpressionClass::BOUND_PARAMETER), "BOUND_PARAMETER" }, + { static_cast(ExpressionClass::BOUND_REF), "BOUND_REF" }, + { static_cast(ExpressionClass::BOUND_SUBQUERY), "BOUND_SUBQUERY" }, + { static_cast(ExpressionClass::BOUND_WINDOW), "BOUND_WINDOW" }, + { static_cast(ExpressionClass::BOUND_BETWEEN), "BOUND_BETWEEN" }, + { static_cast(ExpressionClass::BOUND_UNNEST), "BOUND_UNNEST" }, + { static_cast(ExpressionClass::BOUND_LAMBDA), "BOUND_LAMBDA" }, + { static_cast(ExpressionClass::BOUND_LAMBDA_REF), "BOUND_LAMBDA_REF" }, + { static_cast(ExpressionClass::BOUND_EXPRESSION), "BOUND_EXPRESSION" }, + { static_cast(ExpressionClass::BOUND_EXPANDED), "BOUND_EXPANDED" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExpressionClass value) { - switch(value) { - case ExpressionClass::INVALID: - return "INVALID"; - case ExpressionClass::AGGREGATE: - return "AGGREGATE"; - case ExpressionClass::CASE: - return "CASE"; - case ExpressionClass::CAST: - return "CAST"; - case ExpressionClass::COLUMN_REF: - return "COLUMN_REF"; - case ExpressionClass::COMPARISON: - return "COMPARISON"; - case ExpressionClass::CONJUNCTION: - return "CONJUNCTION"; - case ExpressionClass::CONSTANT: - return "CONSTANT"; - case ExpressionClass::DEFAULT: - return "DEFAULT"; - case ExpressionClass::FUNCTION: - return "FUNCTION"; - case ExpressionClass::OPERATOR: - return "OPERATOR"; - case ExpressionClass::STAR: - return "STAR"; - case ExpressionClass::SUBQUERY: - return "SUBQUERY"; - case ExpressionClass::WINDOW: - return "WINDOW"; - case ExpressionClass::PARAMETER: - return "PARAMETER"; - case ExpressionClass::COLLATE: - return "COLLATE"; - case ExpressionClass::LAMBDA: - return "LAMBDA"; - case ExpressionClass::POSITIONAL_REFERENCE: - return "POSITIONAL_REFERENCE"; - case ExpressionClass::BETWEEN: - return "BETWEEN"; - case ExpressionClass::LAMBDA_REF: - return "LAMBDA_REF"; - case ExpressionClass::BOUND_AGGREGATE: - return "BOUND_AGGREGATE"; - case ExpressionClass::BOUND_CASE: - return "BOUND_CASE"; - case ExpressionClass::BOUND_CAST: - return "BOUND_CAST"; - case ExpressionClass::BOUND_COLUMN_REF: - return "BOUND_COLUMN_REF"; - case ExpressionClass::BOUND_COMPARISON: - return "BOUND_COMPARISON"; - case ExpressionClass::BOUND_CONJUNCTION: - return "BOUND_CONJUNCTION"; - case ExpressionClass::BOUND_CONSTANT: - return "BOUND_CONSTANT"; - case ExpressionClass::BOUND_DEFAULT: - return "BOUND_DEFAULT"; - case ExpressionClass::BOUND_FUNCTION: - return "BOUND_FUNCTION"; - case ExpressionClass::BOUND_OPERATOR: - return "BOUND_OPERATOR"; - case ExpressionClass::BOUND_PARAMETER: - return "BOUND_PARAMETER"; - case ExpressionClass::BOUND_REF: - return "BOUND_REF"; - case ExpressionClass::BOUND_SUBQUERY: - return "BOUND_SUBQUERY"; - case ExpressionClass::BOUND_WINDOW: - return "BOUND_WINDOW"; - case ExpressionClass::BOUND_BETWEEN: - return "BOUND_BETWEEN"; - case ExpressionClass::BOUND_UNNEST: - return "BOUND_UNNEST"; - case ExpressionClass::BOUND_LAMBDA: - return "BOUND_LAMBDA"; - case ExpressionClass::BOUND_LAMBDA_REF: - return "BOUND_LAMBDA_REF"; - case ExpressionClass::BOUND_EXPRESSION: - return "BOUND_EXPRESSION"; - case ExpressionClass::BOUND_EXPANDED: - return "BOUND_EXPANDED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExpressionClassValues(), 40, static_cast(value)); } template<> ExpressionClass EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return ExpressionClass::INVALID; - } - if (StringUtil::Equals(value, "AGGREGATE")) { - return ExpressionClass::AGGREGATE; - } - if (StringUtil::Equals(value, "CASE")) { - return ExpressionClass::CASE; - } - if (StringUtil::Equals(value, "CAST")) { - return ExpressionClass::CAST; - } - if (StringUtil::Equals(value, "COLUMN_REF")) { - return ExpressionClass::COLUMN_REF; - } - if (StringUtil::Equals(value, "COMPARISON")) { - return ExpressionClass::COMPARISON; - } - if (StringUtil::Equals(value, "CONJUNCTION")) { - return ExpressionClass::CONJUNCTION; - } - if (StringUtil::Equals(value, "CONSTANT")) { - return ExpressionClass::CONSTANT; - } - if (StringUtil::Equals(value, "DEFAULT")) { - return ExpressionClass::DEFAULT; - } - if (StringUtil::Equals(value, "FUNCTION")) { - return ExpressionClass::FUNCTION; - } - if (StringUtil::Equals(value, "OPERATOR")) { - return ExpressionClass::OPERATOR; - } - if (StringUtil::Equals(value, "STAR")) { - return ExpressionClass::STAR; - } - if (StringUtil::Equals(value, "SUBQUERY")) { - return ExpressionClass::SUBQUERY; - } - if (StringUtil::Equals(value, "WINDOW")) { - return ExpressionClass::WINDOW; - } - if (StringUtil::Equals(value, "PARAMETER")) { - return ExpressionClass::PARAMETER; - } - if (StringUtil::Equals(value, "COLLATE")) { - return ExpressionClass::COLLATE; - } - if (StringUtil::Equals(value, "LAMBDA")) { - return ExpressionClass::LAMBDA; - } - if (StringUtil::Equals(value, "POSITIONAL_REFERENCE")) { - return ExpressionClass::POSITIONAL_REFERENCE; - } - if (StringUtil::Equals(value, "BETWEEN")) { - return ExpressionClass::BETWEEN; - } - if (StringUtil::Equals(value, "LAMBDA_REF")) { - return ExpressionClass::LAMBDA_REF; - } - if (StringUtil::Equals(value, "BOUND_AGGREGATE")) { - return ExpressionClass::BOUND_AGGREGATE; - } - if (StringUtil::Equals(value, "BOUND_CASE")) { - return ExpressionClass::BOUND_CASE; - } - if (StringUtil::Equals(value, "BOUND_CAST")) { - return ExpressionClass::BOUND_CAST; - } - if (StringUtil::Equals(value, "BOUND_COLUMN_REF")) { - return ExpressionClass::BOUND_COLUMN_REF; - } - if (StringUtil::Equals(value, "BOUND_COMPARISON")) { - return ExpressionClass::BOUND_COMPARISON; - } - if (StringUtil::Equals(value, "BOUND_CONJUNCTION")) { - return ExpressionClass::BOUND_CONJUNCTION; - } - if (StringUtil::Equals(value, "BOUND_CONSTANT")) { - return ExpressionClass::BOUND_CONSTANT; - } - if (StringUtil::Equals(value, "BOUND_DEFAULT")) { - return ExpressionClass::BOUND_DEFAULT; - } - if (StringUtil::Equals(value, "BOUND_FUNCTION")) { - return ExpressionClass::BOUND_FUNCTION; - } - if (StringUtil::Equals(value, "BOUND_OPERATOR")) { - return ExpressionClass::BOUND_OPERATOR; - } - if (StringUtil::Equals(value, "BOUND_PARAMETER")) { - return ExpressionClass::BOUND_PARAMETER; - } - if (StringUtil::Equals(value, "BOUND_REF")) { - return ExpressionClass::BOUND_REF; - } - if (StringUtil::Equals(value, "BOUND_SUBQUERY")) { - return ExpressionClass::BOUND_SUBQUERY; - } - if (StringUtil::Equals(value, "BOUND_WINDOW")) { - return ExpressionClass::BOUND_WINDOW; - } - if (StringUtil::Equals(value, "BOUND_BETWEEN")) { - return ExpressionClass::BOUND_BETWEEN; - } - if (StringUtil::Equals(value, "BOUND_UNNEST")) { - return ExpressionClass::BOUND_UNNEST; - } - if (StringUtil::Equals(value, "BOUND_LAMBDA")) { - return ExpressionClass::BOUND_LAMBDA; - } - if (StringUtil::Equals(value, "BOUND_LAMBDA_REF")) { - return ExpressionClass::BOUND_LAMBDA_REF; - } - if (StringUtil::Equals(value, "BOUND_EXPRESSION")) { - return ExpressionClass::BOUND_EXPRESSION; - } - if (StringUtil::Equals(value, "BOUND_EXPANDED")) { - return ExpressionClass::BOUND_EXPANDED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExpressionClassValues(), 40, value)); +} + +const StringUtil::EnumStringLiteral *GetExpressionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExpressionType::INVALID), "INVALID" }, + { static_cast(ExpressionType::OPERATOR_CAST), "OPERATOR_CAST" }, + { static_cast(ExpressionType::OPERATOR_NOT), "OPERATOR_NOT" }, + { static_cast(ExpressionType::OPERATOR_IS_NULL), "OPERATOR_IS_NULL" }, + { static_cast(ExpressionType::OPERATOR_IS_NOT_NULL), "OPERATOR_IS_NOT_NULL" }, + { static_cast(ExpressionType::COMPARE_EQUAL), "COMPARE_EQUAL" }, + { static_cast(ExpressionType::COMPARE_NOTEQUAL), "COMPARE_NOTEQUAL" }, + { static_cast(ExpressionType::COMPARE_LESSTHAN), "COMPARE_LESSTHAN" }, + { static_cast(ExpressionType::COMPARE_GREATERTHAN), "COMPARE_GREATERTHAN" }, + { static_cast(ExpressionType::COMPARE_LESSTHANOREQUALTO), "COMPARE_LESSTHANOREQUALTO" }, + { static_cast(ExpressionType::COMPARE_GREATERTHANOREQUALTO), "COMPARE_GREATERTHANOREQUALTO" }, + { static_cast(ExpressionType::COMPARE_IN), "COMPARE_IN" }, + { static_cast(ExpressionType::COMPARE_NOT_IN), "COMPARE_NOT_IN" }, + { static_cast(ExpressionType::COMPARE_DISTINCT_FROM), "COMPARE_DISTINCT_FROM" }, + { static_cast(ExpressionType::COMPARE_BETWEEN), "COMPARE_BETWEEN" }, + { static_cast(ExpressionType::COMPARE_NOT_BETWEEN), "COMPARE_NOT_BETWEEN" }, + { static_cast(ExpressionType::COMPARE_NOT_DISTINCT_FROM), "COMPARE_NOT_DISTINCT_FROM" }, + { static_cast(ExpressionType::CONJUNCTION_AND), "CONJUNCTION_AND" }, + { static_cast(ExpressionType::CONJUNCTION_OR), "CONJUNCTION_OR" }, + { static_cast(ExpressionType::VALUE_CONSTANT), "VALUE_CONSTANT" }, + { static_cast(ExpressionType::VALUE_PARAMETER), "VALUE_PARAMETER" }, + { static_cast(ExpressionType::VALUE_TUPLE), "VALUE_TUPLE" }, + { static_cast(ExpressionType::VALUE_TUPLE_ADDRESS), "VALUE_TUPLE_ADDRESS" }, + { static_cast(ExpressionType::VALUE_NULL), "VALUE_NULL" }, + { static_cast(ExpressionType::VALUE_VECTOR), "VALUE_VECTOR" }, + { static_cast(ExpressionType::VALUE_SCALAR), "VALUE_SCALAR" }, + { static_cast(ExpressionType::VALUE_DEFAULT), "VALUE_DEFAULT" }, + { static_cast(ExpressionType::AGGREGATE), "AGGREGATE" }, + { static_cast(ExpressionType::BOUND_AGGREGATE), "BOUND_AGGREGATE" }, + { static_cast(ExpressionType::GROUPING_FUNCTION), "GROUPING_FUNCTION" }, + { static_cast(ExpressionType::WINDOW_AGGREGATE), "WINDOW_AGGREGATE" }, + { static_cast(ExpressionType::WINDOW_RANK), "WINDOW_RANK" }, + { static_cast(ExpressionType::WINDOW_RANK_DENSE), "WINDOW_RANK_DENSE" }, + { static_cast(ExpressionType::WINDOW_NTILE), "WINDOW_NTILE" }, + { static_cast(ExpressionType::WINDOW_PERCENT_RANK), "WINDOW_PERCENT_RANK" }, + { static_cast(ExpressionType::WINDOW_CUME_DIST), "WINDOW_CUME_DIST" }, + { static_cast(ExpressionType::WINDOW_ROW_NUMBER), "WINDOW_ROW_NUMBER" }, + { static_cast(ExpressionType::WINDOW_FIRST_VALUE), "WINDOW_FIRST_VALUE" }, + { static_cast(ExpressionType::WINDOW_LAST_VALUE), "WINDOW_LAST_VALUE" }, + { static_cast(ExpressionType::WINDOW_LEAD), "WINDOW_LEAD" }, + { static_cast(ExpressionType::WINDOW_LAG), "WINDOW_LAG" }, + { static_cast(ExpressionType::WINDOW_NTH_VALUE), "WINDOW_NTH_VALUE" }, + { static_cast(ExpressionType::FUNCTION), "FUNCTION" }, + { static_cast(ExpressionType::BOUND_FUNCTION), "BOUND_FUNCTION" }, + { static_cast(ExpressionType::CASE_EXPR), "CASE_EXPR" }, + { static_cast(ExpressionType::OPERATOR_NULLIF), "OPERATOR_NULLIF" }, + { static_cast(ExpressionType::OPERATOR_COALESCE), "OPERATOR_COALESCE" }, + { static_cast(ExpressionType::ARRAY_EXTRACT), "ARRAY_EXTRACT" }, + { static_cast(ExpressionType::ARRAY_SLICE), "ARRAY_SLICE" }, + { static_cast(ExpressionType::STRUCT_EXTRACT), "STRUCT_EXTRACT" }, + { static_cast(ExpressionType::ARRAY_CONSTRUCTOR), "ARRAY_CONSTRUCTOR" }, + { static_cast(ExpressionType::ARROW), "ARROW" }, + { static_cast(ExpressionType::SUBQUERY), "SUBQUERY" }, + { static_cast(ExpressionType::STAR), "STAR" }, + { static_cast(ExpressionType::TABLE_STAR), "TABLE_STAR" }, + { static_cast(ExpressionType::PLACEHOLDER), "PLACEHOLDER" }, + { static_cast(ExpressionType::COLUMN_REF), "COLUMN_REF" }, + { static_cast(ExpressionType::FUNCTION_REF), "FUNCTION_REF" }, + { static_cast(ExpressionType::TABLE_REF), "TABLE_REF" }, + { static_cast(ExpressionType::LAMBDA_REF), "LAMBDA_REF" }, + { static_cast(ExpressionType::CAST), "CAST" }, + { static_cast(ExpressionType::BOUND_REF), "BOUND_REF" }, + { static_cast(ExpressionType::BOUND_COLUMN_REF), "BOUND_COLUMN_REF" }, + { static_cast(ExpressionType::BOUND_UNNEST), "BOUND_UNNEST" }, + { static_cast(ExpressionType::COLLATE), "COLLATE" }, + { static_cast(ExpressionType::LAMBDA), "LAMBDA" }, + { static_cast(ExpressionType::POSITIONAL_REFERENCE), "POSITIONAL_REFERENCE" }, + { static_cast(ExpressionType::BOUND_LAMBDA_REF), "BOUND_LAMBDA_REF" }, + { static_cast(ExpressionType::BOUND_EXPANDED), "BOUND_EXPANDED" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExpressionType value) { - switch(value) { - case ExpressionType::INVALID: - return "INVALID"; - case ExpressionType::OPERATOR_CAST: - return "OPERATOR_CAST"; - case ExpressionType::OPERATOR_NOT: - return "OPERATOR_NOT"; - case ExpressionType::OPERATOR_IS_NULL: - return "OPERATOR_IS_NULL"; - case ExpressionType::OPERATOR_IS_NOT_NULL: - return "OPERATOR_IS_NOT_NULL"; - case ExpressionType::COMPARE_EQUAL: - return "COMPARE_EQUAL"; - case ExpressionType::COMPARE_NOTEQUAL: - return "COMPARE_NOTEQUAL"; - case ExpressionType::COMPARE_LESSTHAN: - return "COMPARE_LESSTHAN"; - case ExpressionType::COMPARE_GREATERTHAN: - return "COMPARE_GREATERTHAN"; - case ExpressionType::COMPARE_LESSTHANOREQUALTO: - return "COMPARE_LESSTHANOREQUALTO"; - case ExpressionType::COMPARE_GREATERTHANOREQUALTO: - return "COMPARE_GREATERTHANOREQUALTO"; - case ExpressionType::COMPARE_IN: - return "COMPARE_IN"; - case ExpressionType::COMPARE_NOT_IN: - return "COMPARE_NOT_IN"; - case ExpressionType::COMPARE_DISTINCT_FROM: - return "COMPARE_DISTINCT_FROM"; - case ExpressionType::COMPARE_BETWEEN: - return "COMPARE_BETWEEN"; - case ExpressionType::COMPARE_NOT_BETWEEN: - return "COMPARE_NOT_BETWEEN"; - case ExpressionType::COMPARE_NOT_DISTINCT_FROM: - return "COMPARE_NOT_DISTINCT_FROM"; - case ExpressionType::CONJUNCTION_AND: - return "CONJUNCTION_AND"; - case ExpressionType::CONJUNCTION_OR: - return "CONJUNCTION_OR"; - case ExpressionType::VALUE_CONSTANT: - return "VALUE_CONSTANT"; - case ExpressionType::VALUE_PARAMETER: - return "VALUE_PARAMETER"; - case ExpressionType::VALUE_TUPLE: - return "VALUE_TUPLE"; - case ExpressionType::VALUE_TUPLE_ADDRESS: - return "VALUE_TUPLE_ADDRESS"; - case ExpressionType::VALUE_NULL: - return "VALUE_NULL"; - case ExpressionType::VALUE_VECTOR: - return "VALUE_VECTOR"; - case ExpressionType::VALUE_SCALAR: - return "VALUE_SCALAR"; - case ExpressionType::VALUE_DEFAULT: - return "VALUE_DEFAULT"; - case ExpressionType::AGGREGATE: - return "AGGREGATE"; - case ExpressionType::BOUND_AGGREGATE: - return "BOUND_AGGREGATE"; - case ExpressionType::GROUPING_FUNCTION: - return "GROUPING_FUNCTION"; - case ExpressionType::WINDOW_AGGREGATE: - return "WINDOW_AGGREGATE"; - case ExpressionType::WINDOW_RANK: - return "WINDOW_RANK"; - case ExpressionType::WINDOW_RANK_DENSE: - return "WINDOW_RANK_DENSE"; - case ExpressionType::WINDOW_NTILE: - return "WINDOW_NTILE"; - case ExpressionType::WINDOW_PERCENT_RANK: - return "WINDOW_PERCENT_RANK"; - case ExpressionType::WINDOW_CUME_DIST: - return "WINDOW_CUME_DIST"; - case ExpressionType::WINDOW_ROW_NUMBER: - return "WINDOW_ROW_NUMBER"; - case ExpressionType::WINDOW_FIRST_VALUE: - return "WINDOW_FIRST_VALUE"; - case ExpressionType::WINDOW_LAST_VALUE: - return "WINDOW_LAST_VALUE"; - case ExpressionType::WINDOW_LEAD: - return "WINDOW_LEAD"; - case ExpressionType::WINDOW_LAG: - return "WINDOW_LAG"; - case ExpressionType::WINDOW_NTH_VALUE: - return "WINDOW_NTH_VALUE"; - case ExpressionType::FUNCTION: - return "FUNCTION"; - case ExpressionType::BOUND_FUNCTION: - return "BOUND_FUNCTION"; - case ExpressionType::CASE_EXPR: - return "CASE_EXPR"; - case ExpressionType::OPERATOR_NULLIF: - return "OPERATOR_NULLIF"; - case ExpressionType::OPERATOR_COALESCE: - return "OPERATOR_COALESCE"; - case ExpressionType::ARRAY_EXTRACT: - return "ARRAY_EXTRACT"; - case ExpressionType::ARRAY_SLICE: - return "ARRAY_SLICE"; - case ExpressionType::STRUCT_EXTRACT: - return "STRUCT_EXTRACT"; - case ExpressionType::ARRAY_CONSTRUCTOR: - return "ARRAY_CONSTRUCTOR"; - case ExpressionType::ARROW: - return "ARROW"; - case ExpressionType::SUBQUERY: - return "SUBQUERY"; - case ExpressionType::STAR: - return "STAR"; - case ExpressionType::TABLE_STAR: - return "TABLE_STAR"; - case ExpressionType::PLACEHOLDER: - return "PLACEHOLDER"; - case ExpressionType::COLUMN_REF: - return "COLUMN_REF"; - case ExpressionType::FUNCTION_REF: - return "FUNCTION_REF"; - case ExpressionType::TABLE_REF: - return "TABLE_REF"; - case ExpressionType::LAMBDA_REF: - return "LAMBDA_REF"; - case ExpressionType::CAST: - return "CAST"; - case ExpressionType::BOUND_REF: - return "BOUND_REF"; - case ExpressionType::BOUND_COLUMN_REF: - return "BOUND_COLUMN_REF"; - case ExpressionType::BOUND_UNNEST: - return "BOUND_UNNEST"; - case ExpressionType::COLLATE: - return "COLLATE"; - case ExpressionType::LAMBDA: - return "LAMBDA"; - case ExpressionType::POSITIONAL_REFERENCE: - return "POSITIONAL_REFERENCE"; - case ExpressionType::BOUND_LAMBDA_REF: - return "BOUND_LAMBDA_REF"; - case ExpressionType::BOUND_EXPANDED: - return "BOUND_EXPANDED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExpressionTypeValues(), 69, static_cast(value)); } template<> ExpressionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return ExpressionType::INVALID; - } - if (StringUtil::Equals(value, "OPERATOR_CAST")) { - return ExpressionType::OPERATOR_CAST; - } - if (StringUtil::Equals(value, "OPERATOR_NOT")) { - return ExpressionType::OPERATOR_NOT; - } - if (StringUtil::Equals(value, "OPERATOR_IS_NULL")) { - return ExpressionType::OPERATOR_IS_NULL; - } - if (StringUtil::Equals(value, "OPERATOR_IS_NOT_NULL")) { - return ExpressionType::OPERATOR_IS_NOT_NULL; - } - if (StringUtil::Equals(value, "COMPARE_EQUAL")) { - return ExpressionType::COMPARE_EQUAL; - } - if (StringUtil::Equals(value, "COMPARE_NOTEQUAL")) { - return ExpressionType::COMPARE_NOTEQUAL; - } - if (StringUtil::Equals(value, "COMPARE_LESSTHAN")) { - return ExpressionType::COMPARE_LESSTHAN; - } - if (StringUtil::Equals(value, "COMPARE_GREATERTHAN")) { - return ExpressionType::COMPARE_GREATERTHAN; - } - if (StringUtil::Equals(value, "COMPARE_LESSTHANOREQUALTO")) { - return ExpressionType::COMPARE_LESSTHANOREQUALTO; - } - if (StringUtil::Equals(value, "COMPARE_GREATERTHANOREQUALTO")) { - return ExpressionType::COMPARE_GREATERTHANOREQUALTO; - } - if (StringUtil::Equals(value, "COMPARE_IN")) { - return ExpressionType::COMPARE_IN; - } - if (StringUtil::Equals(value, "COMPARE_NOT_IN")) { - return ExpressionType::COMPARE_NOT_IN; - } - if (StringUtil::Equals(value, "COMPARE_DISTINCT_FROM")) { - return ExpressionType::COMPARE_DISTINCT_FROM; - } - if (StringUtil::Equals(value, "COMPARE_BETWEEN")) { - return ExpressionType::COMPARE_BETWEEN; - } - if (StringUtil::Equals(value, "COMPARE_NOT_BETWEEN")) { - return ExpressionType::COMPARE_NOT_BETWEEN; - } - if (StringUtil::Equals(value, "COMPARE_NOT_DISTINCT_FROM")) { - return ExpressionType::COMPARE_NOT_DISTINCT_FROM; - } - if (StringUtil::Equals(value, "CONJUNCTION_AND")) { - return ExpressionType::CONJUNCTION_AND; - } - if (StringUtil::Equals(value, "CONJUNCTION_OR")) { - return ExpressionType::CONJUNCTION_OR; - } - if (StringUtil::Equals(value, "VALUE_CONSTANT")) { - return ExpressionType::VALUE_CONSTANT; - } - if (StringUtil::Equals(value, "VALUE_PARAMETER")) { - return ExpressionType::VALUE_PARAMETER; - } - if (StringUtil::Equals(value, "VALUE_TUPLE")) { - return ExpressionType::VALUE_TUPLE; - } - if (StringUtil::Equals(value, "VALUE_TUPLE_ADDRESS")) { - return ExpressionType::VALUE_TUPLE_ADDRESS; - } - if (StringUtil::Equals(value, "VALUE_NULL")) { - return ExpressionType::VALUE_NULL; - } - if (StringUtil::Equals(value, "VALUE_VECTOR")) { - return ExpressionType::VALUE_VECTOR; - } - if (StringUtil::Equals(value, "VALUE_SCALAR")) { - return ExpressionType::VALUE_SCALAR; - } - if (StringUtil::Equals(value, "VALUE_DEFAULT")) { - return ExpressionType::VALUE_DEFAULT; - } - if (StringUtil::Equals(value, "AGGREGATE")) { - return ExpressionType::AGGREGATE; - } - if (StringUtil::Equals(value, "BOUND_AGGREGATE")) { - return ExpressionType::BOUND_AGGREGATE; - } - if (StringUtil::Equals(value, "GROUPING_FUNCTION")) { - return ExpressionType::GROUPING_FUNCTION; - } - if (StringUtil::Equals(value, "WINDOW_AGGREGATE")) { - return ExpressionType::WINDOW_AGGREGATE; - } - if (StringUtil::Equals(value, "WINDOW_RANK")) { - return ExpressionType::WINDOW_RANK; - } - if (StringUtil::Equals(value, "WINDOW_RANK_DENSE")) { - return ExpressionType::WINDOW_RANK_DENSE; - } - if (StringUtil::Equals(value, "WINDOW_NTILE")) { - return ExpressionType::WINDOW_NTILE; - } - if (StringUtil::Equals(value, "WINDOW_PERCENT_RANK")) { - return ExpressionType::WINDOW_PERCENT_RANK; - } - if (StringUtil::Equals(value, "WINDOW_CUME_DIST")) { - return ExpressionType::WINDOW_CUME_DIST; - } - if (StringUtil::Equals(value, "WINDOW_ROW_NUMBER")) { - return ExpressionType::WINDOW_ROW_NUMBER; - } - if (StringUtil::Equals(value, "WINDOW_FIRST_VALUE")) { - return ExpressionType::WINDOW_FIRST_VALUE; - } - if (StringUtil::Equals(value, "WINDOW_LAST_VALUE")) { - return ExpressionType::WINDOW_LAST_VALUE; - } - if (StringUtil::Equals(value, "WINDOW_LEAD")) { - return ExpressionType::WINDOW_LEAD; - } - if (StringUtil::Equals(value, "WINDOW_LAG")) { - return ExpressionType::WINDOW_LAG; - } - if (StringUtil::Equals(value, "WINDOW_NTH_VALUE")) { - return ExpressionType::WINDOW_NTH_VALUE; - } - if (StringUtil::Equals(value, "FUNCTION")) { - return ExpressionType::FUNCTION; - } - if (StringUtil::Equals(value, "BOUND_FUNCTION")) { - return ExpressionType::BOUND_FUNCTION; - } - if (StringUtil::Equals(value, "CASE_EXPR")) { - return ExpressionType::CASE_EXPR; - } - if (StringUtil::Equals(value, "OPERATOR_NULLIF")) { - return ExpressionType::OPERATOR_NULLIF; - } - if (StringUtil::Equals(value, "OPERATOR_COALESCE")) { - return ExpressionType::OPERATOR_COALESCE; - } - if (StringUtil::Equals(value, "ARRAY_EXTRACT")) { - return ExpressionType::ARRAY_EXTRACT; - } - if (StringUtil::Equals(value, "ARRAY_SLICE")) { - return ExpressionType::ARRAY_SLICE; - } - if (StringUtil::Equals(value, "STRUCT_EXTRACT")) { - return ExpressionType::STRUCT_EXTRACT; - } - if (StringUtil::Equals(value, "ARRAY_CONSTRUCTOR")) { - return ExpressionType::ARRAY_CONSTRUCTOR; - } - if (StringUtil::Equals(value, "ARROW")) { - return ExpressionType::ARROW; - } - if (StringUtil::Equals(value, "SUBQUERY")) { - return ExpressionType::SUBQUERY; - } - if (StringUtil::Equals(value, "STAR")) { - return ExpressionType::STAR; - } - if (StringUtil::Equals(value, "TABLE_STAR")) { - return ExpressionType::TABLE_STAR; - } - if (StringUtil::Equals(value, "PLACEHOLDER")) { - return ExpressionType::PLACEHOLDER; - } - if (StringUtil::Equals(value, "COLUMN_REF")) { - return ExpressionType::COLUMN_REF; - } - if (StringUtil::Equals(value, "FUNCTION_REF")) { - return ExpressionType::FUNCTION_REF; - } - if (StringUtil::Equals(value, "TABLE_REF")) { - return ExpressionType::TABLE_REF; - } - if (StringUtil::Equals(value, "LAMBDA_REF")) { - return ExpressionType::LAMBDA_REF; - } - if (StringUtil::Equals(value, "CAST")) { - return ExpressionType::CAST; - } - if (StringUtil::Equals(value, "BOUND_REF")) { - return ExpressionType::BOUND_REF; - } - if (StringUtil::Equals(value, "BOUND_COLUMN_REF")) { - return ExpressionType::BOUND_COLUMN_REF; - } - if (StringUtil::Equals(value, "BOUND_UNNEST")) { - return ExpressionType::BOUND_UNNEST; - } - if (StringUtil::Equals(value, "COLLATE")) { - return ExpressionType::COLLATE; - } - if (StringUtil::Equals(value, "LAMBDA")) { - return ExpressionType::LAMBDA; - } - if (StringUtil::Equals(value, "POSITIONAL_REFERENCE")) { - return ExpressionType::POSITIONAL_REFERENCE; - } - if (StringUtil::Equals(value, "BOUND_LAMBDA_REF")) { - return ExpressionType::BOUND_LAMBDA_REF; - } - if (StringUtil::Equals(value, "BOUND_EXPANDED")) { - return ExpressionType::BOUND_EXPANDED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExpressionTypeValues(), 69, value)); +} + +const StringUtil::EnumStringLiteral *GetExtensionABITypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtensionABIType::UNKNOWN), "UNKNOWN" }, + { static_cast(ExtensionABIType::CPP), "CPP" }, + { static_cast(ExtensionABIType::C_STRUCT), "C_STRUCT" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExtensionABIType value) { - switch(value) { - case ExtensionABIType::UNKNOWN: - return "UNKNOWN"; - case ExtensionABIType::CPP: - return "CPP"; - case ExtensionABIType::C_STRUCT: - return "C_STRUCT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExtensionABITypeValues(), 3, static_cast(value)); } template<> ExtensionABIType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "UNKNOWN")) { - return ExtensionABIType::UNKNOWN; - } - if (StringUtil::Equals(value, "CPP")) { - return ExtensionABIType::CPP; - } - if (StringUtil::Equals(value, "C_STRUCT")) { - return ExtensionABIType::C_STRUCT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExtensionABITypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetExtensionInstallModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtensionInstallMode::UNKNOWN), "UNKNOWN" }, + { static_cast(ExtensionInstallMode::REPOSITORY), "REPOSITORY" }, + { static_cast(ExtensionInstallMode::CUSTOM_PATH), "CUSTOM_PATH" }, + { static_cast(ExtensionInstallMode::STATICALLY_LINKED), "STATICALLY_LINKED" }, + { static_cast(ExtensionInstallMode::NOT_INSTALLED), "NOT_INSTALLED" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExtensionInstallMode value) { - switch(value) { - case ExtensionInstallMode::UNKNOWN: - return "UNKNOWN"; - case ExtensionInstallMode::REPOSITORY: - return "REPOSITORY"; - case ExtensionInstallMode::CUSTOM_PATH: - return "CUSTOM_PATH"; - case ExtensionInstallMode::STATICALLY_LINKED: - return "STATICALLY_LINKED"; - case ExtensionInstallMode::NOT_INSTALLED: - return "NOT_INSTALLED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExtensionInstallModeValues(), 5, static_cast(value)); } template<> ExtensionInstallMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "UNKNOWN")) { - return ExtensionInstallMode::UNKNOWN; - } - if (StringUtil::Equals(value, "REPOSITORY")) { - return ExtensionInstallMode::REPOSITORY; - } - if (StringUtil::Equals(value, "CUSTOM_PATH")) { - return ExtensionInstallMode::CUSTOM_PATH; - } - if (StringUtil::Equals(value, "STATICALLY_LINKED")) { - return ExtensionInstallMode::STATICALLY_LINKED; - } - if (StringUtil::Equals(value, "NOT_INSTALLED")) { - return ExtensionInstallMode::NOT_INSTALLED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExtensionInstallModeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetExtensionLoadResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtensionLoadResult::LOADED_EXTENSION), "LOADED_EXTENSION" }, + { static_cast(ExtensionLoadResult::EXTENSION_UNKNOWN), "EXTENSION_UNKNOWN" }, + { static_cast(ExtensionLoadResult::NOT_LOADED), "NOT_LOADED" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExtensionLoadResult value) { - switch(value) { - case ExtensionLoadResult::LOADED_EXTENSION: - return "LOADED_EXTENSION"; - case ExtensionLoadResult::EXTENSION_UNKNOWN: - return "EXTENSION_UNKNOWN"; - case ExtensionLoadResult::NOT_LOADED: - return "NOT_LOADED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExtensionLoadResultValues(), 3, static_cast(value)); } template<> ExtensionLoadResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LOADED_EXTENSION")) { - return ExtensionLoadResult::LOADED_EXTENSION; - } - if (StringUtil::Equals(value, "EXTENSION_UNKNOWN")) { - return ExtensionLoadResult::EXTENSION_UNKNOWN; - } - if (StringUtil::Equals(value, "NOT_LOADED")) { - return ExtensionLoadResult::NOT_LOADED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExtensionLoadResultValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetExtensionUpdateResultTagValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtensionUpdateResultTag::UNKNOWN), "UNKNOWN" }, + { static_cast(ExtensionUpdateResultTag::NO_UPDATE_AVAILABLE), "NO_UPDATE_AVAILABLE" }, + { static_cast(ExtensionUpdateResultTag::NOT_A_REPOSITORY), "NOT_A_REPOSITORY" }, + { static_cast(ExtensionUpdateResultTag::NOT_INSTALLED), "NOT_INSTALLED" }, + { static_cast(ExtensionUpdateResultTag::STATICALLY_LOADED), "STATICALLY_LOADED" }, + { static_cast(ExtensionUpdateResultTag::MISSING_INSTALL_INFO), "MISSING_INSTALL_INFO" }, + { static_cast(ExtensionUpdateResultTag::REDOWNLOADED), "REDOWNLOADED" }, + { static_cast(ExtensionUpdateResultTag::UPDATED), "UPDATED" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExtensionUpdateResultTag value) { - switch(value) { - case ExtensionUpdateResultTag::UNKNOWN: - return "UNKNOWN"; - case ExtensionUpdateResultTag::NO_UPDATE_AVAILABLE: - return "NO_UPDATE_AVAILABLE"; - case ExtensionUpdateResultTag::NOT_A_REPOSITORY: - return "NOT_A_REPOSITORY"; - case ExtensionUpdateResultTag::NOT_INSTALLED: - return "NOT_INSTALLED"; - case ExtensionUpdateResultTag::STATICALLY_LOADED: - return "STATICALLY_LOADED"; - case ExtensionUpdateResultTag::MISSING_INSTALL_INFO: - return "MISSING_INSTALL_INFO"; - case ExtensionUpdateResultTag::REDOWNLOADED: - return "REDOWNLOADED"; - case ExtensionUpdateResultTag::UPDATED: - return "UPDATED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExtensionUpdateResultTagValues(), 8, static_cast(value)); } template<> ExtensionUpdateResultTag EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "UNKNOWN")) { - return ExtensionUpdateResultTag::UNKNOWN; - } - if (StringUtil::Equals(value, "NO_UPDATE_AVAILABLE")) { - return ExtensionUpdateResultTag::NO_UPDATE_AVAILABLE; - } - if (StringUtil::Equals(value, "NOT_A_REPOSITORY")) { - return ExtensionUpdateResultTag::NOT_A_REPOSITORY; - } - if (StringUtil::Equals(value, "NOT_INSTALLED")) { - return ExtensionUpdateResultTag::NOT_INSTALLED; - } - if (StringUtil::Equals(value, "STATICALLY_LOADED")) { - return ExtensionUpdateResultTag::STATICALLY_LOADED; - } - if (StringUtil::Equals(value, "MISSING_INSTALL_INFO")) { - return ExtensionUpdateResultTag::MISSING_INSTALL_INFO; - } - if (StringUtil::Equals(value, "REDOWNLOADED")) { - return ExtensionUpdateResultTag::REDOWNLOADED; - } - if (StringUtil::Equals(value, "UPDATED")) { - return ExtensionUpdateResultTag::UPDATED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExtensionUpdateResultTagValues(), 8, value)); +} + +const StringUtil::EnumStringLiteral *GetExtraDropInfoTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtraDropInfoType::INVALID), "INVALID" }, + { static_cast(ExtraDropInfoType::SECRET_INFO), "SECRET_INFO" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExtraDropInfoType value) { - switch(value) { - case ExtraDropInfoType::INVALID: - return "INVALID"; - case ExtraDropInfoType::SECRET_INFO: - return "SECRET_INFO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExtraDropInfoTypeValues(), 2, static_cast(value)); } template<> ExtraDropInfoType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return ExtraDropInfoType::INVALID; - } - if (StringUtil::Equals(value, "SECRET_INFO")) { - return ExtraDropInfoType::SECRET_INFO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExtraDropInfoTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetExtraTypeInfoTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtraTypeInfoType::INVALID_TYPE_INFO), "INVALID_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::GENERIC_TYPE_INFO), "GENERIC_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::DECIMAL_TYPE_INFO), "DECIMAL_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::STRING_TYPE_INFO), "STRING_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::LIST_TYPE_INFO), "LIST_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::STRUCT_TYPE_INFO), "STRUCT_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::ENUM_TYPE_INFO), "ENUM_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::USER_TYPE_INFO), "USER_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO), "AGGREGATE_STATE_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::ARRAY_TYPE_INFO), "ARRAY_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::ANY_TYPE_INFO), "ANY_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::INTEGER_LITERAL_TYPE_INFO), "INTEGER_LITERAL_TYPE_INFO" } + }; + return values; } template<> const char* EnumUtil::ToChars(ExtraTypeInfoType value) { - switch(value) { - case ExtraTypeInfoType::INVALID_TYPE_INFO: - return "INVALID_TYPE_INFO"; - case ExtraTypeInfoType::GENERIC_TYPE_INFO: - return "GENERIC_TYPE_INFO"; - case ExtraTypeInfoType::DECIMAL_TYPE_INFO: - return "DECIMAL_TYPE_INFO"; - case ExtraTypeInfoType::STRING_TYPE_INFO: - return "STRING_TYPE_INFO"; - case ExtraTypeInfoType::LIST_TYPE_INFO: - return "LIST_TYPE_INFO"; - case ExtraTypeInfoType::STRUCT_TYPE_INFO: - return "STRUCT_TYPE_INFO"; - case ExtraTypeInfoType::ENUM_TYPE_INFO: - return "ENUM_TYPE_INFO"; - case ExtraTypeInfoType::USER_TYPE_INFO: - return "USER_TYPE_INFO"; - case ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO: - return "AGGREGATE_STATE_TYPE_INFO"; - case ExtraTypeInfoType::ARRAY_TYPE_INFO: - return "ARRAY_TYPE_INFO"; - case ExtraTypeInfoType::ANY_TYPE_INFO: - return "ANY_TYPE_INFO"; - case ExtraTypeInfoType::INTEGER_LITERAL_TYPE_INFO: - return "INTEGER_LITERAL_TYPE_INFO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetExtraTypeInfoTypeValues(), 12, static_cast(value)); } template<> ExtraTypeInfoType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID_TYPE_INFO")) { - return ExtraTypeInfoType::INVALID_TYPE_INFO; - } - if (StringUtil::Equals(value, "GENERIC_TYPE_INFO")) { - return ExtraTypeInfoType::GENERIC_TYPE_INFO; - } - if (StringUtil::Equals(value, "DECIMAL_TYPE_INFO")) { - return ExtraTypeInfoType::DECIMAL_TYPE_INFO; - } - if (StringUtil::Equals(value, "STRING_TYPE_INFO")) { - return ExtraTypeInfoType::STRING_TYPE_INFO; - } - if (StringUtil::Equals(value, "LIST_TYPE_INFO")) { - return ExtraTypeInfoType::LIST_TYPE_INFO; - } - if (StringUtil::Equals(value, "STRUCT_TYPE_INFO")) { - return ExtraTypeInfoType::STRUCT_TYPE_INFO; - } - if (StringUtil::Equals(value, "ENUM_TYPE_INFO")) { - return ExtraTypeInfoType::ENUM_TYPE_INFO; - } - if (StringUtil::Equals(value, "USER_TYPE_INFO")) { - return ExtraTypeInfoType::USER_TYPE_INFO; - } - if (StringUtil::Equals(value, "AGGREGATE_STATE_TYPE_INFO")) { - return ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO; - } - if (StringUtil::Equals(value, "ARRAY_TYPE_INFO")) { - return ExtraTypeInfoType::ARRAY_TYPE_INFO; - } - if (StringUtil::Equals(value, "ANY_TYPE_INFO")) { - return ExtraTypeInfoType::ANY_TYPE_INFO; - } - if (StringUtil::Equals(value, "INTEGER_LITERAL_TYPE_INFO")) { - return ExtraTypeInfoType::INTEGER_LITERAL_TYPE_INFO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetExtraTypeInfoTypeValues(), 12, value)); +} + +const StringUtil::EnumStringLiteral *GetFileBufferTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FileBufferType::BLOCK), "BLOCK" }, + { static_cast(FileBufferType::MANAGED_BUFFER), "MANAGED_BUFFER" }, + { static_cast(FileBufferType::TINY_BUFFER), "TINY_BUFFER" } + }; + return values; } template<> const char* EnumUtil::ToChars(FileBufferType value) { - switch(value) { - case FileBufferType::BLOCK: - return "BLOCK"; - case FileBufferType::MANAGED_BUFFER: - return "MANAGED_BUFFER"; - case FileBufferType::TINY_BUFFER: - return "TINY_BUFFER"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFileBufferTypeValues(), 3, static_cast(value)); } template<> FileBufferType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BLOCK")) { - return FileBufferType::BLOCK; - } - if (StringUtil::Equals(value, "MANAGED_BUFFER")) { - return FileBufferType::MANAGED_BUFFER; - } - if (StringUtil::Equals(value, "TINY_BUFFER")) { - return FileBufferType::TINY_BUFFER; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFileBufferTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetFileCompressionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FileCompressionType::AUTO_DETECT), "AUTO_DETECT" }, + { static_cast(FileCompressionType::UNCOMPRESSED), "UNCOMPRESSED" }, + { static_cast(FileCompressionType::GZIP), "GZIP" }, + { static_cast(FileCompressionType::ZSTD), "ZSTD" } + }; + return values; } template<> const char* EnumUtil::ToChars(FileCompressionType value) { - switch(value) { - case FileCompressionType::AUTO_DETECT: - return "AUTO_DETECT"; - case FileCompressionType::UNCOMPRESSED: - return "UNCOMPRESSED"; - case FileCompressionType::GZIP: - return "GZIP"; - case FileCompressionType::ZSTD: - return "ZSTD"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFileCompressionTypeValues(), 4, static_cast(value)); } template<> FileCompressionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "AUTO_DETECT")) { - return FileCompressionType::AUTO_DETECT; - } - if (StringUtil::Equals(value, "UNCOMPRESSED")) { - return FileCompressionType::UNCOMPRESSED; - } - if (StringUtil::Equals(value, "GZIP")) { - return FileCompressionType::GZIP; - } - if (StringUtil::Equals(value, "ZSTD")) { - return FileCompressionType::ZSTD; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFileCompressionTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetFileExpandResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FileExpandResult::NO_FILES), "NO_FILES" }, + { static_cast(FileExpandResult::SINGLE_FILE), "SINGLE_FILE" }, + { static_cast(FileExpandResult::MULTIPLE_FILES), "MULTIPLE_FILES" } + }; + return values; } template<> const char* EnumUtil::ToChars(FileExpandResult value) { - switch(value) { - case FileExpandResult::NO_FILES: - return "NO_FILES"; - case FileExpandResult::SINGLE_FILE: - return "SINGLE_FILE"; - case FileExpandResult::MULTIPLE_FILES: - return "MULTIPLE_FILES"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFileExpandResultValues(), 3, static_cast(value)); } template<> FileExpandResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_FILES")) { - return FileExpandResult::NO_FILES; - } - if (StringUtil::Equals(value, "SINGLE_FILE")) { - return FileExpandResult::SINGLE_FILE; - } - if (StringUtil::Equals(value, "MULTIPLE_FILES")) { - return FileExpandResult::MULTIPLE_FILES; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFileExpandResultValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetFileGlobOptionsValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FileGlobOptions::DISALLOW_EMPTY), "DISALLOW_EMPTY" }, + { static_cast(FileGlobOptions::ALLOW_EMPTY), "ALLOW_EMPTY" } + }; + return values; } template<> const char* EnumUtil::ToChars(FileGlobOptions value) { - switch(value) { - case FileGlobOptions::DISALLOW_EMPTY: - return "DISALLOW_EMPTY"; - case FileGlobOptions::ALLOW_EMPTY: - return "ALLOW_EMPTY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFileGlobOptionsValues(), 2, static_cast(value)); } template<> FileGlobOptions EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "DISALLOW_EMPTY")) { - return FileGlobOptions::DISALLOW_EMPTY; - } - if (StringUtil::Equals(value, "ALLOW_EMPTY")) { - return FileGlobOptions::ALLOW_EMPTY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFileGlobOptionsValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetFileLockTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FileLockType::NO_LOCK), "NO_LOCK" }, + { static_cast(FileLockType::READ_LOCK), "READ_LOCK" }, + { static_cast(FileLockType::WRITE_LOCK), "WRITE_LOCK" } + }; + return values; } template<> const char* EnumUtil::ToChars(FileLockType value) { - switch(value) { - case FileLockType::NO_LOCK: - return "NO_LOCK"; - case FileLockType::READ_LOCK: - return "READ_LOCK"; - case FileLockType::WRITE_LOCK: - return "WRITE_LOCK"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFileLockTypeValues(), 3, static_cast(value)); } template<> FileLockType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_LOCK")) { - return FileLockType::NO_LOCK; - } - if (StringUtil::Equals(value, "READ_LOCK")) { - return FileLockType::READ_LOCK; - } - if (StringUtil::Equals(value, "WRITE_LOCK")) { - return FileLockType::WRITE_LOCK; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFileLockTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetFilterPropagateResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FilterPropagateResult::NO_PRUNING_POSSIBLE), "NO_PRUNING_POSSIBLE" }, + { static_cast(FilterPropagateResult::FILTER_ALWAYS_TRUE), "FILTER_ALWAYS_TRUE" }, + { static_cast(FilterPropagateResult::FILTER_ALWAYS_FALSE), "FILTER_ALWAYS_FALSE" }, + { static_cast(FilterPropagateResult::FILTER_TRUE_OR_NULL), "FILTER_TRUE_OR_NULL" }, + { static_cast(FilterPropagateResult::FILTER_FALSE_OR_NULL), "FILTER_FALSE_OR_NULL" } + }; + return values; } template<> const char* EnumUtil::ToChars(FilterPropagateResult value) { - switch(value) { - case FilterPropagateResult::NO_PRUNING_POSSIBLE: - return "NO_PRUNING_POSSIBLE"; - case FilterPropagateResult::FILTER_ALWAYS_TRUE: - return "FILTER_ALWAYS_TRUE"; - case FilterPropagateResult::FILTER_ALWAYS_FALSE: - return "FILTER_ALWAYS_FALSE"; - case FilterPropagateResult::FILTER_TRUE_OR_NULL: - return "FILTER_TRUE_OR_NULL"; - case FilterPropagateResult::FILTER_FALSE_OR_NULL: - return "FILTER_FALSE_OR_NULL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFilterPropagateResultValues(), 5, static_cast(value)); } template<> FilterPropagateResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_PRUNING_POSSIBLE")) { - return FilterPropagateResult::NO_PRUNING_POSSIBLE; - } - if (StringUtil::Equals(value, "FILTER_ALWAYS_TRUE")) { - return FilterPropagateResult::FILTER_ALWAYS_TRUE; - } - if (StringUtil::Equals(value, "FILTER_ALWAYS_FALSE")) { - return FilterPropagateResult::FILTER_ALWAYS_FALSE; - } - if (StringUtil::Equals(value, "FILTER_TRUE_OR_NULL")) { - return FilterPropagateResult::FILTER_TRUE_OR_NULL; - } - if (StringUtil::Equals(value, "FILTER_FALSE_OR_NULL")) { - return FilterPropagateResult::FILTER_FALSE_OR_NULL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFilterPropagateResultValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetForeignKeyTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE), "FK_TYPE_PRIMARY_KEY_TABLE" }, + { static_cast(ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE), "FK_TYPE_FOREIGN_KEY_TABLE" }, + { static_cast(ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE), "FK_TYPE_SELF_REFERENCE_TABLE" } + }; + return values; } template<> const char* EnumUtil::ToChars(ForeignKeyType value) { - switch(value) { - case ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE: - return "FK_TYPE_PRIMARY_KEY_TABLE"; - case ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE: - return "FK_TYPE_FOREIGN_KEY_TABLE"; - case ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE: - return "FK_TYPE_SELF_REFERENCE_TABLE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetForeignKeyTypeValues(), 3, static_cast(value)); } template<> ForeignKeyType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "FK_TYPE_PRIMARY_KEY_TABLE")) { - return ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE; - } - if (StringUtil::Equals(value, "FK_TYPE_FOREIGN_KEY_TABLE")) { - return ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE; - } - if (StringUtil::Equals(value, "FK_TYPE_SELF_REFERENCE_TABLE")) { - return ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetForeignKeyTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetFunctionNullHandlingValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FunctionNullHandling::DEFAULT_NULL_HANDLING), "DEFAULT_NULL_HANDLING" }, + { static_cast(FunctionNullHandling::SPECIAL_HANDLING), "SPECIAL_HANDLING" } + }; + return values; } template<> const char* EnumUtil::ToChars(FunctionNullHandling value) { - switch(value) { - case FunctionNullHandling::DEFAULT_NULL_HANDLING: - return "DEFAULT_NULL_HANDLING"; - case FunctionNullHandling::SPECIAL_HANDLING: - return "SPECIAL_HANDLING"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFunctionNullHandlingValues(), 2, static_cast(value)); } template<> FunctionNullHandling EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "DEFAULT_NULL_HANDLING")) { - return FunctionNullHandling::DEFAULT_NULL_HANDLING; - } - if (StringUtil::Equals(value, "SPECIAL_HANDLING")) { - return FunctionNullHandling::SPECIAL_HANDLING; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFunctionNullHandlingValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetFunctionStabilityValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(FunctionStability::CONSISTENT), "CONSISTENT" }, + { static_cast(FunctionStability::VOLATILE), "VOLATILE" }, + { static_cast(FunctionStability::CONSISTENT_WITHIN_QUERY), "CONSISTENT_WITHIN_QUERY" } + }; + return values; } template<> const char* EnumUtil::ToChars(FunctionStability value) { - switch(value) { - case FunctionStability::CONSISTENT: - return "CONSISTENT"; - case FunctionStability::VOLATILE: - return "VOLATILE"; - case FunctionStability::CONSISTENT_WITHIN_QUERY: - return "CONSISTENT_WITHIN_QUERY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetFunctionStabilityValues(), 3, static_cast(value)); } template<> FunctionStability EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CONSISTENT")) { - return FunctionStability::CONSISTENT; - } - if (StringUtil::Equals(value, "VOLATILE")) { - return FunctionStability::VOLATILE; - } - if (StringUtil::Equals(value, "CONSISTENT_WITHIN_QUERY")) { - return FunctionStability::CONSISTENT_WITHIN_QUERY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetFunctionStabilityValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetGateStatusValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(GateStatus::GATE_NOT_SET), "GATE_NOT_SET" }, + { static_cast(GateStatus::GATE_SET), "GATE_SET" } + }; + return values; } template<> const char* EnumUtil::ToChars(GateStatus value) { - switch(value) { - case GateStatus::GATE_NOT_SET: - return "GATE_NOT_SET"; - case GateStatus::GATE_SET: - return "GATE_SET"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetGateStatusValues(), 2, static_cast(value)); } template<> GateStatus EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "GATE_NOT_SET")) { - return GateStatus::GATE_NOT_SET; - } - if (StringUtil::Equals(value, "GATE_SET")) { - return GateStatus::GATE_SET; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetGateStatusValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetHLLStorageTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(HLLStorageType::HLL_V1), "HLL_V1" }, + { static_cast(HLLStorageType::HLL_V2), "HLL_V2" } + }; + return values; } template<> const char* EnumUtil::ToChars(HLLStorageType value) { - switch(value) { - case HLLStorageType::HLL_V1: - return "HLL_V1"; - case HLLStorageType::HLL_V2: - return "HLL_V2"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetHLLStorageTypeValues(), 2, static_cast(value)); } template<> HLLStorageType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "HLL_V1")) { - return HLLStorageType::HLL_V1; - } - if (StringUtil::Equals(value, "HLL_V2")) { - return HLLStorageType::HLL_V2; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetHLLStorageTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetIndexConstraintTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(IndexConstraintType::NONE), "NONE" }, + { static_cast(IndexConstraintType::UNIQUE), "UNIQUE" }, + { static_cast(IndexConstraintType::PRIMARY), "PRIMARY" }, + { static_cast(IndexConstraintType::FOREIGN), "FOREIGN" } + }; + return values; } template<> const char* EnumUtil::ToChars(IndexConstraintType value) { - switch(value) { - case IndexConstraintType::NONE: - return "NONE"; - case IndexConstraintType::UNIQUE: - return "UNIQUE"; - case IndexConstraintType::PRIMARY: - return "PRIMARY"; - case IndexConstraintType::FOREIGN: - return "FOREIGN"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetIndexConstraintTypeValues(), 4, static_cast(value)); } template<> IndexConstraintType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NONE")) { - return IndexConstraintType::NONE; - } - if (StringUtil::Equals(value, "UNIQUE")) { - return IndexConstraintType::UNIQUE; - } - if (StringUtil::Equals(value, "PRIMARY")) { - return IndexConstraintType::PRIMARY; - } - if (StringUtil::Equals(value, "FOREIGN")) { - return IndexConstraintType::FOREIGN; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetIndexConstraintTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetInsertColumnOrderValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(InsertColumnOrder::INSERT_BY_POSITION), "INSERT_BY_POSITION" }, + { static_cast(InsertColumnOrder::INSERT_BY_NAME), "INSERT_BY_NAME" } + }; + return values; } template<> const char* EnumUtil::ToChars(InsertColumnOrder value) { - switch(value) { - case InsertColumnOrder::INSERT_BY_POSITION: - return "INSERT_BY_POSITION"; - case InsertColumnOrder::INSERT_BY_NAME: - return "INSERT_BY_NAME"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetInsertColumnOrderValues(), 2, static_cast(value)); } template<> InsertColumnOrder EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INSERT_BY_POSITION")) { - return InsertColumnOrder::INSERT_BY_POSITION; - } - if (StringUtil::Equals(value, "INSERT_BY_NAME")) { - return InsertColumnOrder::INSERT_BY_NAME; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetInsertColumnOrderValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetInterruptModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(InterruptMode::NO_INTERRUPTS), "NO_INTERRUPTS" }, + { static_cast(InterruptMode::TASK), "TASK" }, + { static_cast(InterruptMode::BLOCKING), "BLOCKING" } + }; + return values; } template<> const char* EnumUtil::ToChars(InterruptMode value) { - switch(value) { - case InterruptMode::NO_INTERRUPTS: - return "NO_INTERRUPTS"; - case InterruptMode::TASK: - return "TASK"; - case InterruptMode::BLOCKING: - return "BLOCKING"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetInterruptModeValues(), 3, static_cast(value)); } template<> InterruptMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_INTERRUPTS")) { - return InterruptMode::NO_INTERRUPTS; - } - if (StringUtil::Equals(value, "TASK")) { - return InterruptMode::TASK; - } - if (StringUtil::Equals(value, "BLOCKING")) { - return InterruptMode::BLOCKING; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetInterruptModeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetJoinRefTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(JoinRefType::REGULAR), "REGULAR" }, + { static_cast(JoinRefType::NATURAL), "NATURAL" }, + { static_cast(JoinRefType::CROSS), "CROSS" }, + { static_cast(JoinRefType::POSITIONAL), "POSITIONAL" }, + { static_cast(JoinRefType::ASOF), "ASOF" }, + { static_cast(JoinRefType::DEPENDENT), "DEPENDENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(JoinRefType value) { - switch(value) { - case JoinRefType::REGULAR: - return "REGULAR"; - case JoinRefType::NATURAL: - return "NATURAL"; - case JoinRefType::CROSS: - return "CROSS"; - case JoinRefType::POSITIONAL: - return "POSITIONAL"; - case JoinRefType::ASOF: - return "ASOF"; - case JoinRefType::DEPENDENT: - return "DEPENDENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetJoinRefTypeValues(), 6, static_cast(value)); } template<> JoinRefType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "REGULAR")) { - return JoinRefType::REGULAR; - } - if (StringUtil::Equals(value, "NATURAL")) { - return JoinRefType::NATURAL; - } - if (StringUtil::Equals(value, "CROSS")) { - return JoinRefType::CROSS; - } - if (StringUtil::Equals(value, "POSITIONAL")) { - return JoinRefType::POSITIONAL; - } - if (StringUtil::Equals(value, "ASOF")) { - return JoinRefType::ASOF; - } - if (StringUtil::Equals(value, "DEPENDENT")) { - return JoinRefType::DEPENDENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetJoinRefTypeValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetJoinTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(JoinType::INVALID), "INVALID" }, + { static_cast(JoinType::LEFT), "LEFT" }, + { static_cast(JoinType::RIGHT), "RIGHT" }, + { static_cast(JoinType::INNER), "INNER" }, + { static_cast(JoinType::OUTER), "FULL" }, + { static_cast(JoinType::SEMI), "SEMI" }, + { static_cast(JoinType::ANTI), "ANTI" }, + { static_cast(JoinType::MARK), "MARK" }, + { static_cast(JoinType::SINGLE), "SINGLE" }, + { static_cast(JoinType::RIGHT_SEMI), "RIGHT_SEMI" }, + { static_cast(JoinType::RIGHT_ANTI), "RIGHT_ANTI" } + }; + return values; } template<> const char* EnumUtil::ToChars(JoinType value) { - switch(value) { - case JoinType::INVALID: - return "INVALID"; - case JoinType::LEFT: - return "LEFT"; - case JoinType::RIGHT: - return "RIGHT"; - case JoinType::INNER: - return "INNER"; - case JoinType::OUTER: - return "FULL"; - case JoinType::SEMI: - return "SEMI"; - case JoinType::ANTI: - return "ANTI"; - case JoinType::MARK: - return "MARK"; - case JoinType::SINGLE: - return "SINGLE"; - case JoinType::RIGHT_SEMI: - return "RIGHT_SEMI"; - case JoinType::RIGHT_ANTI: - return "RIGHT_ANTI"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetJoinTypeValues(), 11, static_cast(value)); } template<> JoinType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return JoinType::INVALID; - } - if (StringUtil::Equals(value, "LEFT")) { - return JoinType::LEFT; - } - if (StringUtil::Equals(value, "RIGHT")) { - return JoinType::RIGHT; - } - if (StringUtil::Equals(value, "INNER")) { - return JoinType::INNER; - } - if (StringUtil::Equals(value, "FULL")) { - return JoinType::OUTER; - } - if (StringUtil::Equals(value, "SEMI")) { - return JoinType::SEMI; - } - if (StringUtil::Equals(value, "ANTI")) { - return JoinType::ANTI; - } - if (StringUtil::Equals(value, "MARK")) { - return JoinType::MARK; - } - if (StringUtil::Equals(value, "SINGLE")) { - return JoinType::SINGLE; - } - if (StringUtil::Equals(value, "RIGHT_SEMI")) { - return JoinType::RIGHT_SEMI; - } - if (StringUtil::Equals(value, "RIGHT_ANTI")) { - return JoinType::RIGHT_ANTI; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetJoinTypeValues(), 11, value)); +} + +const StringUtil::EnumStringLiteral *GetKeywordCategoryValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(KeywordCategory::KEYWORD_RESERVED), "KEYWORD_RESERVED" }, + { static_cast(KeywordCategory::KEYWORD_UNRESERVED), "KEYWORD_UNRESERVED" }, + { static_cast(KeywordCategory::KEYWORD_TYPE_FUNC), "KEYWORD_TYPE_FUNC" }, + { static_cast(KeywordCategory::KEYWORD_COL_NAME), "KEYWORD_COL_NAME" }, + { static_cast(KeywordCategory::KEYWORD_NONE), "KEYWORD_NONE" } + }; + return values; } template<> const char* EnumUtil::ToChars(KeywordCategory value) { - switch(value) { - case KeywordCategory::KEYWORD_RESERVED: - return "KEYWORD_RESERVED"; - case KeywordCategory::KEYWORD_UNRESERVED: - return "KEYWORD_UNRESERVED"; - case KeywordCategory::KEYWORD_TYPE_FUNC: - return "KEYWORD_TYPE_FUNC"; - case KeywordCategory::KEYWORD_COL_NAME: - return "KEYWORD_COL_NAME"; - case KeywordCategory::KEYWORD_NONE: - return "KEYWORD_NONE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetKeywordCategoryValues(), 5, static_cast(value)); } template<> KeywordCategory EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "KEYWORD_RESERVED")) { - return KeywordCategory::KEYWORD_RESERVED; - } - if (StringUtil::Equals(value, "KEYWORD_UNRESERVED")) { - return KeywordCategory::KEYWORD_UNRESERVED; - } - if (StringUtil::Equals(value, "KEYWORD_TYPE_FUNC")) { - return KeywordCategory::KEYWORD_TYPE_FUNC; - } - if (StringUtil::Equals(value, "KEYWORD_COL_NAME")) { - return KeywordCategory::KEYWORD_COL_NAME; - } - if (StringUtil::Equals(value, "KEYWORD_NONE")) { - return KeywordCategory::KEYWORD_NONE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetKeywordCategoryValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetLimitNodeTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(LimitNodeType::UNSET), "UNSET" }, + { static_cast(LimitNodeType::CONSTANT_VALUE), "CONSTANT_VALUE" }, + { static_cast(LimitNodeType::CONSTANT_PERCENTAGE), "CONSTANT_PERCENTAGE" }, + { static_cast(LimitNodeType::EXPRESSION_VALUE), "EXPRESSION_VALUE" }, + { static_cast(LimitNodeType::EXPRESSION_PERCENTAGE), "EXPRESSION_PERCENTAGE" } + }; + return values; } template<> const char* EnumUtil::ToChars(LimitNodeType value) { - switch(value) { - case LimitNodeType::UNSET: - return "UNSET"; - case LimitNodeType::CONSTANT_VALUE: - return "CONSTANT_VALUE"; - case LimitNodeType::CONSTANT_PERCENTAGE: - return "CONSTANT_PERCENTAGE"; - case LimitNodeType::EXPRESSION_VALUE: - return "EXPRESSION_VALUE"; - case LimitNodeType::EXPRESSION_PERCENTAGE: - return "EXPRESSION_PERCENTAGE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetLimitNodeTypeValues(), 5, static_cast(value)); } template<> LimitNodeType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "UNSET")) { - return LimitNodeType::UNSET; - } - if (StringUtil::Equals(value, "CONSTANT_VALUE")) { - return LimitNodeType::CONSTANT_VALUE; - } - if (StringUtil::Equals(value, "CONSTANT_PERCENTAGE")) { - return LimitNodeType::CONSTANT_PERCENTAGE; - } - if (StringUtil::Equals(value, "EXPRESSION_VALUE")) { - return LimitNodeType::EXPRESSION_VALUE; - } - if (StringUtil::Equals(value, "EXPRESSION_PERCENTAGE")) { - return LimitNodeType::EXPRESSION_PERCENTAGE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetLimitNodeTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetLoadTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(LoadType::LOAD), "LOAD" }, + { static_cast(LoadType::INSTALL), "INSTALL" }, + { static_cast(LoadType::FORCE_INSTALL), "FORCE_INSTALL" } + }; + return values; } template<> const char* EnumUtil::ToChars(LoadType value) { - switch(value) { - case LoadType::LOAD: - return "LOAD"; - case LoadType::INSTALL: - return "INSTALL"; - case LoadType::FORCE_INSTALL: - return "FORCE_INSTALL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetLoadTypeValues(), 3, static_cast(value)); } template<> LoadType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LOAD")) { - return LoadType::LOAD; - } - if (StringUtil::Equals(value, "INSTALL")) { - return LoadType::INSTALL; - } - if (StringUtil::Equals(value, "FORCE_INSTALL")) { - return LoadType::FORCE_INSTALL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetLoadTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetLogicalOperatorTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(LogicalOperatorType::LOGICAL_INVALID), "LOGICAL_INVALID" }, + { static_cast(LogicalOperatorType::LOGICAL_PROJECTION), "LOGICAL_PROJECTION" }, + { static_cast(LogicalOperatorType::LOGICAL_FILTER), "LOGICAL_FILTER" }, + { static_cast(LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY), "LOGICAL_AGGREGATE_AND_GROUP_BY" }, + { static_cast(LogicalOperatorType::LOGICAL_WINDOW), "LOGICAL_WINDOW" }, + { static_cast(LogicalOperatorType::LOGICAL_UNNEST), "LOGICAL_UNNEST" }, + { static_cast(LogicalOperatorType::LOGICAL_LIMIT), "LOGICAL_LIMIT" }, + { static_cast(LogicalOperatorType::LOGICAL_ORDER_BY), "LOGICAL_ORDER_BY" }, + { static_cast(LogicalOperatorType::LOGICAL_TOP_N), "LOGICAL_TOP_N" }, + { static_cast(LogicalOperatorType::LOGICAL_COPY_TO_FILE), "LOGICAL_COPY_TO_FILE" }, + { static_cast(LogicalOperatorType::LOGICAL_DISTINCT), "LOGICAL_DISTINCT" }, + { static_cast(LogicalOperatorType::LOGICAL_SAMPLE), "LOGICAL_SAMPLE" }, + { static_cast(LogicalOperatorType::LOGICAL_PIVOT), "LOGICAL_PIVOT" }, + { static_cast(LogicalOperatorType::LOGICAL_COPY_DATABASE), "LOGICAL_COPY_DATABASE" }, + { static_cast(LogicalOperatorType::LOGICAL_GET), "LOGICAL_GET" }, + { static_cast(LogicalOperatorType::LOGICAL_CHUNK_GET), "LOGICAL_CHUNK_GET" }, + { static_cast(LogicalOperatorType::LOGICAL_DELIM_GET), "LOGICAL_DELIM_GET" }, + { static_cast(LogicalOperatorType::LOGICAL_EXPRESSION_GET), "LOGICAL_EXPRESSION_GET" }, + { static_cast(LogicalOperatorType::LOGICAL_DUMMY_SCAN), "LOGICAL_DUMMY_SCAN" }, + { static_cast(LogicalOperatorType::LOGICAL_EMPTY_RESULT), "LOGICAL_EMPTY_RESULT" }, + { static_cast(LogicalOperatorType::LOGICAL_CTE_REF), "LOGICAL_CTE_REF" }, + { static_cast(LogicalOperatorType::LOGICAL_JOIN), "LOGICAL_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_DELIM_JOIN), "LOGICAL_DELIM_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_COMPARISON_JOIN), "LOGICAL_COMPARISON_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_ANY_JOIN), "LOGICAL_ANY_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_CROSS_PRODUCT), "LOGICAL_CROSS_PRODUCT" }, + { static_cast(LogicalOperatorType::LOGICAL_POSITIONAL_JOIN), "LOGICAL_POSITIONAL_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_ASOF_JOIN), "LOGICAL_ASOF_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_DEPENDENT_JOIN), "LOGICAL_DEPENDENT_JOIN" }, + { static_cast(LogicalOperatorType::LOGICAL_UNION), "LOGICAL_UNION" }, + { static_cast(LogicalOperatorType::LOGICAL_EXCEPT), "LOGICAL_EXCEPT" }, + { static_cast(LogicalOperatorType::LOGICAL_INTERSECT), "LOGICAL_INTERSECT" }, + { static_cast(LogicalOperatorType::LOGICAL_RECURSIVE_CTE), "LOGICAL_RECURSIVE_CTE" }, + { static_cast(LogicalOperatorType::LOGICAL_MATERIALIZED_CTE), "LOGICAL_MATERIALIZED_CTE" }, + { static_cast(LogicalOperatorType::LOGICAL_INSERT), "LOGICAL_INSERT" }, + { static_cast(LogicalOperatorType::LOGICAL_DELETE), "LOGICAL_DELETE" }, + { static_cast(LogicalOperatorType::LOGICAL_UPDATE), "LOGICAL_UPDATE" }, + { static_cast(LogicalOperatorType::LOGICAL_ALTER), "LOGICAL_ALTER" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_TABLE), "LOGICAL_CREATE_TABLE" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_INDEX), "LOGICAL_CREATE_INDEX" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_SEQUENCE), "LOGICAL_CREATE_SEQUENCE" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_VIEW), "LOGICAL_CREATE_VIEW" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_SCHEMA), "LOGICAL_CREATE_SCHEMA" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_MACRO), "LOGICAL_CREATE_MACRO" }, + { static_cast(LogicalOperatorType::LOGICAL_DROP), "LOGICAL_DROP" }, + { static_cast(LogicalOperatorType::LOGICAL_PRAGMA), "LOGICAL_PRAGMA" }, + { static_cast(LogicalOperatorType::LOGICAL_TRANSACTION), "LOGICAL_TRANSACTION" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_TYPE), "LOGICAL_CREATE_TYPE" }, + { static_cast(LogicalOperatorType::LOGICAL_ATTACH), "LOGICAL_ATTACH" }, + { static_cast(LogicalOperatorType::LOGICAL_DETACH), "LOGICAL_DETACH" }, + { static_cast(LogicalOperatorType::LOGICAL_EXPLAIN), "LOGICAL_EXPLAIN" }, + { static_cast(LogicalOperatorType::LOGICAL_PREPARE), "LOGICAL_PREPARE" }, + { static_cast(LogicalOperatorType::LOGICAL_EXECUTE), "LOGICAL_EXECUTE" }, + { static_cast(LogicalOperatorType::LOGICAL_EXPORT), "LOGICAL_EXPORT" }, + { static_cast(LogicalOperatorType::LOGICAL_VACUUM), "LOGICAL_VACUUM" }, + { static_cast(LogicalOperatorType::LOGICAL_SET), "LOGICAL_SET" }, + { static_cast(LogicalOperatorType::LOGICAL_LOAD), "LOGICAL_LOAD" }, + { static_cast(LogicalOperatorType::LOGICAL_RESET), "LOGICAL_RESET" }, + { static_cast(LogicalOperatorType::LOGICAL_UPDATE_EXTENSIONS), "LOGICAL_UPDATE_EXTENSIONS" }, + { static_cast(LogicalOperatorType::LOGICAL_CREATE_SECRET), "LOGICAL_CREATE_SECRET" }, + { static_cast(LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR), "LOGICAL_EXTENSION_OPERATOR" } + }; + return values; } template<> const char* EnumUtil::ToChars(LogicalOperatorType value) { - switch(value) { - case LogicalOperatorType::LOGICAL_INVALID: - return "LOGICAL_INVALID"; - case LogicalOperatorType::LOGICAL_PROJECTION: - return "LOGICAL_PROJECTION"; - case LogicalOperatorType::LOGICAL_FILTER: - return "LOGICAL_FILTER"; - case LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY: - return "LOGICAL_AGGREGATE_AND_GROUP_BY"; - case LogicalOperatorType::LOGICAL_WINDOW: - return "LOGICAL_WINDOW"; - case LogicalOperatorType::LOGICAL_UNNEST: - return "LOGICAL_UNNEST"; - case LogicalOperatorType::LOGICAL_LIMIT: - return "LOGICAL_LIMIT"; - case LogicalOperatorType::LOGICAL_ORDER_BY: - return "LOGICAL_ORDER_BY"; - case LogicalOperatorType::LOGICAL_TOP_N: - return "LOGICAL_TOP_N"; - case LogicalOperatorType::LOGICAL_COPY_TO_FILE: - return "LOGICAL_COPY_TO_FILE"; - case LogicalOperatorType::LOGICAL_DISTINCT: - return "LOGICAL_DISTINCT"; - case LogicalOperatorType::LOGICAL_SAMPLE: - return "LOGICAL_SAMPLE"; - case LogicalOperatorType::LOGICAL_PIVOT: - return "LOGICAL_PIVOT"; - case LogicalOperatorType::LOGICAL_COPY_DATABASE: - return "LOGICAL_COPY_DATABASE"; - case LogicalOperatorType::LOGICAL_GET: - return "LOGICAL_GET"; - case LogicalOperatorType::LOGICAL_CHUNK_GET: - return "LOGICAL_CHUNK_GET"; - case LogicalOperatorType::LOGICAL_DELIM_GET: - return "LOGICAL_DELIM_GET"; - case LogicalOperatorType::LOGICAL_EXPRESSION_GET: - return "LOGICAL_EXPRESSION_GET"; - case LogicalOperatorType::LOGICAL_DUMMY_SCAN: - return "LOGICAL_DUMMY_SCAN"; - case LogicalOperatorType::LOGICAL_EMPTY_RESULT: - return "LOGICAL_EMPTY_RESULT"; - case LogicalOperatorType::LOGICAL_CTE_REF: - return "LOGICAL_CTE_REF"; - case LogicalOperatorType::LOGICAL_JOIN: - return "LOGICAL_JOIN"; - case LogicalOperatorType::LOGICAL_DELIM_JOIN: - return "LOGICAL_DELIM_JOIN"; - case LogicalOperatorType::LOGICAL_COMPARISON_JOIN: - return "LOGICAL_COMPARISON_JOIN"; - case LogicalOperatorType::LOGICAL_ANY_JOIN: - return "LOGICAL_ANY_JOIN"; - case LogicalOperatorType::LOGICAL_CROSS_PRODUCT: - return "LOGICAL_CROSS_PRODUCT"; - case LogicalOperatorType::LOGICAL_POSITIONAL_JOIN: - return "LOGICAL_POSITIONAL_JOIN"; - case LogicalOperatorType::LOGICAL_ASOF_JOIN: - return "LOGICAL_ASOF_JOIN"; - case LogicalOperatorType::LOGICAL_DEPENDENT_JOIN: - return "LOGICAL_DEPENDENT_JOIN"; - case LogicalOperatorType::LOGICAL_UNION: - return "LOGICAL_UNION"; - case LogicalOperatorType::LOGICAL_EXCEPT: - return "LOGICAL_EXCEPT"; - case LogicalOperatorType::LOGICAL_INTERSECT: - return "LOGICAL_INTERSECT"; - case LogicalOperatorType::LOGICAL_RECURSIVE_CTE: - return "LOGICAL_RECURSIVE_CTE"; - case LogicalOperatorType::LOGICAL_MATERIALIZED_CTE: - return "LOGICAL_MATERIALIZED_CTE"; - case LogicalOperatorType::LOGICAL_INSERT: - return "LOGICAL_INSERT"; - case LogicalOperatorType::LOGICAL_DELETE: - return "LOGICAL_DELETE"; - case LogicalOperatorType::LOGICAL_UPDATE: - return "LOGICAL_UPDATE"; - case LogicalOperatorType::LOGICAL_ALTER: - return "LOGICAL_ALTER"; - case LogicalOperatorType::LOGICAL_CREATE_TABLE: - return "LOGICAL_CREATE_TABLE"; - case LogicalOperatorType::LOGICAL_CREATE_INDEX: - return "LOGICAL_CREATE_INDEX"; - case LogicalOperatorType::LOGICAL_CREATE_SEQUENCE: - return "LOGICAL_CREATE_SEQUENCE"; - case LogicalOperatorType::LOGICAL_CREATE_VIEW: - return "LOGICAL_CREATE_VIEW"; - case LogicalOperatorType::LOGICAL_CREATE_SCHEMA: - return "LOGICAL_CREATE_SCHEMA"; - case LogicalOperatorType::LOGICAL_CREATE_MACRO: - return "LOGICAL_CREATE_MACRO"; - case LogicalOperatorType::LOGICAL_DROP: - return "LOGICAL_DROP"; - case LogicalOperatorType::LOGICAL_PRAGMA: - return "LOGICAL_PRAGMA"; - case LogicalOperatorType::LOGICAL_TRANSACTION: - return "LOGICAL_TRANSACTION"; - case LogicalOperatorType::LOGICAL_CREATE_TYPE: - return "LOGICAL_CREATE_TYPE"; - case LogicalOperatorType::LOGICAL_ATTACH: - return "LOGICAL_ATTACH"; - case LogicalOperatorType::LOGICAL_DETACH: - return "LOGICAL_DETACH"; - case LogicalOperatorType::LOGICAL_EXPLAIN: - return "LOGICAL_EXPLAIN"; - case LogicalOperatorType::LOGICAL_PREPARE: - return "LOGICAL_PREPARE"; - case LogicalOperatorType::LOGICAL_EXECUTE: - return "LOGICAL_EXECUTE"; - case LogicalOperatorType::LOGICAL_EXPORT: - return "LOGICAL_EXPORT"; - case LogicalOperatorType::LOGICAL_VACUUM: - return "LOGICAL_VACUUM"; - case LogicalOperatorType::LOGICAL_SET: - return "LOGICAL_SET"; - case LogicalOperatorType::LOGICAL_LOAD: - return "LOGICAL_LOAD"; - case LogicalOperatorType::LOGICAL_RESET: - return "LOGICAL_RESET"; - case LogicalOperatorType::LOGICAL_UPDATE_EXTENSIONS: - return "LOGICAL_UPDATE_EXTENSIONS"; - case LogicalOperatorType::LOGICAL_CREATE_SECRET: - return "LOGICAL_CREATE_SECRET"; - case LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR: - return "LOGICAL_EXTENSION_OPERATOR"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetLogicalOperatorTypeValues(), 61, static_cast(value)); } template<> LogicalOperatorType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LOGICAL_INVALID")) { - return LogicalOperatorType::LOGICAL_INVALID; - } - if (StringUtil::Equals(value, "LOGICAL_PROJECTION")) { - return LogicalOperatorType::LOGICAL_PROJECTION; - } - if (StringUtil::Equals(value, "LOGICAL_FILTER")) { - return LogicalOperatorType::LOGICAL_FILTER; - } - if (StringUtil::Equals(value, "LOGICAL_AGGREGATE_AND_GROUP_BY")) { - return LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY; - } - if (StringUtil::Equals(value, "LOGICAL_WINDOW")) { - return LogicalOperatorType::LOGICAL_WINDOW; - } - if (StringUtil::Equals(value, "LOGICAL_UNNEST")) { - return LogicalOperatorType::LOGICAL_UNNEST; - } - if (StringUtil::Equals(value, "LOGICAL_LIMIT")) { - return LogicalOperatorType::LOGICAL_LIMIT; - } - if (StringUtil::Equals(value, "LOGICAL_ORDER_BY")) { - return LogicalOperatorType::LOGICAL_ORDER_BY; - } - if (StringUtil::Equals(value, "LOGICAL_TOP_N")) { - return LogicalOperatorType::LOGICAL_TOP_N; - } - if (StringUtil::Equals(value, "LOGICAL_COPY_TO_FILE")) { - return LogicalOperatorType::LOGICAL_COPY_TO_FILE; - } - if (StringUtil::Equals(value, "LOGICAL_DISTINCT")) { - return LogicalOperatorType::LOGICAL_DISTINCT; - } - if (StringUtil::Equals(value, "LOGICAL_SAMPLE")) { - return LogicalOperatorType::LOGICAL_SAMPLE; - } - if (StringUtil::Equals(value, "LOGICAL_PIVOT")) { - return LogicalOperatorType::LOGICAL_PIVOT; - } - if (StringUtil::Equals(value, "LOGICAL_COPY_DATABASE")) { - return LogicalOperatorType::LOGICAL_COPY_DATABASE; - } - if (StringUtil::Equals(value, "LOGICAL_GET")) { - return LogicalOperatorType::LOGICAL_GET; - } - if (StringUtil::Equals(value, "LOGICAL_CHUNK_GET")) { - return LogicalOperatorType::LOGICAL_CHUNK_GET; - } - if (StringUtil::Equals(value, "LOGICAL_DELIM_GET")) { - return LogicalOperatorType::LOGICAL_DELIM_GET; - } - if (StringUtil::Equals(value, "LOGICAL_EXPRESSION_GET")) { - return LogicalOperatorType::LOGICAL_EXPRESSION_GET; - } - if (StringUtil::Equals(value, "LOGICAL_DUMMY_SCAN")) { - return LogicalOperatorType::LOGICAL_DUMMY_SCAN; - } - if (StringUtil::Equals(value, "LOGICAL_EMPTY_RESULT")) { - return LogicalOperatorType::LOGICAL_EMPTY_RESULT; - } - if (StringUtil::Equals(value, "LOGICAL_CTE_REF")) { - return LogicalOperatorType::LOGICAL_CTE_REF; - } - if (StringUtil::Equals(value, "LOGICAL_JOIN")) { - return LogicalOperatorType::LOGICAL_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_DELIM_JOIN")) { - return LogicalOperatorType::LOGICAL_DELIM_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_COMPARISON_JOIN")) { - return LogicalOperatorType::LOGICAL_COMPARISON_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_ANY_JOIN")) { - return LogicalOperatorType::LOGICAL_ANY_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_CROSS_PRODUCT")) { - return LogicalOperatorType::LOGICAL_CROSS_PRODUCT; - } - if (StringUtil::Equals(value, "LOGICAL_POSITIONAL_JOIN")) { - return LogicalOperatorType::LOGICAL_POSITIONAL_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_ASOF_JOIN")) { - return LogicalOperatorType::LOGICAL_ASOF_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_DEPENDENT_JOIN")) { - return LogicalOperatorType::LOGICAL_DEPENDENT_JOIN; - } - if (StringUtil::Equals(value, "LOGICAL_UNION")) { - return LogicalOperatorType::LOGICAL_UNION; - } - if (StringUtil::Equals(value, "LOGICAL_EXCEPT")) { - return LogicalOperatorType::LOGICAL_EXCEPT; - } - if (StringUtil::Equals(value, "LOGICAL_INTERSECT")) { - return LogicalOperatorType::LOGICAL_INTERSECT; - } - if (StringUtil::Equals(value, "LOGICAL_RECURSIVE_CTE")) { - return LogicalOperatorType::LOGICAL_RECURSIVE_CTE; - } - if (StringUtil::Equals(value, "LOGICAL_MATERIALIZED_CTE")) { - return LogicalOperatorType::LOGICAL_MATERIALIZED_CTE; - } - if (StringUtil::Equals(value, "LOGICAL_INSERT")) { - return LogicalOperatorType::LOGICAL_INSERT; - } - if (StringUtil::Equals(value, "LOGICAL_DELETE")) { - return LogicalOperatorType::LOGICAL_DELETE; - } - if (StringUtil::Equals(value, "LOGICAL_UPDATE")) { - return LogicalOperatorType::LOGICAL_UPDATE; - } - if (StringUtil::Equals(value, "LOGICAL_ALTER")) { - return LogicalOperatorType::LOGICAL_ALTER; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_TABLE")) { - return LogicalOperatorType::LOGICAL_CREATE_TABLE; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_INDEX")) { - return LogicalOperatorType::LOGICAL_CREATE_INDEX; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_SEQUENCE")) { - return LogicalOperatorType::LOGICAL_CREATE_SEQUENCE; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_VIEW")) { - return LogicalOperatorType::LOGICAL_CREATE_VIEW; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_SCHEMA")) { - return LogicalOperatorType::LOGICAL_CREATE_SCHEMA; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_MACRO")) { - return LogicalOperatorType::LOGICAL_CREATE_MACRO; - } - if (StringUtil::Equals(value, "LOGICAL_DROP")) { - return LogicalOperatorType::LOGICAL_DROP; - } - if (StringUtil::Equals(value, "LOGICAL_PRAGMA")) { - return LogicalOperatorType::LOGICAL_PRAGMA; - } - if (StringUtil::Equals(value, "LOGICAL_TRANSACTION")) { - return LogicalOperatorType::LOGICAL_TRANSACTION; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_TYPE")) { - return LogicalOperatorType::LOGICAL_CREATE_TYPE; - } - if (StringUtil::Equals(value, "LOGICAL_ATTACH")) { - return LogicalOperatorType::LOGICAL_ATTACH; - } - if (StringUtil::Equals(value, "LOGICAL_DETACH")) { - return LogicalOperatorType::LOGICAL_DETACH; - } - if (StringUtil::Equals(value, "LOGICAL_EXPLAIN")) { - return LogicalOperatorType::LOGICAL_EXPLAIN; - } - if (StringUtil::Equals(value, "LOGICAL_PREPARE")) { - return LogicalOperatorType::LOGICAL_PREPARE; - } - if (StringUtil::Equals(value, "LOGICAL_EXECUTE")) { - return LogicalOperatorType::LOGICAL_EXECUTE; - } - if (StringUtil::Equals(value, "LOGICAL_EXPORT")) { - return LogicalOperatorType::LOGICAL_EXPORT; - } - if (StringUtil::Equals(value, "LOGICAL_VACUUM")) { - return LogicalOperatorType::LOGICAL_VACUUM; - } - if (StringUtil::Equals(value, "LOGICAL_SET")) { - return LogicalOperatorType::LOGICAL_SET; - } - if (StringUtil::Equals(value, "LOGICAL_LOAD")) { - return LogicalOperatorType::LOGICAL_LOAD; - } - if (StringUtil::Equals(value, "LOGICAL_RESET")) { - return LogicalOperatorType::LOGICAL_RESET; - } - if (StringUtil::Equals(value, "LOGICAL_UPDATE_EXTENSIONS")) { - return LogicalOperatorType::LOGICAL_UPDATE_EXTENSIONS; - } - if (StringUtil::Equals(value, "LOGICAL_CREATE_SECRET")) { - return LogicalOperatorType::LOGICAL_CREATE_SECRET; - } - if (StringUtil::Equals(value, "LOGICAL_EXTENSION_OPERATOR")) { - return LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetLogicalOperatorTypeValues(), 61, value)); +} + +const StringUtil::EnumStringLiteral *GetLogicalTypeIdValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(LogicalTypeId::INVALID), "INVALID" }, + { static_cast(LogicalTypeId::SQLNULL), "NULL" }, + { static_cast(LogicalTypeId::UNKNOWN), "UNKNOWN" }, + { static_cast(LogicalTypeId::ANY), "ANY" }, + { static_cast(LogicalTypeId::USER), "USER" }, + { static_cast(LogicalTypeId::BOOLEAN), "BOOLEAN" }, + { static_cast(LogicalTypeId::TINYINT), "TINYINT" }, + { static_cast(LogicalTypeId::SMALLINT), "SMALLINT" }, + { static_cast(LogicalTypeId::INTEGER), "INTEGER" }, + { static_cast(LogicalTypeId::BIGINT), "BIGINT" }, + { static_cast(LogicalTypeId::DATE), "DATE" }, + { static_cast(LogicalTypeId::TIME), "TIME" }, + { static_cast(LogicalTypeId::TIMESTAMP_SEC), "TIMESTAMP_S" }, + { static_cast(LogicalTypeId::TIMESTAMP_MS), "TIMESTAMP_MS" }, + { static_cast(LogicalTypeId::TIMESTAMP), "TIMESTAMP" }, + { static_cast(LogicalTypeId::TIMESTAMP_NS), "TIMESTAMP_NS" }, + { static_cast(LogicalTypeId::DECIMAL), "DECIMAL" }, + { static_cast(LogicalTypeId::FLOAT), "FLOAT" }, + { static_cast(LogicalTypeId::DOUBLE), "DOUBLE" }, + { static_cast(LogicalTypeId::CHAR), "CHAR" }, + { static_cast(LogicalTypeId::VARCHAR), "VARCHAR" }, + { static_cast(LogicalTypeId::BLOB), "BLOB" }, + { static_cast(LogicalTypeId::INTERVAL), "INTERVAL" }, + { static_cast(LogicalTypeId::UTINYINT), "UTINYINT" }, + { static_cast(LogicalTypeId::USMALLINT), "USMALLINT" }, + { static_cast(LogicalTypeId::UINTEGER), "UINTEGER" }, + { static_cast(LogicalTypeId::UBIGINT), "UBIGINT" }, + { static_cast(LogicalTypeId::TIMESTAMP_TZ), "TIMESTAMP WITH TIME ZONE" }, + { static_cast(LogicalTypeId::TIME_TZ), "TIME WITH TIME ZONE" }, + { static_cast(LogicalTypeId::BIT), "BIT" }, + { static_cast(LogicalTypeId::STRING_LITERAL), "STRING_LITERAL" }, + { static_cast(LogicalTypeId::INTEGER_LITERAL), "INTEGER_LITERAL" }, + { static_cast(LogicalTypeId::VARINT), "VARINT" }, + { static_cast(LogicalTypeId::UHUGEINT), "UHUGEINT" }, + { static_cast(LogicalTypeId::HUGEINT), "HUGEINT" }, + { static_cast(LogicalTypeId::POINTER), "POINTER" }, + { static_cast(LogicalTypeId::VALIDITY), "VALIDITY" }, + { static_cast(LogicalTypeId::UUID), "UUID" }, + { static_cast(LogicalTypeId::STRUCT), "STRUCT" }, + { static_cast(LogicalTypeId::LIST), "LIST" }, + { static_cast(LogicalTypeId::MAP), "MAP" }, + { static_cast(LogicalTypeId::TABLE), "TABLE" }, + { static_cast(LogicalTypeId::ENUM), "ENUM" }, + { static_cast(LogicalTypeId::AGGREGATE_STATE), "AGGREGATE_STATE" }, + { static_cast(LogicalTypeId::LAMBDA), "LAMBDA" }, + { static_cast(LogicalTypeId::UNION), "UNION" }, + { static_cast(LogicalTypeId::ARRAY), "ARRAY" } + }; + return values; } template<> const char* EnumUtil::ToChars(LogicalTypeId value) { - switch(value) { - case LogicalTypeId::INVALID: - return "INVALID"; - case LogicalTypeId::SQLNULL: - return "NULL"; - case LogicalTypeId::UNKNOWN: - return "UNKNOWN"; - case LogicalTypeId::ANY: - return "ANY"; - case LogicalTypeId::USER: - return "USER"; - case LogicalTypeId::BOOLEAN: - return "BOOLEAN"; - case LogicalTypeId::TINYINT: - return "TINYINT"; - case LogicalTypeId::SMALLINT: - return "SMALLINT"; - case LogicalTypeId::INTEGER: - return "INTEGER"; - case LogicalTypeId::BIGINT: - return "BIGINT"; - case LogicalTypeId::DATE: - return "DATE"; - case LogicalTypeId::TIME: - return "TIME"; - case LogicalTypeId::TIMESTAMP_SEC: - return "TIMESTAMP_S"; - case LogicalTypeId::TIMESTAMP_MS: - return "TIMESTAMP_MS"; - case LogicalTypeId::TIMESTAMP: - return "TIMESTAMP"; - case LogicalTypeId::TIMESTAMP_NS: - return "TIMESTAMP_NS"; - case LogicalTypeId::DECIMAL: - return "DECIMAL"; - case LogicalTypeId::FLOAT: - return "FLOAT"; - case LogicalTypeId::DOUBLE: - return "DOUBLE"; - case LogicalTypeId::CHAR: - return "CHAR"; - case LogicalTypeId::VARCHAR: - return "VARCHAR"; - case LogicalTypeId::BLOB: - return "BLOB"; - case LogicalTypeId::INTERVAL: - return "INTERVAL"; - case LogicalTypeId::UTINYINT: - return "UTINYINT"; - case LogicalTypeId::USMALLINT: - return "USMALLINT"; - case LogicalTypeId::UINTEGER: - return "UINTEGER"; - case LogicalTypeId::UBIGINT: - return "UBIGINT"; - case LogicalTypeId::TIMESTAMP_TZ: - return "TIMESTAMP WITH TIME ZONE"; - case LogicalTypeId::TIME_TZ: - return "TIME WITH TIME ZONE"; - case LogicalTypeId::BIT: - return "BIT"; - case LogicalTypeId::STRING_LITERAL: - return "STRING_LITERAL"; - case LogicalTypeId::INTEGER_LITERAL: - return "INTEGER_LITERAL"; - case LogicalTypeId::VARINT: - return "VARINT"; - case LogicalTypeId::UHUGEINT: - return "UHUGEINT"; - case LogicalTypeId::HUGEINT: - return "HUGEINT"; - case LogicalTypeId::POINTER: - return "POINTER"; - case LogicalTypeId::VALIDITY: - return "VALIDITY"; - case LogicalTypeId::UUID: - return "UUID"; - case LogicalTypeId::STRUCT: - return "STRUCT"; - case LogicalTypeId::LIST: - return "LIST"; - case LogicalTypeId::MAP: - return "MAP"; - case LogicalTypeId::TABLE: - return "TABLE"; - case LogicalTypeId::ENUM: - return "ENUM"; - case LogicalTypeId::AGGREGATE_STATE: - return "AGGREGATE_STATE"; - case LogicalTypeId::LAMBDA: - return "LAMBDA"; - case LogicalTypeId::UNION: - return "UNION"; - case LogicalTypeId::ARRAY: - return "ARRAY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetLogicalTypeIdValues(), 47, static_cast(value)); } template<> LogicalTypeId EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return LogicalTypeId::INVALID; - } - if (StringUtil::Equals(value, "NULL")) { - return LogicalTypeId::SQLNULL; - } - if (StringUtil::Equals(value, "UNKNOWN")) { - return LogicalTypeId::UNKNOWN; - } - if (StringUtil::Equals(value, "ANY")) { - return LogicalTypeId::ANY; - } - if (StringUtil::Equals(value, "USER")) { - return LogicalTypeId::USER; - } - if (StringUtil::Equals(value, "BOOLEAN")) { - return LogicalTypeId::BOOLEAN; - } - if (StringUtil::Equals(value, "TINYINT")) { - return LogicalTypeId::TINYINT; - } - if (StringUtil::Equals(value, "SMALLINT")) { - return LogicalTypeId::SMALLINT; - } - if (StringUtil::Equals(value, "INTEGER")) { - return LogicalTypeId::INTEGER; - } - if (StringUtil::Equals(value, "BIGINT")) { - return LogicalTypeId::BIGINT; - } - if (StringUtil::Equals(value, "DATE")) { - return LogicalTypeId::DATE; - } - if (StringUtil::Equals(value, "TIME")) { - return LogicalTypeId::TIME; - } - if (StringUtil::Equals(value, "TIMESTAMP_S")) { - return LogicalTypeId::TIMESTAMP_SEC; - } - if (StringUtil::Equals(value, "TIMESTAMP_MS")) { - return LogicalTypeId::TIMESTAMP_MS; - } - if (StringUtil::Equals(value, "TIMESTAMP")) { - return LogicalTypeId::TIMESTAMP; - } - if (StringUtil::Equals(value, "TIMESTAMP_NS")) { - return LogicalTypeId::TIMESTAMP_NS; - } - if (StringUtil::Equals(value, "DECIMAL")) { - return LogicalTypeId::DECIMAL; - } - if (StringUtil::Equals(value, "FLOAT")) { - return LogicalTypeId::FLOAT; - } - if (StringUtil::Equals(value, "DOUBLE")) { - return LogicalTypeId::DOUBLE; - } - if (StringUtil::Equals(value, "CHAR")) { - return LogicalTypeId::CHAR; - } - if (StringUtil::Equals(value, "VARCHAR")) { - return LogicalTypeId::VARCHAR; - } - if (StringUtil::Equals(value, "BLOB")) { - return LogicalTypeId::BLOB; - } - if (StringUtil::Equals(value, "INTERVAL")) { - return LogicalTypeId::INTERVAL; - } - if (StringUtil::Equals(value, "UTINYINT")) { - return LogicalTypeId::UTINYINT; - } - if (StringUtil::Equals(value, "USMALLINT")) { - return LogicalTypeId::USMALLINT; - } - if (StringUtil::Equals(value, "UINTEGER")) { - return LogicalTypeId::UINTEGER; - } - if (StringUtil::Equals(value, "UBIGINT")) { - return LogicalTypeId::UBIGINT; - } - if (StringUtil::Equals(value, "TIMESTAMP WITH TIME ZONE")) { - return LogicalTypeId::TIMESTAMP_TZ; - } - if (StringUtil::Equals(value, "TIME WITH TIME ZONE")) { - return LogicalTypeId::TIME_TZ; - } - if (StringUtil::Equals(value, "BIT")) { - return LogicalTypeId::BIT; - } - if (StringUtil::Equals(value, "STRING_LITERAL")) { - return LogicalTypeId::STRING_LITERAL; - } - if (StringUtil::Equals(value, "INTEGER_LITERAL")) { - return LogicalTypeId::INTEGER_LITERAL; - } - if (StringUtil::Equals(value, "VARINT")) { - return LogicalTypeId::VARINT; - } - if (StringUtil::Equals(value, "UHUGEINT")) { - return LogicalTypeId::UHUGEINT; - } - if (StringUtil::Equals(value, "HUGEINT")) { - return LogicalTypeId::HUGEINT; - } - if (StringUtil::Equals(value, "POINTER")) { - return LogicalTypeId::POINTER; - } - if (StringUtil::Equals(value, "VALIDITY")) { - return LogicalTypeId::VALIDITY; - } - if (StringUtil::Equals(value, "UUID")) { - return LogicalTypeId::UUID; - } - if (StringUtil::Equals(value, "STRUCT")) { - return LogicalTypeId::STRUCT; - } - if (StringUtil::Equals(value, "LIST")) { - return LogicalTypeId::LIST; - } - if (StringUtil::Equals(value, "MAP")) { - return LogicalTypeId::MAP; - } - if (StringUtil::Equals(value, "TABLE")) { - return LogicalTypeId::TABLE; - } - if (StringUtil::Equals(value, "ENUM")) { - return LogicalTypeId::ENUM; - } - if (StringUtil::Equals(value, "AGGREGATE_STATE")) { - return LogicalTypeId::AGGREGATE_STATE; - } - if (StringUtil::Equals(value, "LAMBDA")) { - return LogicalTypeId::LAMBDA; - } - if (StringUtil::Equals(value, "UNION")) { - return LogicalTypeId::UNION; - } - if (StringUtil::Equals(value, "ARRAY")) { - return LogicalTypeId::ARRAY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetLogicalTypeIdValues(), 47, value)); +} + +const StringUtil::EnumStringLiteral *GetLookupResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(LookupResultType::LOOKUP_MISS), "LOOKUP_MISS" }, + { static_cast(LookupResultType::LOOKUP_HIT), "LOOKUP_HIT" }, + { static_cast(LookupResultType::LOOKUP_NULL), "LOOKUP_NULL" } + }; + return values; } template<> const char* EnumUtil::ToChars(LookupResultType value) { - switch(value) { - case LookupResultType::LOOKUP_MISS: - return "LOOKUP_MISS"; - case LookupResultType::LOOKUP_HIT: - return "LOOKUP_HIT"; - case LookupResultType::LOOKUP_NULL: - return "LOOKUP_NULL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetLookupResultTypeValues(), 3, static_cast(value)); } template<> LookupResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LOOKUP_MISS")) { - return LookupResultType::LOOKUP_MISS; - } - if (StringUtil::Equals(value, "LOOKUP_HIT")) { - return LookupResultType::LOOKUP_HIT; - } - if (StringUtil::Equals(value, "LOOKUP_NULL")) { - return LookupResultType::LOOKUP_NULL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetLookupResultTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetMacroTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(MacroType::VOID_MACRO), "VOID_MACRO" }, + { static_cast(MacroType::TABLE_MACRO), "TABLE_MACRO" }, + { static_cast(MacroType::SCALAR_MACRO), "SCALAR_MACRO" } + }; + return values; } template<> const char* EnumUtil::ToChars(MacroType value) { - switch(value) { - case MacroType::VOID_MACRO: - return "VOID_MACRO"; - case MacroType::TABLE_MACRO: - return "TABLE_MACRO"; - case MacroType::SCALAR_MACRO: - return "SCALAR_MACRO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetMacroTypeValues(), 3, static_cast(value)); } template<> MacroType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "VOID_MACRO")) { - return MacroType::VOID_MACRO; - } - if (StringUtil::Equals(value, "TABLE_MACRO")) { - return MacroType::TABLE_MACRO; - } - if (StringUtil::Equals(value, "SCALAR_MACRO")) { - return MacroType::SCALAR_MACRO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetMacroTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetMapInvalidReasonValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(MapInvalidReason::VALID), "VALID" }, + { static_cast(MapInvalidReason::NULL_KEY), "NULL_KEY" }, + { static_cast(MapInvalidReason::DUPLICATE_KEY), "DUPLICATE_KEY" }, + { static_cast(MapInvalidReason::NOT_ALIGNED), "NOT_ALIGNED" }, + { static_cast(MapInvalidReason::INVALID_PARAMS), "INVALID_PARAMS" } + }; + return values; } template<> const char* EnumUtil::ToChars(MapInvalidReason value) { - switch(value) { - case MapInvalidReason::VALID: - return "VALID"; - case MapInvalidReason::NULL_KEY: - return "NULL_KEY"; - case MapInvalidReason::DUPLICATE_KEY: - return "DUPLICATE_KEY"; - case MapInvalidReason::NOT_ALIGNED: - return "NOT_ALIGNED"; - case MapInvalidReason::INVALID_PARAMS: - return "INVALID_PARAMS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetMapInvalidReasonValues(), 5, static_cast(value)); } template<> MapInvalidReason EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "VALID")) { - return MapInvalidReason::VALID; - } - if (StringUtil::Equals(value, "NULL_KEY")) { - return MapInvalidReason::NULL_KEY; - } - if (StringUtil::Equals(value, "DUPLICATE_KEY")) { - return MapInvalidReason::DUPLICATE_KEY; - } - if (StringUtil::Equals(value, "NOT_ALIGNED")) { - return MapInvalidReason::NOT_ALIGNED; - } - if (StringUtil::Equals(value, "INVALID_PARAMS")) { - return MapInvalidReason::INVALID_PARAMS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetMapInvalidReasonValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetMemoryTagValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(MemoryTag::BASE_TABLE), "BASE_TABLE" }, + { static_cast(MemoryTag::HASH_TABLE), "HASH_TABLE" }, + { static_cast(MemoryTag::PARQUET_READER), "PARQUET_READER" }, + { static_cast(MemoryTag::CSV_READER), "CSV_READER" }, + { static_cast(MemoryTag::ORDER_BY), "ORDER_BY" }, + { static_cast(MemoryTag::ART_INDEX), "ART_INDEX" }, + { static_cast(MemoryTag::COLUMN_DATA), "COLUMN_DATA" }, + { static_cast(MemoryTag::METADATA), "METADATA" }, + { static_cast(MemoryTag::OVERFLOW_STRINGS), "OVERFLOW_STRINGS" }, + { static_cast(MemoryTag::IN_MEMORY_TABLE), "IN_MEMORY_TABLE" }, + { static_cast(MemoryTag::ALLOCATOR), "ALLOCATOR" }, + { static_cast(MemoryTag::EXTENSION), "EXTENSION" } + }; + return values; } template<> const char* EnumUtil::ToChars(MemoryTag value) { - switch(value) { - case MemoryTag::BASE_TABLE: - return "BASE_TABLE"; - case MemoryTag::HASH_TABLE: - return "HASH_TABLE"; - case MemoryTag::PARQUET_READER: - return "PARQUET_READER"; - case MemoryTag::CSV_READER: - return "CSV_READER"; - case MemoryTag::ORDER_BY: - return "ORDER_BY"; - case MemoryTag::ART_INDEX: - return "ART_INDEX"; - case MemoryTag::COLUMN_DATA: - return "COLUMN_DATA"; - case MemoryTag::METADATA: - return "METADATA"; - case MemoryTag::OVERFLOW_STRINGS: - return "OVERFLOW_STRINGS"; - case MemoryTag::IN_MEMORY_TABLE: - return "IN_MEMORY_TABLE"; - case MemoryTag::ALLOCATOR: - return "ALLOCATOR"; - case MemoryTag::EXTENSION: - return "EXTENSION"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetMemoryTagValues(), 12, static_cast(value)); } template<> MemoryTag EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BASE_TABLE")) { - return MemoryTag::BASE_TABLE; - } - if (StringUtil::Equals(value, "HASH_TABLE")) { - return MemoryTag::HASH_TABLE; - } - if (StringUtil::Equals(value, "PARQUET_READER")) { - return MemoryTag::PARQUET_READER; - } - if (StringUtil::Equals(value, "CSV_READER")) { - return MemoryTag::CSV_READER; - } - if (StringUtil::Equals(value, "ORDER_BY")) { - return MemoryTag::ORDER_BY; - } - if (StringUtil::Equals(value, "ART_INDEX")) { - return MemoryTag::ART_INDEX; - } - if (StringUtil::Equals(value, "COLUMN_DATA")) { - return MemoryTag::COLUMN_DATA; - } - if (StringUtil::Equals(value, "METADATA")) { - return MemoryTag::METADATA; - } - if (StringUtil::Equals(value, "OVERFLOW_STRINGS")) { - return MemoryTag::OVERFLOW_STRINGS; - } - if (StringUtil::Equals(value, "IN_MEMORY_TABLE")) { - return MemoryTag::IN_MEMORY_TABLE; - } - if (StringUtil::Equals(value, "ALLOCATOR")) { - return MemoryTag::ALLOCATOR; - } - if (StringUtil::Equals(value, "EXTENSION")) { - return MemoryTag::EXTENSION; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetMemoryTagValues(), 12, value)); +} + +const StringUtil::EnumStringLiteral *GetMetaPipelineTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(MetaPipelineType::REGULAR), "REGULAR" }, + { static_cast(MetaPipelineType::JOIN_BUILD), "JOIN_BUILD" } + }; + return values; } template<> const char* EnumUtil::ToChars(MetaPipelineType value) { - switch(value) { - case MetaPipelineType::REGULAR: - return "REGULAR"; - case MetaPipelineType::JOIN_BUILD: - return "JOIN_BUILD"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetMetaPipelineTypeValues(), 2, static_cast(value)); } template<> MetaPipelineType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "REGULAR")) { - return MetaPipelineType::REGULAR; - } - if (StringUtil::Equals(value, "JOIN_BUILD")) { - return MetaPipelineType::JOIN_BUILD; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetMetaPipelineTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetMetricsTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(MetricsType::QUERY_NAME), "QUERY_NAME" }, + { static_cast(MetricsType::BLOCKED_THREAD_TIME), "BLOCKED_THREAD_TIME" }, + { static_cast(MetricsType::CPU_TIME), "CPU_TIME" }, + { static_cast(MetricsType::EXTRA_INFO), "EXTRA_INFO" }, + { static_cast(MetricsType::CUMULATIVE_CARDINALITY), "CUMULATIVE_CARDINALITY" }, + { static_cast(MetricsType::OPERATOR_TYPE), "OPERATOR_TYPE" }, + { static_cast(MetricsType::OPERATOR_CARDINALITY), "OPERATOR_CARDINALITY" }, + { static_cast(MetricsType::CUMULATIVE_ROWS_SCANNED), "CUMULATIVE_ROWS_SCANNED" }, + { static_cast(MetricsType::OPERATOR_ROWS_SCANNED), "OPERATOR_ROWS_SCANNED" }, + { static_cast(MetricsType::OPERATOR_TIMING), "OPERATOR_TIMING" }, + { static_cast(MetricsType::RESULT_SET_SIZE), "RESULT_SET_SIZE" }, + { static_cast(MetricsType::ALL_OPTIMIZERS), "ALL_OPTIMIZERS" }, + { static_cast(MetricsType::CUMULATIVE_OPTIMIZER_TIMING), "CUMULATIVE_OPTIMIZER_TIMING" }, + { static_cast(MetricsType::PLANNER), "PLANNER" }, + { static_cast(MetricsType::PLANNER_BINDING), "PLANNER_BINDING" }, + { static_cast(MetricsType::PHYSICAL_PLANNER), "PHYSICAL_PLANNER" }, + { static_cast(MetricsType::PHYSICAL_PLANNER_COLUMN_BINDING), "PHYSICAL_PLANNER_COLUMN_BINDING" }, + { static_cast(MetricsType::PHYSICAL_PLANNER_RESOLVE_TYPES), "PHYSICAL_PLANNER_RESOLVE_TYPES" }, + { static_cast(MetricsType::PHYSICAL_PLANNER_CREATE_PLAN), "PHYSICAL_PLANNER_CREATE_PLAN" }, + { static_cast(MetricsType::OPTIMIZER_EXPRESSION_REWRITER), "OPTIMIZER_EXPRESSION_REWRITER" }, + { static_cast(MetricsType::OPTIMIZER_FILTER_PULLUP), "OPTIMIZER_FILTER_PULLUP" }, + { static_cast(MetricsType::OPTIMIZER_FILTER_PUSHDOWN), "OPTIMIZER_FILTER_PUSHDOWN" }, + { static_cast(MetricsType::OPTIMIZER_CTE_FILTER_PUSHER), "OPTIMIZER_CTE_FILTER_PUSHER" }, + { static_cast(MetricsType::OPTIMIZER_REGEX_RANGE), "OPTIMIZER_REGEX_RANGE" }, + { static_cast(MetricsType::OPTIMIZER_IN_CLAUSE), "OPTIMIZER_IN_CLAUSE" }, + { static_cast(MetricsType::OPTIMIZER_JOIN_ORDER), "OPTIMIZER_JOIN_ORDER" }, + { static_cast(MetricsType::OPTIMIZER_DELIMINATOR), "OPTIMIZER_DELIMINATOR" }, + { static_cast(MetricsType::OPTIMIZER_UNNEST_REWRITER), "OPTIMIZER_UNNEST_REWRITER" }, + { static_cast(MetricsType::OPTIMIZER_UNUSED_COLUMNS), "OPTIMIZER_UNUSED_COLUMNS" }, + { static_cast(MetricsType::OPTIMIZER_STATISTICS_PROPAGATION), "OPTIMIZER_STATISTICS_PROPAGATION" }, + { static_cast(MetricsType::OPTIMIZER_COMMON_SUBEXPRESSIONS), "OPTIMIZER_COMMON_SUBEXPRESSIONS" }, + { static_cast(MetricsType::OPTIMIZER_COMMON_AGGREGATE), "OPTIMIZER_COMMON_AGGREGATE" }, + { static_cast(MetricsType::OPTIMIZER_COLUMN_LIFETIME), "OPTIMIZER_COLUMN_LIFETIME" }, + { static_cast(MetricsType::OPTIMIZER_BUILD_SIDE_PROBE_SIDE), "OPTIMIZER_BUILD_SIDE_PROBE_SIDE" }, + { static_cast(MetricsType::OPTIMIZER_LIMIT_PUSHDOWN), "OPTIMIZER_LIMIT_PUSHDOWN" }, + { static_cast(MetricsType::OPTIMIZER_TOP_N), "OPTIMIZER_TOP_N" }, + { static_cast(MetricsType::OPTIMIZER_COMPRESSED_MATERIALIZATION), "OPTIMIZER_COMPRESSED_MATERIALIZATION" }, + { static_cast(MetricsType::OPTIMIZER_DUPLICATE_GROUPS), "OPTIMIZER_DUPLICATE_GROUPS" }, + { static_cast(MetricsType::OPTIMIZER_REORDER_FILTER), "OPTIMIZER_REORDER_FILTER" }, + { static_cast(MetricsType::OPTIMIZER_JOIN_FILTER_PUSHDOWN), "OPTIMIZER_JOIN_FILTER_PUSHDOWN" }, + { static_cast(MetricsType::OPTIMIZER_EXTENSION), "OPTIMIZER_EXTENSION" }, + { static_cast(MetricsType::OPTIMIZER_MATERIALIZED_CTE), "OPTIMIZER_MATERIALIZED_CTE" } + }; + return values; } template<> const char* EnumUtil::ToChars(MetricsType value) { - switch(value) { - case MetricsType::QUERY_NAME: - return "QUERY_NAME"; - case MetricsType::BLOCKED_THREAD_TIME: - return "BLOCKED_THREAD_TIME"; - case MetricsType::CPU_TIME: - return "CPU_TIME"; - case MetricsType::EXTRA_INFO: - return "EXTRA_INFO"; - case MetricsType::CUMULATIVE_CARDINALITY: - return "CUMULATIVE_CARDINALITY"; - case MetricsType::OPERATOR_TYPE: - return "OPERATOR_TYPE"; - case MetricsType::OPERATOR_CARDINALITY: - return "OPERATOR_CARDINALITY"; - case MetricsType::CUMULATIVE_ROWS_SCANNED: - return "CUMULATIVE_ROWS_SCANNED"; - case MetricsType::OPERATOR_ROWS_SCANNED: - return "OPERATOR_ROWS_SCANNED"; - case MetricsType::OPERATOR_TIMING: - return "OPERATOR_TIMING"; - case MetricsType::RESULT_SET_SIZE: - return "RESULT_SET_SIZE"; - case MetricsType::ALL_OPTIMIZERS: - return "ALL_OPTIMIZERS"; - case MetricsType::CUMULATIVE_OPTIMIZER_TIMING: - return "CUMULATIVE_OPTIMIZER_TIMING"; - case MetricsType::PLANNER: - return "PLANNER"; - case MetricsType::PLANNER_BINDING: - return "PLANNER_BINDING"; - case MetricsType::PHYSICAL_PLANNER: - return "PHYSICAL_PLANNER"; - case MetricsType::PHYSICAL_PLANNER_COLUMN_BINDING: - return "PHYSICAL_PLANNER_COLUMN_BINDING"; - case MetricsType::PHYSICAL_PLANNER_RESOLVE_TYPES: - return "PHYSICAL_PLANNER_RESOLVE_TYPES"; - case MetricsType::PHYSICAL_PLANNER_CREATE_PLAN: - return "PHYSICAL_PLANNER_CREATE_PLAN"; - case MetricsType::OPTIMIZER_EXPRESSION_REWRITER: - return "OPTIMIZER_EXPRESSION_REWRITER"; - case MetricsType::OPTIMIZER_FILTER_PULLUP: - return "OPTIMIZER_FILTER_PULLUP"; - case MetricsType::OPTIMIZER_FILTER_PUSHDOWN: - return "OPTIMIZER_FILTER_PUSHDOWN"; - case MetricsType::OPTIMIZER_CTE_FILTER_PUSHER: - return "OPTIMIZER_CTE_FILTER_PUSHER"; - case MetricsType::OPTIMIZER_REGEX_RANGE: - return "OPTIMIZER_REGEX_RANGE"; - case MetricsType::OPTIMIZER_IN_CLAUSE: - return "OPTIMIZER_IN_CLAUSE"; - case MetricsType::OPTIMIZER_JOIN_ORDER: - return "OPTIMIZER_JOIN_ORDER"; - case MetricsType::OPTIMIZER_DELIMINATOR: - return "OPTIMIZER_DELIMINATOR"; - case MetricsType::OPTIMIZER_UNNEST_REWRITER: - return "OPTIMIZER_UNNEST_REWRITER"; - case MetricsType::OPTIMIZER_UNUSED_COLUMNS: - return "OPTIMIZER_UNUSED_COLUMNS"; - case MetricsType::OPTIMIZER_STATISTICS_PROPAGATION: - return "OPTIMIZER_STATISTICS_PROPAGATION"; - case MetricsType::OPTIMIZER_COMMON_SUBEXPRESSIONS: - return "OPTIMIZER_COMMON_SUBEXPRESSIONS"; - case MetricsType::OPTIMIZER_COMMON_AGGREGATE: - return "OPTIMIZER_COMMON_AGGREGATE"; - case MetricsType::OPTIMIZER_COLUMN_LIFETIME: - return "OPTIMIZER_COLUMN_LIFETIME"; - case MetricsType::OPTIMIZER_BUILD_SIDE_PROBE_SIDE: - return "OPTIMIZER_BUILD_SIDE_PROBE_SIDE"; - case MetricsType::OPTIMIZER_LIMIT_PUSHDOWN: - return "OPTIMIZER_LIMIT_PUSHDOWN"; - case MetricsType::OPTIMIZER_TOP_N: - return "OPTIMIZER_TOP_N"; - case MetricsType::OPTIMIZER_COMPRESSED_MATERIALIZATION: - return "OPTIMIZER_COMPRESSED_MATERIALIZATION"; - case MetricsType::OPTIMIZER_DUPLICATE_GROUPS: - return "OPTIMIZER_DUPLICATE_GROUPS"; - case MetricsType::OPTIMIZER_REORDER_FILTER: - return "OPTIMIZER_REORDER_FILTER"; - case MetricsType::OPTIMIZER_JOIN_FILTER_PUSHDOWN: - return "OPTIMIZER_JOIN_FILTER_PUSHDOWN"; - case MetricsType::OPTIMIZER_EXTENSION: - return "OPTIMIZER_EXTENSION"; - case MetricsType::OPTIMIZER_MATERIALIZED_CTE: - return "OPTIMIZER_MATERIALIZED_CTE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetMetricsTypeValues(), 42, static_cast(value)); } template<> MetricsType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "QUERY_NAME")) { - return MetricsType::QUERY_NAME; - } - if (StringUtil::Equals(value, "BLOCKED_THREAD_TIME")) { - return MetricsType::BLOCKED_THREAD_TIME; - } - if (StringUtil::Equals(value, "CPU_TIME")) { - return MetricsType::CPU_TIME; - } - if (StringUtil::Equals(value, "EXTRA_INFO")) { - return MetricsType::EXTRA_INFO; - } - if (StringUtil::Equals(value, "CUMULATIVE_CARDINALITY")) { - return MetricsType::CUMULATIVE_CARDINALITY; - } - if (StringUtil::Equals(value, "OPERATOR_TYPE")) { - return MetricsType::OPERATOR_TYPE; - } - if (StringUtil::Equals(value, "OPERATOR_CARDINALITY")) { - return MetricsType::OPERATOR_CARDINALITY; - } - if (StringUtil::Equals(value, "CUMULATIVE_ROWS_SCANNED")) { - return MetricsType::CUMULATIVE_ROWS_SCANNED; - } - if (StringUtil::Equals(value, "OPERATOR_ROWS_SCANNED")) { - return MetricsType::OPERATOR_ROWS_SCANNED; - } - if (StringUtil::Equals(value, "OPERATOR_TIMING")) { - return MetricsType::OPERATOR_TIMING; - } - if (StringUtil::Equals(value, "RESULT_SET_SIZE")) { - return MetricsType::RESULT_SET_SIZE; - } - if (StringUtil::Equals(value, "ALL_OPTIMIZERS")) { - return MetricsType::ALL_OPTIMIZERS; - } - if (StringUtil::Equals(value, "CUMULATIVE_OPTIMIZER_TIMING")) { - return MetricsType::CUMULATIVE_OPTIMIZER_TIMING; - } - if (StringUtil::Equals(value, "PLANNER")) { - return MetricsType::PLANNER; - } - if (StringUtil::Equals(value, "PLANNER_BINDING")) { - return MetricsType::PLANNER_BINDING; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER")) { - return MetricsType::PHYSICAL_PLANNER; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER_COLUMN_BINDING")) { - return MetricsType::PHYSICAL_PLANNER_COLUMN_BINDING; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER_RESOLVE_TYPES")) { - return MetricsType::PHYSICAL_PLANNER_RESOLVE_TYPES; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER_CREATE_PLAN")) { - return MetricsType::PHYSICAL_PLANNER_CREATE_PLAN; - } - if (StringUtil::Equals(value, "OPTIMIZER_EXPRESSION_REWRITER")) { - return MetricsType::OPTIMIZER_EXPRESSION_REWRITER; - } - if (StringUtil::Equals(value, "OPTIMIZER_FILTER_PULLUP")) { - return MetricsType::OPTIMIZER_FILTER_PULLUP; - } - if (StringUtil::Equals(value, "OPTIMIZER_FILTER_PUSHDOWN")) { - return MetricsType::OPTIMIZER_FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_CTE_FILTER_PUSHER")) { - return MetricsType::OPTIMIZER_CTE_FILTER_PUSHER; - } - if (StringUtil::Equals(value, "OPTIMIZER_REGEX_RANGE")) { - return MetricsType::OPTIMIZER_REGEX_RANGE; - } - if (StringUtil::Equals(value, "OPTIMIZER_IN_CLAUSE")) { - return MetricsType::OPTIMIZER_IN_CLAUSE; - } - if (StringUtil::Equals(value, "OPTIMIZER_JOIN_ORDER")) { - return MetricsType::OPTIMIZER_JOIN_ORDER; - } - if (StringUtil::Equals(value, "OPTIMIZER_DELIMINATOR")) { - return MetricsType::OPTIMIZER_DELIMINATOR; - } - if (StringUtil::Equals(value, "OPTIMIZER_UNNEST_REWRITER")) { - return MetricsType::OPTIMIZER_UNNEST_REWRITER; - } - if (StringUtil::Equals(value, "OPTIMIZER_UNUSED_COLUMNS")) { - return MetricsType::OPTIMIZER_UNUSED_COLUMNS; - } - if (StringUtil::Equals(value, "OPTIMIZER_STATISTICS_PROPAGATION")) { - return MetricsType::OPTIMIZER_STATISTICS_PROPAGATION; - } - if (StringUtil::Equals(value, "OPTIMIZER_COMMON_SUBEXPRESSIONS")) { - return MetricsType::OPTIMIZER_COMMON_SUBEXPRESSIONS; - } - if (StringUtil::Equals(value, "OPTIMIZER_COMMON_AGGREGATE")) { - return MetricsType::OPTIMIZER_COMMON_AGGREGATE; - } - if (StringUtil::Equals(value, "OPTIMIZER_COLUMN_LIFETIME")) { - return MetricsType::OPTIMIZER_COLUMN_LIFETIME; - } - if (StringUtil::Equals(value, "OPTIMIZER_BUILD_SIDE_PROBE_SIDE")) { - return MetricsType::OPTIMIZER_BUILD_SIDE_PROBE_SIDE; - } - if (StringUtil::Equals(value, "OPTIMIZER_LIMIT_PUSHDOWN")) { - return MetricsType::OPTIMIZER_LIMIT_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_TOP_N")) { - return MetricsType::OPTIMIZER_TOP_N; - } - if (StringUtil::Equals(value, "OPTIMIZER_COMPRESSED_MATERIALIZATION")) { - return MetricsType::OPTIMIZER_COMPRESSED_MATERIALIZATION; - } - if (StringUtil::Equals(value, "OPTIMIZER_DUPLICATE_GROUPS")) { - return MetricsType::OPTIMIZER_DUPLICATE_GROUPS; - } - if (StringUtil::Equals(value, "OPTIMIZER_REORDER_FILTER")) { - return MetricsType::OPTIMIZER_REORDER_FILTER; - } - if (StringUtil::Equals(value, "OPTIMIZER_JOIN_FILTER_PUSHDOWN")) { - return MetricsType::OPTIMIZER_JOIN_FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_EXTENSION")) { - return MetricsType::OPTIMIZER_EXTENSION; - } - if (StringUtil::Equals(value, "OPTIMIZER_MATERIALIZED_CTE")) { - return MetricsType::OPTIMIZER_MATERIALIZED_CTE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetMetricsTypeValues(), 42, value)); +} + +const StringUtil::EnumStringLiteral *GetNTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(NType::PREFIX), "PREFIX" }, + { static_cast(NType::LEAF), "LEAF" }, + { static_cast(NType::NODE_4), "NODE_4" }, + { static_cast(NType::NODE_16), "NODE_16" }, + { static_cast(NType::NODE_48), "NODE_48" }, + { static_cast(NType::NODE_256), "NODE_256" }, + { static_cast(NType::LEAF_INLINED), "LEAF_INLINED" }, + { static_cast(NType::NODE_7_LEAF), "NODE_7_LEAF" }, + { static_cast(NType::NODE_15_LEAF), "NODE_15_LEAF" }, + { static_cast(NType::NODE_256_LEAF), "NODE_256_LEAF" } + }; + return values; } template<> const char* EnumUtil::ToChars(NType value) { - switch(value) { - case NType::PREFIX: - return "PREFIX"; - case NType::LEAF: - return "LEAF"; - case NType::NODE_4: - return "NODE_4"; - case NType::NODE_16: - return "NODE_16"; - case NType::NODE_48: - return "NODE_48"; - case NType::NODE_256: - return "NODE_256"; - case NType::LEAF_INLINED: - return "LEAF_INLINED"; - case NType::NODE_7_LEAF: - return "NODE_7_LEAF"; - case NType::NODE_15_LEAF: - return "NODE_15_LEAF"; - case NType::NODE_256_LEAF: - return "NODE_256_LEAF"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetNTypeValues(), 10, static_cast(value)); } template<> NType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "PREFIX")) { - return NType::PREFIX; - } - if (StringUtil::Equals(value, "LEAF")) { - return NType::LEAF; - } - if (StringUtil::Equals(value, "NODE_4")) { - return NType::NODE_4; - } - if (StringUtil::Equals(value, "NODE_16")) { - return NType::NODE_16; - } - if (StringUtil::Equals(value, "NODE_48")) { - return NType::NODE_48; - } - if (StringUtil::Equals(value, "NODE_256")) { - return NType::NODE_256; - } - if (StringUtil::Equals(value, "LEAF_INLINED")) { - return NType::LEAF_INLINED; - } - if (StringUtil::Equals(value, "NODE_7_LEAF")) { - return NType::NODE_7_LEAF; - } - if (StringUtil::Equals(value, "NODE_15_LEAF")) { - return NType::NODE_15_LEAF; - } - if (StringUtil::Equals(value, "NODE_256_LEAF")) { - return NType::NODE_256_LEAF; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetNTypeValues(), 10, value)); +} + +const StringUtil::EnumStringLiteral *GetNewLineIdentifierValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(NewLineIdentifier::SINGLE_N), "SINGLE_N" }, + { static_cast(NewLineIdentifier::CARRY_ON), "CARRY_ON" }, + { static_cast(NewLineIdentifier::NOT_SET), "NOT_SET" }, + { static_cast(NewLineIdentifier::SINGLE_R), "SINGLE_R" } + }; + return values; } template<> const char* EnumUtil::ToChars(NewLineIdentifier value) { - switch(value) { - case NewLineIdentifier::SINGLE_N: - return "SINGLE_N"; - case NewLineIdentifier::CARRY_ON: - return "CARRY_ON"; - case NewLineIdentifier::NOT_SET: - return "NOT_SET"; - case NewLineIdentifier::SINGLE_R: - return "SINGLE_R"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetNewLineIdentifierValues(), 4, static_cast(value)); } template<> NewLineIdentifier EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SINGLE_N")) { - return NewLineIdentifier::SINGLE_N; - } - if (StringUtil::Equals(value, "CARRY_ON")) { - return NewLineIdentifier::CARRY_ON; - } - if (StringUtil::Equals(value, "NOT_SET")) { - return NewLineIdentifier::NOT_SET; - } - if (StringUtil::Equals(value, "SINGLE_R")) { - return NewLineIdentifier::SINGLE_R; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetNewLineIdentifierValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetOnConflictActionValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OnConflictAction::THROW), "THROW" }, + { static_cast(OnConflictAction::NOTHING), "NOTHING" }, + { static_cast(OnConflictAction::UPDATE), "UPDATE" }, + { static_cast(OnConflictAction::REPLACE), "REPLACE" } + }; + return values; } template<> const char* EnumUtil::ToChars(OnConflictAction value) { - switch(value) { - case OnConflictAction::THROW: - return "THROW"; - case OnConflictAction::NOTHING: - return "NOTHING"; - case OnConflictAction::UPDATE: - return "UPDATE"; - case OnConflictAction::REPLACE: - return "REPLACE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOnConflictActionValues(), 4, static_cast(value)); } template<> OnConflictAction EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "THROW")) { - return OnConflictAction::THROW; - } - if (StringUtil::Equals(value, "NOTHING")) { - return OnConflictAction::NOTHING; - } - if (StringUtil::Equals(value, "UPDATE")) { - return OnConflictAction::UPDATE; - } - if (StringUtil::Equals(value, "REPLACE")) { - return OnConflictAction::REPLACE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOnConflictActionValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetOnCreateConflictValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OnCreateConflict::ERROR_ON_CONFLICT), "ERROR_ON_CONFLICT" }, + { static_cast(OnCreateConflict::IGNORE_ON_CONFLICT), "IGNORE_ON_CONFLICT" }, + { static_cast(OnCreateConflict::REPLACE_ON_CONFLICT), "REPLACE_ON_CONFLICT" }, + { static_cast(OnCreateConflict::ALTER_ON_CONFLICT), "ALTER_ON_CONFLICT" } + }; + return values; } template<> const char* EnumUtil::ToChars(OnCreateConflict value) { - switch(value) { - case OnCreateConflict::ERROR_ON_CONFLICT: - return "ERROR_ON_CONFLICT"; - case OnCreateConflict::IGNORE_ON_CONFLICT: - return "IGNORE_ON_CONFLICT"; - case OnCreateConflict::REPLACE_ON_CONFLICT: - return "REPLACE_ON_CONFLICT"; - case OnCreateConflict::ALTER_ON_CONFLICT: - return "ALTER_ON_CONFLICT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOnCreateConflictValues(), 4, static_cast(value)); } template<> OnCreateConflict EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ERROR_ON_CONFLICT")) { - return OnCreateConflict::ERROR_ON_CONFLICT; - } - if (StringUtil::Equals(value, "IGNORE_ON_CONFLICT")) { - return OnCreateConflict::IGNORE_ON_CONFLICT; - } - if (StringUtil::Equals(value, "REPLACE_ON_CONFLICT")) { - return OnCreateConflict::REPLACE_ON_CONFLICT; - } - if (StringUtil::Equals(value, "ALTER_ON_CONFLICT")) { - return OnCreateConflict::ALTER_ON_CONFLICT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOnCreateConflictValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetOnEntryNotFoundValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OnEntryNotFound::THROW_EXCEPTION), "THROW_EXCEPTION" }, + { static_cast(OnEntryNotFound::RETURN_NULL), "RETURN_NULL" } + }; + return values; } template<> const char* EnumUtil::ToChars(OnEntryNotFound value) { - switch(value) { - case OnEntryNotFound::THROW_EXCEPTION: - return "THROW_EXCEPTION"; - case OnEntryNotFound::RETURN_NULL: - return "RETURN_NULL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOnEntryNotFoundValues(), 2, static_cast(value)); } template<> OnEntryNotFound EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "THROW_EXCEPTION")) { - return OnEntryNotFound::THROW_EXCEPTION; - } - if (StringUtil::Equals(value, "RETURN_NULL")) { - return OnEntryNotFound::RETURN_NULL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOnEntryNotFoundValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetOperatorFinalizeResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OperatorFinalizeResultType::HAVE_MORE_OUTPUT), "HAVE_MORE_OUTPUT" }, + { static_cast(OperatorFinalizeResultType::FINISHED), "FINISHED" } + }; + return values; } template<> const char* EnumUtil::ToChars(OperatorFinalizeResultType value) { - switch(value) { - case OperatorFinalizeResultType::HAVE_MORE_OUTPUT: - return "HAVE_MORE_OUTPUT"; - case OperatorFinalizeResultType::FINISHED: - return "FINISHED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOperatorFinalizeResultTypeValues(), 2, static_cast(value)); } template<> OperatorFinalizeResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "HAVE_MORE_OUTPUT")) { - return OperatorFinalizeResultType::HAVE_MORE_OUTPUT; - } - if (StringUtil::Equals(value, "FINISHED")) { - return OperatorFinalizeResultType::FINISHED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOperatorFinalizeResultTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetOperatorResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OperatorResultType::NEED_MORE_INPUT), "NEED_MORE_INPUT" }, + { static_cast(OperatorResultType::HAVE_MORE_OUTPUT), "HAVE_MORE_OUTPUT" }, + { static_cast(OperatorResultType::FINISHED), "FINISHED" }, + { static_cast(OperatorResultType::BLOCKED), "BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(OperatorResultType value) { - switch(value) { - case OperatorResultType::NEED_MORE_INPUT: - return "NEED_MORE_INPUT"; - case OperatorResultType::HAVE_MORE_OUTPUT: - return "HAVE_MORE_OUTPUT"; - case OperatorResultType::FINISHED: - return "FINISHED"; - case OperatorResultType::BLOCKED: - return "BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOperatorResultTypeValues(), 4, static_cast(value)); } template<> OperatorResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NEED_MORE_INPUT")) { - return OperatorResultType::NEED_MORE_INPUT; - } - if (StringUtil::Equals(value, "HAVE_MORE_OUTPUT")) { - return OperatorResultType::HAVE_MORE_OUTPUT; - } - if (StringUtil::Equals(value, "FINISHED")) { - return OperatorResultType::FINISHED; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return OperatorResultType::BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOperatorResultTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetOptimizerTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OptimizerType::INVALID), "INVALID" }, + { static_cast(OptimizerType::EXPRESSION_REWRITER), "EXPRESSION_REWRITER" }, + { static_cast(OptimizerType::FILTER_PULLUP), "FILTER_PULLUP" }, + { static_cast(OptimizerType::FILTER_PUSHDOWN), "FILTER_PUSHDOWN" }, + { static_cast(OptimizerType::CTE_FILTER_PUSHER), "CTE_FILTER_PUSHER" }, + { static_cast(OptimizerType::REGEX_RANGE), "REGEX_RANGE" }, + { static_cast(OptimizerType::IN_CLAUSE), "IN_CLAUSE" }, + { static_cast(OptimizerType::JOIN_ORDER), "JOIN_ORDER" }, + { static_cast(OptimizerType::DELIMINATOR), "DELIMINATOR" }, + { static_cast(OptimizerType::UNNEST_REWRITER), "UNNEST_REWRITER" }, + { static_cast(OptimizerType::UNUSED_COLUMNS), "UNUSED_COLUMNS" }, + { static_cast(OptimizerType::STATISTICS_PROPAGATION), "STATISTICS_PROPAGATION" }, + { static_cast(OptimizerType::COMMON_SUBEXPRESSIONS), "COMMON_SUBEXPRESSIONS" }, + { static_cast(OptimizerType::COMMON_AGGREGATE), "COMMON_AGGREGATE" }, + { static_cast(OptimizerType::COLUMN_LIFETIME), "COLUMN_LIFETIME" }, + { static_cast(OptimizerType::BUILD_SIDE_PROBE_SIDE), "BUILD_SIDE_PROBE_SIDE" }, + { static_cast(OptimizerType::LIMIT_PUSHDOWN), "LIMIT_PUSHDOWN" }, + { static_cast(OptimizerType::TOP_N), "TOP_N" }, + { static_cast(OptimizerType::COMPRESSED_MATERIALIZATION), "COMPRESSED_MATERIALIZATION" }, + { static_cast(OptimizerType::DUPLICATE_GROUPS), "DUPLICATE_GROUPS" }, + { static_cast(OptimizerType::REORDER_FILTER), "REORDER_FILTER" }, + { static_cast(OptimizerType::JOIN_FILTER_PUSHDOWN), "JOIN_FILTER_PUSHDOWN" }, + { static_cast(OptimizerType::EXTENSION), "EXTENSION" }, + { static_cast(OptimizerType::MATERIALIZED_CTE), "MATERIALIZED_CTE" } + }; + return values; } template<> const char* EnumUtil::ToChars(OptimizerType value) { - switch(value) { - case OptimizerType::INVALID: - return "INVALID"; - case OptimizerType::EXPRESSION_REWRITER: - return "EXPRESSION_REWRITER"; - case OptimizerType::FILTER_PULLUP: - return "FILTER_PULLUP"; - case OptimizerType::FILTER_PUSHDOWN: - return "FILTER_PUSHDOWN"; - case OptimizerType::CTE_FILTER_PUSHER: - return "CTE_FILTER_PUSHER"; - case OptimizerType::REGEX_RANGE: - return "REGEX_RANGE"; - case OptimizerType::IN_CLAUSE: - return "IN_CLAUSE"; - case OptimizerType::JOIN_ORDER: - return "JOIN_ORDER"; - case OptimizerType::DELIMINATOR: - return "DELIMINATOR"; - case OptimizerType::UNNEST_REWRITER: - return "UNNEST_REWRITER"; - case OptimizerType::UNUSED_COLUMNS: - return "UNUSED_COLUMNS"; - case OptimizerType::STATISTICS_PROPAGATION: - return "STATISTICS_PROPAGATION"; - case OptimizerType::COMMON_SUBEXPRESSIONS: - return "COMMON_SUBEXPRESSIONS"; - case OptimizerType::COMMON_AGGREGATE: - return "COMMON_AGGREGATE"; - case OptimizerType::COLUMN_LIFETIME: - return "COLUMN_LIFETIME"; - case OptimizerType::BUILD_SIDE_PROBE_SIDE: - return "BUILD_SIDE_PROBE_SIDE"; - case OptimizerType::LIMIT_PUSHDOWN: - return "LIMIT_PUSHDOWN"; - case OptimizerType::TOP_N: - return "TOP_N"; - case OptimizerType::COMPRESSED_MATERIALIZATION: - return "COMPRESSED_MATERIALIZATION"; - case OptimizerType::DUPLICATE_GROUPS: - return "DUPLICATE_GROUPS"; - case OptimizerType::REORDER_FILTER: - return "REORDER_FILTER"; - case OptimizerType::JOIN_FILTER_PUSHDOWN: - return "JOIN_FILTER_PUSHDOWN"; - case OptimizerType::EXTENSION: - return "EXTENSION"; - case OptimizerType::MATERIALIZED_CTE: - return "MATERIALIZED_CTE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOptimizerTypeValues(), 24, static_cast(value)); } template<> OptimizerType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return OptimizerType::INVALID; - } - if (StringUtil::Equals(value, "EXPRESSION_REWRITER")) { - return OptimizerType::EXPRESSION_REWRITER; - } - if (StringUtil::Equals(value, "FILTER_PULLUP")) { - return OptimizerType::FILTER_PULLUP; - } - if (StringUtil::Equals(value, "FILTER_PUSHDOWN")) { - return OptimizerType::FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "CTE_FILTER_PUSHER")) { - return OptimizerType::CTE_FILTER_PUSHER; - } - if (StringUtil::Equals(value, "REGEX_RANGE")) { - return OptimizerType::REGEX_RANGE; - } - if (StringUtil::Equals(value, "IN_CLAUSE")) { - return OptimizerType::IN_CLAUSE; - } - if (StringUtil::Equals(value, "JOIN_ORDER")) { - return OptimizerType::JOIN_ORDER; - } - if (StringUtil::Equals(value, "DELIMINATOR")) { - return OptimizerType::DELIMINATOR; - } - if (StringUtil::Equals(value, "UNNEST_REWRITER")) { - return OptimizerType::UNNEST_REWRITER; - } - if (StringUtil::Equals(value, "UNUSED_COLUMNS")) { - return OptimizerType::UNUSED_COLUMNS; - } - if (StringUtil::Equals(value, "STATISTICS_PROPAGATION")) { - return OptimizerType::STATISTICS_PROPAGATION; - } - if (StringUtil::Equals(value, "COMMON_SUBEXPRESSIONS")) { - return OptimizerType::COMMON_SUBEXPRESSIONS; - } - if (StringUtil::Equals(value, "COMMON_AGGREGATE")) { - return OptimizerType::COMMON_AGGREGATE; - } - if (StringUtil::Equals(value, "COLUMN_LIFETIME")) { - return OptimizerType::COLUMN_LIFETIME; - } - if (StringUtil::Equals(value, "BUILD_SIDE_PROBE_SIDE")) { - return OptimizerType::BUILD_SIDE_PROBE_SIDE; - } - if (StringUtil::Equals(value, "LIMIT_PUSHDOWN")) { - return OptimizerType::LIMIT_PUSHDOWN; - } - if (StringUtil::Equals(value, "TOP_N")) { - return OptimizerType::TOP_N; - } - if (StringUtil::Equals(value, "COMPRESSED_MATERIALIZATION")) { - return OptimizerType::COMPRESSED_MATERIALIZATION; - } - if (StringUtil::Equals(value, "DUPLICATE_GROUPS")) { - return OptimizerType::DUPLICATE_GROUPS; - } - if (StringUtil::Equals(value, "REORDER_FILTER")) { - return OptimizerType::REORDER_FILTER; - } - if (StringUtil::Equals(value, "JOIN_FILTER_PUSHDOWN")) { - return OptimizerType::JOIN_FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "EXTENSION")) { - return OptimizerType::EXTENSION; - } - if (StringUtil::Equals(value, "MATERIALIZED_CTE")) { - return OptimizerType::MATERIALIZED_CTE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOptimizerTypeValues(), 24, value)); +} + +const StringUtil::EnumStringLiteral *GetOrderByNullTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OrderByNullType::INVALID), "INVALID" }, + { static_cast(OrderByNullType::ORDER_DEFAULT), "ORDER_DEFAULT" }, + { static_cast(OrderByNullType::NULLS_FIRST), "NULLS_FIRST" }, + { static_cast(OrderByNullType::NULLS_LAST), "NULLS_LAST" } + }; + return values; } template<> const char* EnumUtil::ToChars(OrderByNullType value) { - switch(value) { - case OrderByNullType::INVALID: - return "INVALID"; - case OrderByNullType::ORDER_DEFAULT: - return "ORDER_DEFAULT"; - case OrderByNullType::NULLS_FIRST: - return "NULLS_FIRST"; - case OrderByNullType::NULLS_LAST: - return "NULLS_LAST"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOrderByNullTypeValues(), 4, static_cast(value)); } template<> OrderByNullType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return OrderByNullType::INVALID; - } - if (StringUtil::Equals(value, "ORDER_DEFAULT") || StringUtil::Equals(value, "DEFAULT")) { - return OrderByNullType::ORDER_DEFAULT; - } - if (StringUtil::Equals(value, "NULLS_FIRST") || StringUtil::Equals(value, "NULLS FIRST")) { - return OrderByNullType::NULLS_FIRST; - } - if (StringUtil::Equals(value, "NULLS_LAST") || StringUtil::Equals(value, "NULLS LAST")) { - return OrderByNullType::NULLS_LAST; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOrderByNullTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetOrderPreservationTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OrderPreservationType::NO_ORDER), "NO_ORDER" }, + { static_cast(OrderPreservationType::INSERTION_ORDER), "INSERTION_ORDER" }, + { static_cast(OrderPreservationType::FIXED_ORDER), "FIXED_ORDER" } + }; + return values; } template<> const char* EnumUtil::ToChars(OrderPreservationType value) { - switch(value) { - case OrderPreservationType::NO_ORDER: - return "NO_ORDER"; - case OrderPreservationType::INSERTION_ORDER: - return "INSERTION_ORDER"; - case OrderPreservationType::FIXED_ORDER: - return "FIXED_ORDER"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOrderPreservationTypeValues(), 3, static_cast(value)); } template<> OrderPreservationType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_ORDER")) { - return OrderPreservationType::NO_ORDER; - } - if (StringUtil::Equals(value, "INSERTION_ORDER")) { - return OrderPreservationType::INSERTION_ORDER; - } - if (StringUtil::Equals(value, "FIXED_ORDER")) { - return OrderPreservationType::FIXED_ORDER; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOrderPreservationTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetOrderTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OrderType::INVALID), "INVALID" }, + { static_cast(OrderType::ORDER_DEFAULT), "ORDER_DEFAULT" }, + { static_cast(OrderType::ASCENDING), "ASCENDING" }, + { static_cast(OrderType::DESCENDING), "DESCENDING" } + }; + return values; } template<> const char* EnumUtil::ToChars(OrderType value) { - switch(value) { - case OrderType::INVALID: - return "INVALID"; - case OrderType::ORDER_DEFAULT: - return "ORDER_DEFAULT"; - case OrderType::ASCENDING: - return "ASCENDING"; - case OrderType::DESCENDING: - return "DESCENDING"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOrderTypeValues(), 4, static_cast(value)); } template<> OrderType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return OrderType::INVALID; - } - if (StringUtil::Equals(value, "ORDER_DEFAULT") || StringUtil::Equals(value, "DEFAULT")) { - return OrderType::ORDER_DEFAULT; - } - if (StringUtil::Equals(value, "ASCENDING") || StringUtil::Equals(value, "ASC")) { - return OrderType::ASCENDING; - } - if (StringUtil::Equals(value, "DESCENDING") || StringUtil::Equals(value, "DESC")) { - return OrderType::DESCENDING; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOrderTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetOutputStreamValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(OutputStream::STREAM_STDOUT), "STREAM_STDOUT" }, + { static_cast(OutputStream::STREAM_STDERR), "STREAM_STDERR" } + }; + return values; } template<> const char* EnumUtil::ToChars(OutputStream value) { - switch(value) { - case OutputStream::STREAM_STDOUT: - return "STREAM_STDOUT"; - case OutputStream::STREAM_STDERR: - return "STREAM_STDERR"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetOutputStreamValues(), 2, static_cast(value)); } template<> OutputStream EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STREAM_STDOUT")) { - return OutputStream::STREAM_STDOUT; - } - if (StringUtil::Equals(value, "STREAM_STDERR")) { - return OutputStream::STREAM_STDERR; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetOutputStreamValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetParseInfoTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ParseInfoType::ALTER_INFO), "ALTER_INFO" }, + { static_cast(ParseInfoType::ATTACH_INFO), "ATTACH_INFO" }, + { static_cast(ParseInfoType::COPY_INFO), "COPY_INFO" }, + { static_cast(ParseInfoType::CREATE_INFO), "CREATE_INFO" }, + { static_cast(ParseInfoType::CREATE_SECRET_INFO), "CREATE_SECRET_INFO" }, + { static_cast(ParseInfoType::DETACH_INFO), "DETACH_INFO" }, + { static_cast(ParseInfoType::DROP_INFO), "DROP_INFO" }, + { static_cast(ParseInfoType::BOUND_EXPORT_DATA), "BOUND_EXPORT_DATA" }, + { static_cast(ParseInfoType::LOAD_INFO), "LOAD_INFO" }, + { static_cast(ParseInfoType::PRAGMA_INFO), "PRAGMA_INFO" }, + { static_cast(ParseInfoType::SHOW_SELECT_INFO), "SHOW_SELECT_INFO" }, + { static_cast(ParseInfoType::TRANSACTION_INFO), "TRANSACTION_INFO" }, + { static_cast(ParseInfoType::VACUUM_INFO), "VACUUM_INFO" }, + { static_cast(ParseInfoType::COMMENT_ON_INFO), "COMMENT_ON_INFO" }, + { static_cast(ParseInfoType::COMMENT_ON_COLUMN_INFO), "COMMENT_ON_COLUMN_INFO" }, + { static_cast(ParseInfoType::COPY_DATABASE_INFO), "COPY_DATABASE_INFO" }, + { static_cast(ParseInfoType::UPDATE_EXTENSIONS_INFO), "UPDATE_EXTENSIONS_INFO" } + }; + return values; } template<> const char* EnumUtil::ToChars(ParseInfoType value) { - switch(value) { - case ParseInfoType::ALTER_INFO: - return "ALTER_INFO"; - case ParseInfoType::ATTACH_INFO: - return "ATTACH_INFO"; - case ParseInfoType::COPY_INFO: - return "COPY_INFO"; - case ParseInfoType::CREATE_INFO: - return "CREATE_INFO"; - case ParseInfoType::CREATE_SECRET_INFO: - return "CREATE_SECRET_INFO"; - case ParseInfoType::DETACH_INFO: - return "DETACH_INFO"; - case ParseInfoType::DROP_INFO: - return "DROP_INFO"; - case ParseInfoType::BOUND_EXPORT_DATA: - return "BOUND_EXPORT_DATA"; - case ParseInfoType::LOAD_INFO: - return "LOAD_INFO"; - case ParseInfoType::PRAGMA_INFO: - return "PRAGMA_INFO"; - case ParseInfoType::SHOW_SELECT_INFO: - return "SHOW_SELECT_INFO"; - case ParseInfoType::TRANSACTION_INFO: - return "TRANSACTION_INFO"; - case ParseInfoType::VACUUM_INFO: - return "VACUUM_INFO"; - case ParseInfoType::COMMENT_ON_INFO: - return "COMMENT_ON_INFO"; - case ParseInfoType::COMMENT_ON_COLUMN_INFO: - return "COMMENT_ON_COLUMN_INFO"; - case ParseInfoType::COPY_DATABASE_INFO: - return "COPY_DATABASE_INFO"; - case ParseInfoType::UPDATE_EXTENSIONS_INFO: - return "UPDATE_EXTENSIONS_INFO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetParseInfoTypeValues(), 17, static_cast(value)); } template<> ParseInfoType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ALTER_INFO")) { - return ParseInfoType::ALTER_INFO; - } - if (StringUtil::Equals(value, "ATTACH_INFO")) { - return ParseInfoType::ATTACH_INFO; - } - if (StringUtil::Equals(value, "COPY_INFO")) { - return ParseInfoType::COPY_INFO; - } - if (StringUtil::Equals(value, "CREATE_INFO")) { - return ParseInfoType::CREATE_INFO; - } - if (StringUtil::Equals(value, "CREATE_SECRET_INFO")) { - return ParseInfoType::CREATE_SECRET_INFO; - } - if (StringUtil::Equals(value, "DETACH_INFO")) { - return ParseInfoType::DETACH_INFO; - } - if (StringUtil::Equals(value, "DROP_INFO")) { - return ParseInfoType::DROP_INFO; - } - if (StringUtil::Equals(value, "BOUND_EXPORT_DATA")) { - return ParseInfoType::BOUND_EXPORT_DATA; - } - if (StringUtil::Equals(value, "LOAD_INFO")) { - return ParseInfoType::LOAD_INFO; - } - if (StringUtil::Equals(value, "PRAGMA_INFO")) { - return ParseInfoType::PRAGMA_INFO; - } - if (StringUtil::Equals(value, "SHOW_SELECT_INFO")) { - return ParseInfoType::SHOW_SELECT_INFO; - } - if (StringUtil::Equals(value, "TRANSACTION_INFO")) { - return ParseInfoType::TRANSACTION_INFO; - } - if (StringUtil::Equals(value, "VACUUM_INFO")) { - return ParseInfoType::VACUUM_INFO; - } - if (StringUtil::Equals(value, "COMMENT_ON_INFO")) { - return ParseInfoType::COMMENT_ON_INFO; - } - if (StringUtil::Equals(value, "COMMENT_ON_COLUMN_INFO")) { - return ParseInfoType::COMMENT_ON_COLUMN_INFO; - } - if (StringUtil::Equals(value, "COPY_DATABASE_INFO")) { - return ParseInfoType::COPY_DATABASE_INFO; - } - if (StringUtil::Equals(value, "UPDATE_EXTENSIONS_INFO")) { - return ParseInfoType::UPDATE_EXTENSIONS_INFO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetParseInfoTypeValues(), 17, value)); +} + +const StringUtil::EnumStringLiteral *GetParserExtensionResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ParserExtensionResultType::PARSE_SUCCESSFUL), "PARSE_SUCCESSFUL" }, + { static_cast(ParserExtensionResultType::DISPLAY_ORIGINAL_ERROR), "DISPLAY_ORIGINAL_ERROR" }, + { static_cast(ParserExtensionResultType::DISPLAY_EXTENSION_ERROR), "DISPLAY_EXTENSION_ERROR" } + }; + return values; } template<> const char* EnumUtil::ToChars(ParserExtensionResultType value) { - switch(value) { - case ParserExtensionResultType::PARSE_SUCCESSFUL: - return "PARSE_SUCCESSFUL"; - case ParserExtensionResultType::DISPLAY_ORIGINAL_ERROR: - return "DISPLAY_ORIGINAL_ERROR"; - case ParserExtensionResultType::DISPLAY_EXTENSION_ERROR: - return "DISPLAY_EXTENSION_ERROR"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetParserExtensionResultTypeValues(), 3, static_cast(value)); } template<> ParserExtensionResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "PARSE_SUCCESSFUL")) { - return ParserExtensionResultType::PARSE_SUCCESSFUL; - } - if (StringUtil::Equals(value, "DISPLAY_ORIGINAL_ERROR")) { - return ParserExtensionResultType::DISPLAY_ORIGINAL_ERROR; - } - if (StringUtil::Equals(value, "DISPLAY_EXTENSION_ERROR")) { - return ParserExtensionResultType::DISPLAY_EXTENSION_ERROR; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetParserExtensionResultTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetPartitionSortStageValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PartitionSortStage::INIT), "INIT" }, + { static_cast(PartitionSortStage::SCAN), "SCAN" }, + { static_cast(PartitionSortStage::PREPARE), "PREPARE" }, + { static_cast(PartitionSortStage::MERGE), "MERGE" }, + { static_cast(PartitionSortStage::SORTED), "SORTED" }, + { static_cast(PartitionSortStage::FINISHED), "FINISHED" } + }; + return values; } template<> const char* EnumUtil::ToChars(PartitionSortStage value) { - switch(value) { - case PartitionSortStage::INIT: - return "INIT"; - case PartitionSortStage::SCAN: - return "SCAN"; - case PartitionSortStage::PREPARE: - return "PREPARE"; - case PartitionSortStage::MERGE: - return "MERGE"; - case PartitionSortStage::SORTED: - return "SORTED"; - case PartitionSortStage::FINISHED: - return "FINISHED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPartitionSortStageValues(), 6, static_cast(value)); } template<> PartitionSortStage EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INIT")) { - return PartitionSortStage::INIT; - } - if (StringUtil::Equals(value, "SCAN")) { - return PartitionSortStage::SCAN; - } - if (StringUtil::Equals(value, "PREPARE")) { - return PartitionSortStage::PREPARE; - } - if (StringUtil::Equals(value, "MERGE")) { - return PartitionSortStage::MERGE; - } - if (StringUtil::Equals(value, "SORTED")) { - return PartitionSortStage::SORTED; - } - if (StringUtil::Equals(value, "FINISHED")) { - return PartitionSortStage::FINISHED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPartitionSortStageValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetPartitionedColumnDataTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PartitionedColumnDataType::INVALID), "INVALID" }, + { static_cast(PartitionedColumnDataType::RADIX), "RADIX" }, + { static_cast(PartitionedColumnDataType::HIVE), "HIVE" } + }; + return values; } template<> const char* EnumUtil::ToChars(PartitionedColumnDataType value) { - switch(value) { - case PartitionedColumnDataType::INVALID: - return "INVALID"; - case PartitionedColumnDataType::RADIX: - return "RADIX"; - case PartitionedColumnDataType::HIVE: - return "HIVE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPartitionedColumnDataTypeValues(), 3, static_cast(value)); } template<> PartitionedColumnDataType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return PartitionedColumnDataType::INVALID; - } - if (StringUtil::Equals(value, "RADIX")) { - return PartitionedColumnDataType::RADIX; - } - if (StringUtil::Equals(value, "HIVE")) { - return PartitionedColumnDataType::HIVE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPartitionedColumnDataTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetPartitionedTupleDataTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PartitionedTupleDataType::INVALID), "INVALID" }, + { static_cast(PartitionedTupleDataType::RADIX), "RADIX" } + }; + return values; } template<> const char* EnumUtil::ToChars(PartitionedTupleDataType value) { - switch(value) { - case PartitionedTupleDataType::INVALID: - return "INVALID"; - case PartitionedTupleDataType::RADIX: - return "RADIX"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPartitionedTupleDataTypeValues(), 2, static_cast(value)); } template<> PartitionedTupleDataType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return PartitionedTupleDataType::INVALID; - } - if (StringUtil::Equals(value, "RADIX")) { - return PartitionedTupleDataType::RADIX; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPartitionedTupleDataTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetPendingExecutionResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PendingExecutionResult::RESULT_READY), "RESULT_READY" }, + { static_cast(PendingExecutionResult::RESULT_NOT_READY), "RESULT_NOT_READY" }, + { static_cast(PendingExecutionResult::EXECUTION_ERROR), "EXECUTION_ERROR" }, + { static_cast(PendingExecutionResult::BLOCKED), "BLOCKED" }, + { static_cast(PendingExecutionResult::NO_TASKS_AVAILABLE), "NO_TASKS_AVAILABLE" }, + { static_cast(PendingExecutionResult::EXECUTION_FINISHED), "EXECUTION_FINISHED" } + }; + return values; } template<> const char* EnumUtil::ToChars(PendingExecutionResult value) { - switch(value) { - case PendingExecutionResult::RESULT_READY: - return "RESULT_READY"; - case PendingExecutionResult::RESULT_NOT_READY: - return "RESULT_NOT_READY"; - case PendingExecutionResult::EXECUTION_ERROR: - return "EXECUTION_ERROR"; - case PendingExecutionResult::BLOCKED: - return "BLOCKED"; - case PendingExecutionResult::NO_TASKS_AVAILABLE: - return "NO_TASKS_AVAILABLE"; - case PendingExecutionResult::EXECUTION_FINISHED: - return "EXECUTION_FINISHED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPendingExecutionResultValues(), 6, static_cast(value)); } template<> PendingExecutionResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "RESULT_READY")) { - return PendingExecutionResult::RESULT_READY; - } - if (StringUtil::Equals(value, "RESULT_NOT_READY")) { - return PendingExecutionResult::RESULT_NOT_READY; - } - if (StringUtil::Equals(value, "EXECUTION_ERROR")) { - return PendingExecutionResult::EXECUTION_ERROR; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return PendingExecutionResult::BLOCKED; - } - if (StringUtil::Equals(value, "NO_TASKS_AVAILABLE")) { - return PendingExecutionResult::NO_TASKS_AVAILABLE; - } - if (StringUtil::Equals(value, "EXECUTION_FINISHED")) { - return PendingExecutionResult::EXECUTION_FINISHED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPendingExecutionResultValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetPhysicalOperatorTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PhysicalOperatorType::INVALID), "INVALID" }, + { static_cast(PhysicalOperatorType::ORDER_BY), "ORDER_BY" }, + { static_cast(PhysicalOperatorType::LIMIT), "LIMIT" }, + { static_cast(PhysicalOperatorType::STREAMING_LIMIT), "STREAMING_LIMIT" }, + { static_cast(PhysicalOperatorType::LIMIT_PERCENT), "LIMIT_PERCENT" }, + { static_cast(PhysicalOperatorType::TOP_N), "TOP_N" }, + { static_cast(PhysicalOperatorType::WINDOW), "WINDOW" }, + { static_cast(PhysicalOperatorType::UNNEST), "UNNEST" }, + { static_cast(PhysicalOperatorType::UNGROUPED_AGGREGATE), "UNGROUPED_AGGREGATE" }, + { static_cast(PhysicalOperatorType::HASH_GROUP_BY), "HASH_GROUP_BY" }, + { static_cast(PhysicalOperatorType::PERFECT_HASH_GROUP_BY), "PERFECT_HASH_GROUP_BY" }, + { static_cast(PhysicalOperatorType::FILTER), "FILTER" }, + { static_cast(PhysicalOperatorType::PROJECTION), "PROJECTION" }, + { static_cast(PhysicalOperatorType::COPY_TO_FILE), "COPY_TO_FILE" }, + { static_cast(PhysicalOperatorType::BATCH_COPY_TO_FILE), "BATCH_COPY_TO_FILE" }, + { static_cast(PhysicalOperatorType::RESERVOIR_SAMPLE), "RESERVOIR_SAMPLE" }, + { static_cast(PhysicalOperatorType::STREAMING_SAMPLE), "STREAMING_SAMPLE" }, + { static_cast(PhysicalOperatorType::STREAMING_WINDOW), "STREAMING_WINDOW" }, + { static_cast(PhysicalOperatorType::PIVOT), "PIVOT" }, + { static_cast(PhysicalOperatorType::COPY_DATABASE), "COPY_DATABASE" }, + { static_cast(PhysicalOperatorType::TABLE_SCAN), "TABLE_SCAN" }, + { static_cast(PhysicalOperatorType::DUMMY_SCAN), "DUMMY_SCAN" }, + { static_cast(PhysicalOperatorType::COLUMN_DATA_SCAN), "COLUMN_DATA_SCAN" }, + { static_cast(PhysicalOperatorType::CHUNK_SCAN), "CHUNK_SCAN" }, + { static_cast(PhysicalOperatorType::RECURSIVE_CTE_SCAN), "RECURSIVE_CTE_SCAN" }, + { static_cast(PhysicalOperatorType::CTE_SCAN), "CTE_SCAN" }, + { static_cast(PhysicalOperatorType::DELIM_SCAN), "DELIM_SCAN" }, + { static_cast(PhysicalOperatorType::EXPRESSION_SCAN), "EXPRESSION_SCAN" }, + { static_cast(PhysicalOperatorType::POSITIONAL_SCAN), "POSITIONAL_SCAN" }, + { static_cast(PhysicalOperatorType::BLOCKWISE_NL_JOIN), "BLOCKWISE_NL_JOIN" }, + { static_cast(PhysicalOperatorType::NESTED_LOOP_JOIN), "NESTED_LOOP_JOIN" }, + { static_cast(PhysicalOperatorType::HASH_JOIN), "HASH_JOIN" }, + { static_cast(PhysicalOperatorType::CROSS_PRODUCT), "CROSS_PRODUCT" }, + { static_cast(PhysicalOperatorType::PIECEWISE_MERGE_JOIN), "PIECEWISE_MERGE_JOIN" }, + { static_cast(PhysicalOperatorType::IE_JOIN), "IE_JOIN" }, + { static_cast(PhysicalOperatorType::LEFT_DELIM_JOIN), "LEFT_DELIM_JOIN" }, + { static_cast(PhysicalOperatorType::RIGHT_DELIM_JOIN), "RIGHT_DELIM_JOIN" }, + { static_cast(PhysicalOperatorType::POSITIONAL_JOIN), "POSITIONAL_JOIN" }, + { static_cast(PhysicalOperatorType::ASOF_JOIN), "ASOF_JOIN" }, + { static_cast(PhysicalOperatorType::UNION), "UNION" }, + { static_cast(PhysicalOperatorType::RECURSIVE_CTE), "RECURSIVE_CTE" }, + { static_cast(PhysicalOperatorType::CTE), "CTE" }, + { static_cast(PhysicalOperatorType::INSERT), "INSERT" }, + { static_cast(PhysicalOperatorType::BATCH_INSERT), "BATCH_INSERT" }, + { static_cast(PhysicalOperatorType::DELETE_OPERATOR), "DELETE_OPERATOR" }, + { static_cast(PhysicalOperatorType::UPDATE), "UPDATE" }, + { static_cast(PhysicalOperatorType::CREATE_TABLE), "CREATE_TABLE" }, + { static_cast(PhysicalOperatorType::CREATE_TABLE_AS), "CREATE_TABLE_AS" }, + { static_cast(PhysicalOperatorType::BATCH_CREATE_TABLE_AS), "BATCH_CREATE_TABLE_AS" }, + { static_cast(PhysicalOperatorType::CREATE_INDEX), "CREATE_INDEX" }, + { static_cast(PhysicalOperatorType::ALTER), "ALTER" }, + { static_cast(PhysicalOperatorType::CREATE_SEQUENCE), "CREATE_SEQUENCE" }, + { static_cast(PhysicalOperatorType::CREATE_VIEW), "CREATE_VIEW" }, + { static_cast(PhysicalOperatorType::CREATE_SCHEMA), "CREATE_SCHEMA" }, + { static_cast(PhysicalOperatorType::CREATE_MACRO), "CREATE_MACRO" }, + { static_cast(PhysicalOperatorType::DROP), "DROP" }, + { static_cast(PhysicalOperatorType::PRAGMA), "PRAGMA" }, + { static_cast(PhysicalOperatorType::TRANSACTION), "TRANSACTION" }, + { static_cast(PhysicalOperatorType::CREATE_TYPE), "CREATE_TYPE" }, + { static_cast(PhysicalOperatorType::ATTACH), "ATTACH" }, + { static_cast(PhysicalOperatorType::DETACH), "DETACH" }, + { static_cast(PhysicalOperatorType::EXPLAIN), "EXPLAIN" }, + { static_cast(PhysicalOperatorType::EXPLAIN_ANALYZE), "EXPLAIN_ANALYZE" }, + { static_cast(PhysicalOperatorType::EMPTY_RESULT), "EMPTY_RESULT" }, + { static_cast(PhysicalOperatorType::EXECUTE), "EXECUTE" }, + { static_cast(PhysicalOperatorType::PREPARE), "PREPARE" }, + { static_cast(PhysicalOperatorType::VACUUM), "VACUUM" }, + { static_cast(PhysicalOperatorType::EXPORT), "EXPORT" }, + { static_cast(PhysicalOperatorType::SET), "SET" }, + { static_cast(PhysicalOperatorType::SET_VARIABLE), "SET_VARIABLE" }, + { static_cast(PhysicalOperatorType::LOAD), "LOAD" }, + { static_cast(PhysicalOperatorType::INOUT_FUNCTION), "INOUT_FUNCTION" }, + { static_cast(PhysicalOperatorType::RESULT_COLLECTOR), "RESULT_COLLECTOR" }, + { static_cast(PhysicalOperatorType::RESET), "RESET" }, + { static_cast(PhysicalOperatorType::EXTENSION), "EXTENSION" }, + { static_cast(PhysicalOperatorType::VERIFY_VECTOR), "VERIFY_VECTOR" }, + { static_cast(PhysicalOperatorType::UPDATE_EXTENSIONS), "UPDATE_EXTENSIONS" }, + { static_cast(PhysicalOperatorType::CREATE_SECRET), "CREATE_SECRET" } + }; + return values; } template<> const char* EnumUtil::ToChars(PhysicalOperatorType value) { - switch(value) { - case PhysicalOperatorType::INVALID: - return "INVALID"; - case PhysicalOperatorType::ORDER_BY: - return "ORDER_BY"; - case PhysicalOperatorType::LIMIT: - return "LIMIT"; - case PhysicalOperatorType::STREAMING_LIMIT: - return "STREAMING_LIMIT"; - case PhysicalOperatorType::LIMIT_PERCENT: - return "LIMIT_PERCENT"; - case PhysicalOperatorType::TOP_N: - return "TOP_N"; - case PhysicalOperatorType::WINDOW: - return "WINDOW"; - case PhysicalOperatorType::UNNEST: - return "UNNEST"; - case PhysicalOperatorType::UNGROUPED_AGGREGATE: - return "UNGROUPED_AGGREGATE"; - case PhysicalOperatorType::HASH_GROUP_BY: - return "HASH_GROUP_BY"; - case PhysicalOperatorType::PERFECT_HASH_GROUP_BY: - return "PERFECT_HASH_GROUP_BY"; - case PhysicalOperatorType::FILTER: - return "FILTER"; - case PhysicalOperatorType::PROJECTION: - return "PROJECTION"; - case PhysicalOperatorType::COPY_TO_FILE: - return "COPY_TO_FILE"; - case PhysicalOperatorType::BATCH_COPY_TO_FILE: - return "BATCH_COPY_TO_FILE"; - case PhysicalOperatorType::RESERVOIR_SAMPLE: - return "RESERVOIR_SAMPLE"; - case PhysicalOperatorType::STREAMING_SAMPLE: - return "STREAMING_SAMPLE"; - case PhysicalOperatorType::STREAMING_WINDOW: - return "STREAMING_WINDOW"; - case PhysicalOperatorType::PIVOT: - return "PIVOT"; - case PhysicalOperatorType::COPY_DATABASE: - return "COPY_DATABASE"; - case PhysicalOperatorType::TABLE_SCAN: - return "TABLE_SCAN"; - case PhysicalOperatorType::DUMMY_SCAN: - return "DUMMY_SCAN"; - case PhysicalOperatorType::COLUMN_DATA_SCAN: - return "COLUMN_DATA_SCAN"; - case PhysicalOperatorType::CHUNK_SCAN: - return "CHUNK_SCAN"; - case PhysicalOperatorType::RECURSIVE_CTE_SCAN: - return "RECURSIVE_CTE_SCAN"; - case PhysicalOperatorType::CTE_SCAN: - return "CTE_SCAN"; - case PhysicalOperatorType::DELIM_SCAN: - return "DELIM_SCAN"; - case PhysicalOperatorType::EXPRESSION_SCAN: - return "EXPRESSION_SCAN"; - case PhysicalOperatorType::POSITIONAL_SCAN: - return "POSITIONAL_SCAN"; - case PhysicalOperatorType::BLOCKWISE_NL_JOIN: - return "BLOCKWISE_NL_JOIN"; - case PhysicalOperatorType::NESTED_LOOP_JOIN: - return "NESTED_LOOP_JOIN"; - case PhysicalOperatorType::HASH_JOIN: - return "HASH_JOIN"; - case PhysicalOperatorType::CROSS_PRODUCT: - return "CROSS_PRODUCT"; - case PhysicalOperatorType::PIECEWISE_MERGE_JOIN: - return "PIECEWISE_MERGE_JOIN"; - case PhysicalOperatorType::IE_JOIN: - return "IE_JOIN"; - case PhysicalOperatorType::LEFT_DELIM_JOIN: - return "LEFT_DELIM_JOIN"; - case PhysicalOperatorType::RIGHT_DELIM_JOIN: - return "RIGHT_DELIM_JOIN"; - case PhysicalOperatorType::POSITIONAL_JOIN: - return "POSITIONAL_JOIN"; - case PhysicalOperatorType::ASOF_JOIN: - return "ASOF_JOIN"; - case PhysicalOperatorType::UNION: - return "UNION"; - case PhysicalOperatorType::RECURSIVE_CTE: - return "RECURSIVE_CTE"; - case PhysicalOperatorType::CTE: - return "CTE"; - case PhysicalOperatorType::INSERT: - return "INSERT"; - case PhysicalOperatorType::BATCH_INSERT: - return "BATCH_INSERT"; - case PhysicalOperatorType::DELETE_OPERATOR: - return "DELETE_OPERATOR"; - case PhysicalOperatorType::UPDATE: - return "UPDATE"; - case PhysicalOperatorType::CREATE_TABLE: - return "CREATE_TABLE"; - case PhysicalOperatorType::CREATE_TABLE_AS: - return "CREATE_TABLE_AS"; - case PhysicalOperatorType::BATCH_CREATE_TABLE_AS: - return "BATCH_CREATE_TABLE_AS"; - case PhysicalOperatorType::CREATE_INDEX: - return "CREATE_INDEX"; - case PhysicalOperatorType::ALTER: - return "ALTER"; - case PhysicalOperatorType::CREATE_SEQUENCE: - return "CREATE_SEQUENCE"; - case PhysicalOperatorType::CREATE_VIEW: - return "CREATE_VIEW"; - case PhysicalOperatorType::CREATE_SCHEMA: - return "CREATE_SCHEMA"; - case PhysicalOperatorType::CREATE_MACRO: - return "CREATE_MACRO"; - case PhysicalOperatorType::DROP: - return "DROP"; - case PhysicalOperatorType::PRAGMA: - return "PRAGMA"; - case PhysicalOperatorType::TRANSACTION: - return "TRANSACTION"; - case PhysicalOperatorType::CREATE_TYPE: - return "CREATE_TYPE"; - case PhysicalOperatorType::ATTACH: - return "ATTACH"; - case PhysicalOperatorType::DETACH: - return "DETACH"; - case PhysicalOperatorType::EXPLAIN: - return "EXPLAIN"; - case PhysicalOperatorType::EXPLAIN_ANALYZE: - return "EXPLAIN_ANALYZE"; - case PhysicalOperatorType::EMPTY_RESULT: - return "EMPTY_RESULT"; - case PhysicalOperatorType::EXECUTE: - return "EXECUTE"; - case PhysicalOperatorType::PREPARE: - return "PREPARE"; - case PhysicalOperatorType::VACUUM: - return "VACUUM"; - case PhysicalOperatorType::EXPORT: - return "EXPORT"; - case PhysicalOperatorType::SET: - return "SET"; - case PhysicalOperatorType::SET_VARIABLE: - return "SET_VARIABLE"; - case PhysicalOperatorType::LOAD: - return "LOAD"; - case PhysicalOperatorType::INOUT_FUNCTION: - return "INOUT_FUNCTION"; - case PhysicalOperatorType::RESULT_COLLECTOR: - return "RESULT_COLLECTOR"; - case PhysicalOperatorType::RESET: - return "RESET"; - case PhysicalOperatorType::EXTENSION: - return "EXTENSION"; - case PhysicalOperatorType::VERIFY_VECTOR: - return "VERIFY_VECTOR"; - case PhysicalOperatorType::UPDATE_EXTENSIONS: - return "UPDATE_EXTENSIONS"; - case PhysicalOperatorType::CREATE_SECRET: - return "CREATE_SECRET"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPhysicalOperatorTypeValues(), 78, static_cast(value)); } template<> PhysicalOperatorType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return PhysicalOperatorType::INVALID; - } - if (StringUtil::Equals(value, "ORDER_BY")) { - return PhysicalOperatorType::ORDER_BY; - } - if (StringUtil::Equals(value, "LIMIT")) { - return PhysicalOperatorType::LIMIT; - } - if (StringUtil::Equals(value, "STREAMING_LIMIT")) { - return PhysicalOperatorType::STREAMING_LIMIT; - } - if (StringUtil::Equals(value, "LIMIT_PERCENT")) { - return PhysicalOperatorType::LIMIT_PERCENT; - } - if (StringUtil::Equals(value, "TOP_N")) { - return PhysicalOperatorType::TOP_N; - } - if (StringUtil::Equals(value, "WINDOW")) { - return PhysicalOperatorType::WINDOW; - } - if (StringUtil::Equals(value, "UNNEST")) { - return PhysicalOperatorType::UNNEST; - } - if (StringUtil::Equals(value, "UNGROUPED_AGGREGATE")) { - return PhysicalOperatorType::UNGROUPED_AGGREGATE; - } - if (StringUtil::Equals(value, "HASH_GROUP_BY")) { - return PhysicalOperatorType::HASH_GROUP_BY; - } - if (StringUtil::Equals(value, "PERFECT_HASH_GROUP_BY")) { - return PhysicalOperatorType::PERFECT_HASH_GROUP_BY; - } - if (StringUtil::Equals(value, "FILTER")) { - return PhysicalOperatorType::FILTER; - } - if (StringUtil::Equals(value, "PROJECTION")) { - return PhysicalOperatorType::PROJECTION; - } - if (StringUtil::Equals(value, "COPY_TO_FILE")) { - return PhysicalOperatorType::COPY_TO_FILE; - } - if (StringUtil::Equals(value, "BATCH_COPY_TO_FILE")) { - return PhysicalOperatorType::BATCH_COPY_TO_FILE; - } - if (StringUtil::Equals(value, "RESERVOIR_SAMPLE")) { - return PhysicalOperatorType::RESERVOIR_SAMPLE; - } - if (StringUtil::Equals(value, "STREAMING_SAMPLE")) { - return PhysicalOperatorType::STREAMING_SAMPLE; - } - if (StringUtil::Equals(value, "STREAMING_WINDOW")) { - return PhysicalOperatorType::STREAMING_WINDOW; - } - if (StringUtil::Equals(value, "PIVOT")) { - return PhysicalOperatorType::PIVOT; - } - if (StringUtil::Equals(value, "COPY_DATABASE")) { - return PhysicalOperatorType::COPY_DATABASE; - } - if (StringUtil::Equals(value, "TABLE_SCAN")) { - return PhysicalOperatorType::TABLE_SCAN; - } - if (StringUtil::Equals(value, "DUMMY_SCAN")) { - return PhysicalOperatorType::DUMMY_SCAN; - } - if (StringUtil::Equals(value, "COLUMN_DATA_SCAN")) { - return PhysicalOperatorType::COLUMN_DATA_SCAN; - } - if (StringUtil::Equals(value, "CHUNK_SCAN")) { - return PhysicalOperatorType::CHUNK_SCAN; - } - if (StringUtil::Equals(value, "RECURSIVE_CTE_SCAN")) { - return PhysicalOperatorType::RECURSIVE_CTE_SCAN; - } - if (StringUtil::Equals(value, "CTE_SCAN")) { - return PhysicalOperatorType::CTE_SCAN; - } - if (StringUtil::Equals(value, "DELIM_SCAN")) { - return PhysicalOperatorType::DELIM_SCAN; - } - if (StringUtil::Equals(value, "EXPRESSION_SCAN")) { - return PhysicalOperatorType::EXPRESSION_SCAN; - } - if (StringUtil::Equals(value, "POSITIONAL_SCAN")) { - return PhysicalOperatorType::POSITIONAL_SCAN; - } - if (StringUtil::Equals(value, "BLOCKWISE_NL_JOIN")) { - return PhysicalOperatorType::BLOCKWISE_NL_JOIN; - } - if (StringUtil::Equals(value, "NESTED_LOOP_JOIN")) { - return PhysicalOperatorType::NESTED_LOOP_JOIN; - } - if (StringUtil::Equals(value, "HASH_JOIN")) { - return PhysicalOperatorType::HASH_JOIN; - } - if (StringUtil::Equals(value, "CROSS_PRODUCT")) { - return PhysicalOperatorType::CROSS_PRODUCT; - } - if (StringUtil::Equals(value, "PIECEWISE_MERGE_JOIN")) { - return PhysicalOperatorType::PIECEWISE_MERGE_JOIN; - } - if (StringUtil::Equals(value, "IE_JOIN")) { - return PhysicalOperatorType::IE_JOIN; - } - if (StringUtil::Equals(value, "LEFT_DELIM_JOIN")) { - return PhysicalOperatorType::LEFT_DELIM_JOIN; - } - if (StringUtil::Equals(value, "RIGHT_DELIM_JOIN")) { - return PhysicalOperatorType::RIGHT_DELIM_JOIN; - } - if (StringUtil::Equals(value, "POSITIONAL_JOIN")) { - return PhysicalOperatorType::POSITIONAL_JOIN; - } - if (StringUtil::Equals(value, "ASOF_JOIN")) { - return PhysicalOperatorType::ASOF_JOIN; - } - if (StringUtil::Equals(value, "UNION")) { - return PhysicalOperatorType::UNION; - } - if (StringUtil::Equals(value, "RECURSIVE_CTE")) { - return PhysicalOperatorType::RECURSIVE_CTE; - } - if (StringUtil::Equals(value, "CTE")) { - return PhysicalOperatorType::CTE; - } - if (StringUtil::Equals(value, "INSERT")) { - return PhysicalOperatorType::INSERT; - } - if (StringUtil::Equals(value, "BATCH_INSERT")) { - return PhysicalOperatorType::BATCH_INSERT; - } - if (StringUtil::Equals(value, "DELETE_OPERATOR")) { - return PhysicalOperatorType::DELETE_OPERATOR; - } - if (StringUtil::Equals(value, "UPDATE")) { - return PhysicalOperatorType::UPDATE; - } - if (StringUtil::Equals(value, "CREATE_TABLE")) { - return PhysicalOperatorType::CREATE_TABLE; - } - if (StringUtil::Equals(value, "CREATE_TABLE_AS")) { - return PhysicalOperatorType::CREATE_TABLE_AS; - } - if (StringUtil::Equals(value, "BATCH_CREATE_TABLE_AS")) { - return PhysicalOperatorType::BATCH_CREATE_TABLE_AS; - } - if (StringUtil::Equals(value, "CREATE_INDEX")) { - return PhysicalOperatorType::CREATE_INDEX; - } - if (StringUtil::Equals(value, "ALTER")) { - return PhysicalOperatorType::ALTER; - } - if (StringUtil::Equals(value, "CREATE_SEQUENCE")) { - return PhysicalOperatorType::CREATE_SEQUENCE; - } - if (StringUtil::Equals(value, "CREATE_VIEW")) { - return PhysicalOperatorType::CREATE_VIEW; - } - if (StringUtil::Equals(value, "CREATE_SCHEMA")) { - return PhysicalOperatorType::CREATE_SCHEMA; - } - if (StringUtil::Equals(value, "CREATE_MACRO")) { - return PhysicalOperatorType::CREATE_MACRO; - } - if (StringUtil::Equals(value, "DROP")) { - return PhysicalOperatorType::DROP; - } - if (StringUtil::Equals(value, "PRAGMA")) { - return PhysicalOperatorType::PRAGMA; - } - if (StringUtil::Equals(value, "TRANSACTION")) { - return PhysicalOperatorType::TRANSACTION; - } - if (StringUtil::Equals(value, "CREATE_TYPE")) { - return PhysicalOperatorType::CREATE_TYPE; - } - if (StringUtil::Equals(value, "ATTACH")) { - return PhysicalOperatorType::ATTACH; - } - if (StringUtil::Equals(value, "DETACH")) { - return PhysicalOperatorType::DETACH; - } - if (StringUtil::Equals(value, "EXPLAIN")) { - return PhysicalOperatorType::EXPLAIN; - } - if (StringUtil::Equals(value, "EXPLAIN_ANALYZE")) { - return PhysicalOperatorType::EXPLAIN_ANALYZE; - } - if (StringUtil::Equals(value, "EMPTY_RESULT")) { - return PhysicalOperatorType::EMPTY_RESULT; - } - if (StringUtil::Equals(value, "EXECUTE")) { - return PhysicalOperatorType::EXECUTE; - } - if (StringUtil::Equals(value, "PREPARE")) { - return PhysicalOperatorType::PREPARE; - } - if (StringUtil::Equals(value, "VACUUM")) { - return PhysicalOperatorType::VACUUM; - } - if (StringUtil::Equals(value, "EXPORT")) { - return PhysicalOperatorType::EXPORT; - } - if (StringUtil::Equals(value, "SET")) { - return PhysicalOperatorType::SET; - } - if (StringUtil::Equals(value, "SET_VARIABLE")) { - return PhysicalOperatorType::SET_VARIABLE; - } - if (StringUtil::Equals(value, "LOAD")) { - return PhysicalOperatorType::LOAD; - } - if (StringUtil::Equals(value, "INOUT_FUNCTION")) { - return PhysicalOperatorType::INOUT_FUNCTION; - } - if (StringUtil::Equals(value, "RESULT_COLLECTOR")) { - return PhysicalOperatorType::RESULT_COLLECTOR; - } - if (StringUtil::Equals(value, "RESET")) { - return PhysicalOperatorType::RESET; - } - if (StringUtil::Equals(value, "EXTENSION")) { - return PhysicalOperatorType::EXTENSION; - } - if (StringUtil::Equals(value, "VERIFY_VECTOR")) { - return PhysicalOperatorType::VERIFY_VECTOR; - } - if (StringUtil::Equals(value, "UPDATE_EXTENSIONS")) { - return PhysicalOperatorType::UPDATE_EXTENSIONS; - } - if (StringUtil::Equals(value, "CREATE_SECRET")) { - return PhysicalOperatorType::CREATE_SECRET; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPhysicalOperatorTypeValues(), 78, value)); +} + +const StringUtil::EnumStringLiteral *GetPhysicalTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PhysicalType::BOOL), "BOOL" }, + { static_cast(PhysicalType::UINT8), "UINT8" }, + { static_cast(PhysicalType::INT8), "INT8" }, + { static_cast(PhysicalType::UINT16), "UINT16" }, + { static_cast(PhysicalType::INT16), "INT16" }, + { static_cast(PhysicalType::UINT32), "UINT32" }, + { static_cast(PhysicalType::INT32), "INT32" }, + { static_cast(PhysicalType::UINT64), "UINT64" }, + { static_cast(PhysicalType::INT64), "INT64" }, + { static_cast(PhysicalType::FLOAT), "FLOAT" }, + { static_cast(PhysicalType::DOUBLE), "DOUBLE" }, + { static_cast(PhysicalType::INTERVAL), "INTERVAL" }, + { static_cast(PhysicalType::LIST), "LIST" }, + { static_cast(PhysicalType::STRUCT), "STRUCT" }, + { static_cast(PhysicalType::ARRAY), "ARRAY" }, + { static_cast(PhysicalType::VARCHAR), "VARCHAR" }, + { static_cast(PhysicalType::UINT128), "UINT128" }, + { static_cast(PhysicalType::INT128), "INT128" }, + { static_cast(PhysicalType::UNKNOWN), "UNKNOWN" }, + { static_cast(PhysicalType::BIT), "BIT" }, + { static_cast(PhysicalType::INVALID), "INVALID" } + }; + return values; } template<> const char* EnumUtil::ToChars(PhysicalType value) { - switch(value) { - case PhysicalType::BOOL: - return "BOOL"; - case PhysicalType::UINT8: - return "UINT8"; - case PhysicalType::INT8: - return "INT8"; - case PhysicalType::UINT16: - return "UINT16"; - case PhysicalType::INT16: - return "INT16"; - case PhysicalType::UINT32: - return "UINT32"; - case PhysicalType::INT32: - return "INT32"; - case PhysicalType::UINT64: - return "UINT64"; - case PhysicalType::INT64: - return "INT64"; - case PhysicalType::FLOAT: - return "FLOAT"; - case PhysicalType::DOUBLE: - return "DOUBLE"; - case PhysicalType::INTERVAL: - return "INTERVAL"; - case PhysicalType::LIST: - return "LIST"; - case PhysicalType::STRUCT: - return "STRUCT"; - case PhysicalType::ARRAY: - return "ARRAY"; - case PhysicalType::VARCHAR: - return "VARCHAR"; - case PhysicalType::UINT128: - return "UINT128"; - case PhysicalType::INT128: - return "INT128"; - case PhysicalType::UNKNOWN: - return "UNKNOWN"; - case PhysicalType::BIT: - return "BIT"; - case PhysicalType::INVALID: - return "INVALID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPhysicalTypeValues(), 21, static_cast(value)); } template<> PhysicalType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BOOL")) { - return PhysicalType::BOOL; - } - if (StringUtil::Equals(value, "UINT8")) { - return PhysicalType::UINT8; - } - if (StringUtil::Equals(value, "INT8")) { - return PhysicalType::INT8; - } - if (StringUtil::Equals(value, "UINT16")) { - return PhysicalType::UINT16; - } - if (StringUtil::Equals(value, "INT16")) { - return PhysicalType::INT16; - } - if (StringUtil::Equals(value, "UINT32")) { - return PhysicalType::UINT32; - } - if (StringUtil::Equals(value, "INT32")) { - return PhysicalType::INT32; - } - if (StringUtil::Equals(value, "UINT64")) { - return PhysicalType::UINT64; - } - if (StringUtil::Equals(value, "INT64")) { - return PhysicalType::INT64; - } - if (StringUtil::Equals(value, "FLOAT")) { - return PhysicalType::FLOAT; - } - if (StringUtil::Equals(value, "DOUBLE")) { - return PhysicalType::DOUBLE; - } - if (StringUtil::Equals(value, "INTERVAL")) { - return PhysicalType::INTERVAL; - } - if (StringUtil::Equals(value, "LIST")) { - return PhysicalType::LIST; - } - if (StringUtil::Equals(value, "STRUCT")) { - return PhysicalType::STRUCT; - } - if (StringUtil::Equals(value, "ARRAY")) { - return PhysicalType::ARRAY; - } - if (StringUtil::Equals(value, "VARCHAR")) { - return PhysicalType::VARCHAR; - } - if (StringUtil::Equals(value, "UINT128")) { - return PhysicalType::UINT128; - } - if (StringUtil::Equals(value, "INT128")) { - return PhysicalType::INT128; - } - if (StringUtil::Equals(value, "UNKNOWN")) { - return PhysicalType::UNKNOWN; - } - if (StringUtil::Equals(value, "BIT")) { - return PhysicalType::BIT; - } - if (StringUtil::Equals(value, "INVALID")) { - return PhysicalType::INVALID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPhysicalTypeValues(), 21, value)); +} + +const StringUtil::EnumStringLiteral *GetPragmaTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PragmaType::PRAGMA_STATEMENT), "PRAGMA_STATEMENT" }, + { static_cast(PragmaType::PRAGMA_CALL), "PRAGMA_CALL" } + }; + return values; } template<> const char* EnumUtil::ToChars(PragmaType value) { - switch(value) { - case PragmaType::PRAGMA_STATEMENT: - return "PRAGMA_STATEMENT"; - case PragmaType::PRAGMA_CALL: - return "PRAGMA_CALL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPragmaTypeValues(), 2, static_cast(value)); } template<> PragmaType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "PRAGMA_STATEMENT")) { - return PragmaType::PRAGMA_STATEMENT; - } - if (StringUtil::Equals(value, "PRAGMA_CALL")) { - return PragmaType::PRAGMA_CALL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPragmaTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetPreparedParamTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PreparedParamType::AUTO_INCREMENT), "AUTO_INCREMENT" }, + { static_cast(PreparedParamType::POSITIONAL), "POSITIONAL" }, + { static_cast(PreparedParamType::NAMED), "NAMED" }, + { static_cast(PreparedParamType::INVALID), "INVALID" } + }; + return values; } template<> const char* EnumUtil::ToChars(PreparedParamType value) { - switch(value) { - case PreparedParamType::AUTO_INCREMENT: - return "AUTO_INCREMENT"; - case PreparedParamType::POSITIONAL: - return "POSITIONAL"; - case PreparedParamType::NAMED: - return "NAMED"; - case PreparedParamType::INVALID: - return "INVALID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPreparedParamTypeValues(), 4, static_cast(value)); } template<> PreparedParamType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "AUTO_INCREMENT")) { - return PreparedParamType::AUTO_INCREMENT; - } - if (StringUtil::Equals(value, "POSITIONAL")) { - return PreparedParamType::POSITIONAL; - } - if (StringUtil::Equals(value, "NAMED")) { - return PreparedParamType::NAMED; - } - if (StringUtil::Equals(value, "INVALID")) { - return PreparedParamType::INVALID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPreparedParamTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetPreparedStatementModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(PreparedStatementMode::PREPARE_ONLY), "PREPARE_ONLY" }, + { static_cast(PreparedStatementMode::PREPARE_AND_EXECUTE), "PREPARE_AND_EXECUTE" } + }; + return values; } template<> const char* EnumUtil::ToChars(PreparedStatementMode value) { - switch(value) { - case PreparedStatementMode::PREPARE_ONLY: - return "PREPARE_ONLY"; - case PreparedStatementMode::PREPARE_AND_EXECUTE: - return "PREPARE_AND_EXECUTE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetPreparedStatementModeValues(), 2, static_cast(value)); } template<> PreparedStatementMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "PREPARE_ONLY")) { - return PreparedStatementMode::PREPARE_ONLY; - } - if (StringUtil::Equals(value, "PREPARE_AND_EXECUTE")) { - return PreparedStatementMode::PREPARE_AND_EXECUTE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetPreparedStatementModeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetProfilerPrintFormatValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ProfilerPrintFormat::QUERY_TREE), "QUERY_TREE" }, + { static_cast(ProfilerPrintFormat::JSON), "JSON" }, + { static_cast(ProfilerPrintFormat::QUERY_TREE_OPTIMIZER), "QUERY_TREE_OPTIMIZER" }, + { static_cast(ProfilerPrintFormat::NO_OUTPUT), "NO_OUTPUT" } + }; + return values; } template<> const char* EnumUtil::ToChars(ProfilerPrintFormat value) { - switch(value) { - case ProfilerPrintFormat::QUERY_TREE: - return "QUERY_TREE"; - case ProfilerPrintFormat::JSON: - return "JSON"; - case ProfilerPrintFormat::QUERY_TREE_OPTIMIZER: - return "QUERY_TREE_OPTIMIZER"; - case ProfilerPrintFormat::NO_OUTPUT: - return "NO_OUTPUT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetProfilerPrintFormatValues(), 4, static_cast(value)); } template<> ProfilerPrintFormat EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "QUERY_TREE")) { - return ProfilerPrintFormat::QUERY_TREE; - } - if (StringUtil::Equals(value, "JSON")) { - return ProfilerPrintFormat::JSON; - } - if (StringUtil::Equals(value, "QUERY_TREE_OPTIMIZER")) { - return ProfilerPrintFormat::QUERY_TREE_OPTIMIZER; - } - if (StringUtil::Equals(value, "NO_OUTPUT")) { - return ProfilerPrintFormat::NO_OUTPUT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetProfilerPrintFormatValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetQuantileSerializationTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(QuantileSerializationType::NON_DECIMAL), "NON_DECIMAL" }, + { static_cast(QuantileSerializationType::DECIMAL_DISCRETE), "DECIMAL_DISCRETE" }, + { static_cast(QuantileSerializationType::DECIMAL_DISCRETE_LIST), "DECIMAL_DISCRETE_LIST" }, + { static_cast(QuantileSerializationType::DECIMAL_CONTINUOUS), "DECIMAL_CONTINUOUS" }, + { static_cast(QuantileSerializationType::DECIMAL_CONTINUOUS_LIST), "DECIMAL_CONTINUOUS_LIST" } + }; + return values; } template<> const char* EnumUtil::ToChars(QuantileSerializationType value) { - switch(value) { - case QuantileSerializationType::NON_DECIMAL: - return "NON_DECIMAL"; - case QuantileSerializationType::DECIMAL_DISCRETE: - return "DECIMAL_DISCRETE"; - case QuantileSerializationType::DECIMAL_DISCRETE_LIST: - return "DECIMAL_DISCRETE_LIST"; - case QuantileSerializationType::DECIMAL_CONTINUOUS: - return "DECIMAL_CONTINUOUS"; - case QuantileSerializationType::DECIMAL_CONTINUOUS_LIST: - return "DECIMAL_CONTINUOUS_LIST"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetQuantileSerializationTypeValues(), 5, static_cast(value)); } template<> QuantileSerializationType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NON_DECIMAL")) { - return QuantileSerializationType::NON_DECIMAL; - } - if (StringUtil::Equals(value, "DECIMAL_DISCRETE")) { - return QuantileSerializationType::DECIMAL_DISCRETE; - } - if (StringUtil::Equals(value, "DECIMAL_DISCRETE_LIST")) { - return QuantileSerializationType::DECIMAL_DISCRETE_LIST; - } - if (StringUtil::Equals(value, "DECIMAL_CONTINUOUS")) { - return QuantileSerializationType::DECIMAL_CONTINUOUS; - } - if (StringUtil::Equals(value, "DECIMAL_CONTINUOUS_LIST")) { - return QuantileSerializationType::DECIMAL_CONTINUOUS_LIST; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetQuantileSerializationTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetQueryNodeTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(QueryNodeType::SELECT_NODE), "SELECT_NODE" }, + { static_cast(QueryNodeType::SET_OPERATION_NODE), "SET_OPERATION_NODE" }, + { static_cast(QueryNodeType::BOUND_SUBQUERY_NODE), "BOUND_SUBQUERY_NODE" }, + { static_cast(QueryNodeType::RECURSIVE_CTE_NODE), "RECURSIVE_CTE_NODE" }, + { static_cast(QueryNodeType::CTE_NODE), "CTE_NODE" } + }; + return values; } template<> const char* EnumUtil::ToChars(QueryNodeType value) { - switch(value) { - case QueryNodeType::SELECT_NODE: - return "SELECT_NODE"; - case QueryNodeType::SET_OPERATION_NODE: - return "SET_OPERATION_NODE"; - case QueryNodeType::BOUND_SUBQUERY_NODE: - return "BOUND_SUBQUERY_NODE"; - case QueryNodeType::RECURSIVE_CTE_NODE: - return "RECURSIVE_CTE_NODE"; - case QueryNodeType::CTE_NODE: - return "CTE_NODE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetQueryNodeTypeValues(), 5, static_cast(value)); } template<> QueryNodeType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SELECT_NODE")) { - return QueryNodeType::SELECT_NODE; - } - if (StringUtil::Equals(value, "SET_OPERATION_NODE")) { - return QueryNodeType::SET_OPERATION_NODE; - } - if (StringUtil::Equals(value, "BOUND_SUBQUERY_NODE")) { - return QueryNodeType::BOUND_SUBQUERY_NODE; - } - if (StringUtil::Equals(value, "RECURSIVE_CTE_NODE")) { - return QueryNodeType::RECURSIVE_CTE_NODE; - } - if (StringUtil::Equals(value, "CTE_NODE")) { - return QueryNodeType::CTE_NODE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetQueryNodeTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetQueryResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(QueryResultType::MATERIALIZED_RESULT), "MATERIALIZED_RESULT" }, + { static_cast(QueryResultType::STREAM_RESULT), "STREAM_RESULT" }, + { static_cast(QueryResultType::PENDING_RESULT), "PENDING_RESULT" }, + { static_cast(QueryResultType::ARROW_RESULT), "ARROW_RESULT" } + }; + return values; } template<> const char* EnumUtil::ToChars(QueryResultType value) { - switch(value) { - case QueryResultType::MATERIALIZED_RESULT: - return "MATERIALIZED_RESULT"; - case QueryResultType::STREAM_RESULT: - return "STREAM_RESULT"; - case QueryResultType::PENDING_RESULT: - return "PENDING_RESULT"; - case QueryResultType::ARROW_RESULT: - return "ARROW_RESULT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetQueryResultTypeValues(), 4, static_cast(value)); } template<> QueryResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "MATERIALIZED_RESULT")) { - return QueryResultType::MATERIALIZED_RESULT; - } - if (StringUtil::Equals(value, "STREAM_RESULT")) { - return QueryResultType::STREAM_RESULT; - } - if (StringUtil::Equals(value, "PENDING_RESULT")) { - return QueryResultType::PENDING_RESULT; - } - if (StringUtil::Equals(value, "ARROW_RESULT")) { - return QueryResultType::ARROW_RESULT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetQueryResultTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetQuoteRuleValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(QuoteRule::QUOTES_RFC), "QUOTES_RFC" }, + { static_cast(QuoteRule::QUOTES_OTHER), "QUOTES_OTHER" }, + { static_cast(QuoteRule::NO_QUOTES), "NO_QUOTES" } + }; + return values; } template<> const char* EnumUtil::ToChars(QuoteRule value) { - switch(value) { - case QuoteRule::QUOTES_RFC: - return "QUOTES_RFC"; - case QuoteRule::QUOTES_OTHER: - return "QUOTES_OTHER"; - case QuoteRule::NO_QUOTES: - return "NO_QUOTES"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetQuoteRuleValues(), 3, static_cast(value)); } template<> QuoteRule EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "QUOTES_RFC")) { - return QuoteRule::QUOTES_RFC; - } - if (StringUtil::Equals(value, "QUOTES_OTHER")) { - return QuoteRule::QUOTES_OTHER; - } - if (StringUtil::Equals(value, "NO_QUOTES")) { - return QuoteRule::NO_QUOTES; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetQuoteRuleValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetRelationTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(RelationType::INVALID_RELATION), "INVALID_RELATION" }, + { static_cast(RelationType::TABLE_RELATION), "TABLE_RELATION" }, + { static_cast(RelationType::PROJECTION_RELATION), "PROJECTION_RELATION" }, + { static_cast(RelationType::FILTER_RELATION), "FILTER_RELATION" }, + { static_cast(RelationType::EXPLAIN_RELATION), "EXPLAIN_RELATION" }, + { static_cast(RelationType::CROSS_PRODUCT_RELATION), "CROSS_PRODUCT_RELATION" }, + { static_cast(RelationType::JOIN_RELATION), "JOIN_RELATION" }, + { static_cast(RelationType::AGGREGATE_RELATION), "AGGREGATE_RELATION" }, + { static_cast(RelationType::SET_OPERATION_RELATION), "SET_OPERATION_RELATION" }, + { static_cast(RelationType::DISTINCT_RELATION), "DISTINCT_RELATION" }, + { static_cast(RelationType::LIMIT_RELATION), "LIMIT_RELATION" }, + { static_cast(RelationType::ORDER_RELATION), "ORDER_RELATION" }, + { static_cast(RelationType::CREATE_VIEW_RELATION), "CREATE_VIEW_RELATION" }, + { static_cast(RelationType::CREATE_TABLE_RELATION), "CREATE_TABLE_RELATION" }, + { static_cast(RelationType::INSERT_RELATION), "INSERT_RELATION" }, + { static_cast(RelationType::VALUE_LIST_RELATION), "VALUE_LIST_RELATION" }, + { static_cast(RelationType::MATERIALIZED_RELATION), "MATERIALIZED_RELATION" }, + { static_cast(RelationType::DELETE_RELATION), "DELETE_RELATION" }, + { static_cast(RelationType::UPDATE_RELATION), "UPDATE_RELATION" }, + { static_cast(RelationType::WRITE_CSV_RELATION), "WRITE_CSV_RELATION" }, + { static_cast(RelationType::WRITE_PARQUET_RELATION), "WRITE_PARQUET_RELATION" }, + { static_cast(RelationType::READ_CSV_RELATION), "READ_CSV_RELATION" }, + { static_cast(RelationType::SUBQUERY_RELATION), "SUBQUERY_RELATION" }, + { static_cast(RelationType::TABLE_FUNCTION_RELATION), "TABLE_FUNCTION_RELATION" }, + { static_cast(RelationType::VIEW_RELATION), "VIEW_RELATION" }, + { static_cast(RelationType::QUERY_RELATION), "QUERY_RELATION" }, + { static_cast(RelationType::DELIM_JOIN_RELATION), "DELIM_JOIN_RELATION" }, + { static_cast(RelationType::DELIM_GET_RELATION), "DELIM_GET_RELATION" } + }; + return values; } template<> const char* EnumUtil::ToChars(RelationType value) { - switch(value) { - case RelationType::INVALID_RELATION: - return "INVALID_RELATION"; - case RelationType::TABLE_RELATION: - return "TABLE_RELATION"; - case RelationType::PROJECTION_RELATION: - return "PROJECTION_RELATION"; - case RelationType::FILTER_RELATION: - return "FILTER_RELATION"; - case RelationType::EXPLAIN_RELATION: - return "EXPLAIN_RELATION"; - case RelationType::CROSS_PRODUCT_RELATION: - return "CROSS_PRODUCT_RELATION"; - case RelationType::JOIN_RELATION: - return "JOIN_RELATION"; - case RelationType::AGGREGATE_RELATION: - return "AGGREGATE_RELATION"; - case RelationType::SET_OPERATION_RELATION: - return "SET_OPERATION_RELATION"; - case RelationType::DISTINCT_RELATION: - return "DISTINCT_RELATION"; - case RelationType::LIMIT_RELATION: - return "LIMIT_RELATION"; - case RelationType::ORDER_RELATION: - return "ORDER_RELATION"; - case RelationType::CREATE_VIEW_RELATION: - return "CREATE_VIEW_RELATION"; - case RelationType::CREATE_TABLE_RELATION: - return "CREATE_TABLE_RELATION"; - case RelationType::INSERT_RELATION: - return "INSERT_RELATION"; - case RelationType::VALUE_LIST_RELATION: - return "VALUE_LIST_RELATION"; - case RelationType::MATERIALIZED_RELATION: - return "MATERIALIZED_RELATION"; - case RelationType::DELETE_RELATION: - return "DELETE_RELATION"; - case RelationType::UPDATE_RELATION: - return "UPDATE_RELATION"; - case RelationType::WRITE_CSV_RELATION: - return "WRITE_CSV_RELATION"; - case RelationType::WRITE_PARQUET_RELATION: - return "WRITE_PARQUET_RELATION"; - case RelationType::READ_CSV_RELATION: - return "READ_CSV_RELATION"; - case RelationType::SUBQUERY_RELATION: - return "SUBQUERY_RELATION"; - case RelationType::TABLE_FUNCTION_RELATION: - return "TABLE_FUNCTION_RELATION"; - case RelationType::VIEW_RELATION: - return "VIEW_RELATION"; - case RelationType::QUERY_RELATION: - return "QUERY_RELATION"; - case RelationType::DELIM_JOIN_RELATION: - return "DELIM_JOIN_RELATION"; - case RelationType::DELIM_GET_RELATION: - return "DELIM_GET_RELATION"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetRelationTypeValues(), 28, static_cast(value)); } template<> RelationType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID_RELATION")) { - return RelationType::INVALID_RELATION; - } - if (StringUtil::Equals(value, "TABLE_RELATION")) { - return RelationType::TABLE_RELATION; - } - if (StringUtil::Equals(value, "PROJECTION_RELATION")) { - return RelationType::PROJECTION_RELATION; - } - if (StringUtil::Equals(value, "FILTER_RELATION")) { - return RelationType::FILTER_RELATION; - } - if (StringUtil::Equals(value, "EXPLAIN_RELATION")) { - return RelationType::EXPLAIN_RELATION; - } - if (StringUtil::Equals(value, "CROSS_PRODUCT_RELATION")) { - return RelationType::CROSS_PRODUCT_RELATION; - } - if (StringUtil::Equals(value, "JOIN_RELATION")) { - return RelationType::JOIN_RELATION; - } - if (StringUtil::Equals(value, "AGGREGATE_RELATION")) { - return RelationType::AGGREGATE_RELATION; - } - if (StringUtil::Equals(value, "SET_OPERATION_RELATION")) { - return RelationType::SET_OPERATION_RELATION; - } - if (StringUtil::Equals(value, "DISTINCT_RELATION")) { - return RelationType::DISTINCT_RELATION; - } - if (StringUtil::Equals(value, "LIMIT_RELATION")) { - return RelationType::LIMIT_RELATION; - } - if (StringUtil::Equals(value, "ORDER_RELATION")) { - return RelationType::ORDER_RELATION; - } - if (StringUtil::Equals(value, "CREATE_VIEW_RELATION")) { - return RelationType::CREATE_VIEW_RELATION; - } - if (StringUtil::Equals(value, "CREATE_TABLE_RELATION")) { - return RelationType::CREATE_TABLE_RELATION; - } - if (StringUtil::Equals(value, "INSERT_RELATION")) { - return RelationType::INSERT_RELATION; - } - if (StringUtil::Equals(value, "VALUE_LIST_RELATION")) { - return RelationType::VALUE_LIST_RELATION; - } - if (StringUtil::Equals(value, "MATERIALIZED_RELATION")) { - return RelationType::MATERIALIZED_RELATION; - } - if (StringUtil::Equals(value, "DELETE_RELATION")) { - return RelationType::DELETE_RELATION; - } - if (StringUtil::Equals(value, "UPDATE_RELATION")) { - return RelationType::UPDATE_RELATION; - } - if (StringUtil::Equals(value, "WRITE_CSV_RELATION")) { - return RelationType::WRITE_CSV_RELATION; - } - if (StringUtil::Equals(value, "WRITE_PARQUET_RELATION")) { - return RelationType::WRITE_PARQUET_RELATION; - } - if (StringUtil::Equals(value, "READ_CSV_RELATION")) { - return RelationType::READ_CSV_RELATION; - } - if (StringUtil::Equals(value, "SUBQUERY_RELATION")) { - return RelationType::SUBQUERY_RELATION; - } - if (StringUtil::Equals(value, "TABLE_FUNCTION_RELATION")) { - return RelationType::TABLE_FUNCTION_RELATION; - } - if (StringUtil::Equals(value, "VIEW_RELATION")) { - return RelationType::VIEW_RELATION; - } - if (StringUtil::Equals(value, "QUERY_RELATION")) { - return RelationType::QUERY_RELATION; - } - if (StringUtil::Equals(value, "DELIM_JOIN_RELATION")) { - return RelationType::DELIM_JOIN_RELATION; - } - if (StringUtil::Equals(value, "DELIM_GET_RELATION")) { - return RelationType::DELIM_GET_RELATION; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetRelationTypeValues(), 28, value)); +} + +const StringUtil::EnumStringLiteral *GetRenderModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(RenderMode::ROWS), "ROWS" }, + { static_cast(RenderMode::COLUMNS), "COLUMNS" } + }; + return values; } template<> const char* EnumUtil::ToChars(RenderMode value) { - switch(value) { - case RenderMode::ROWS: - return "ROWS"; - case RenderMode::COLUMNS: - return "COLUMNS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetRenderModeValues(), 2, static_cast(value)); } template<> RenderMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ROWS")) { - return RenderMode::ROWS; - } - if (StringUtil::Equals(value, "COLUMNS")) { - return RenderMode::COLUMNS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetRenderModeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetResultModifierTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ResultModifierType::LIMIT_MODIFIER), "LIMIT_MODIFIER" }, + { static_cast(ResultModifierType::ORDER_MODIFIER), "ORDER_MODIFIER" }, + { static_cast(ResultModifierType::DISTINCT_MODIFIER), "DISTINCT_MODIFIER" }, + { static_cast(ResultModifierType::LIMIT_PERCENT_MODIFIER), "LIMIT_PERCENT_MODIFIER" } + }; + return values; } template<> const char* EnumUtil::ToChars(ResultModifierType value) { - switch(value) { - case ResultModifierType::LIMIT_MODIFIER: - return "LIMIT_MODIFIER"; - case ResultModifierType::ORDER_MODIFIER: - return "ORDER_MODIFIER"; - case ResultModifierType::DISTINCT_MODIFIER: - return "DISTINCT_MODIFIER"; - case ResultModifierType::LIMIT_PERCENT_MODIFIER: - return "LIMIT_PERCENT_MODIFIER"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetResultModifierTypeValues(), 4, static_cast(value)); } template<> ResultModifierType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "LIMIT_MODIFIER")) { - return ResultModifierType::LIMIT_MODIFIER; - } - if (StringUtil::Equals(value, "ORDER_MODIFIER")) { - return ResultModifierType::ORDER_MODIFIER; - } - if (StringUtil::Equals(value, "DISTINCT_MODIFIER")) { - return ResultModifierType::DISTINCT_MODIFIER; - } - if (StringUtil::Equals(value, "LIMIT_PERCENT_MODIFIER")) { - return ResultModifierType::LIMIT_PERCENT_MODIFIER; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetResultModifierTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetSampleMethodValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SampleMethod::SYSTEM_SAMPLE), "System" }, + { static_cast(SampleMethod::BERNOULLI_SAMPLE), "Bernoulli" }, + { static_cast(SampleMethod::RESERVOIR_SAMPLE), "Reservoir" } + }; + return values; } template<> const char* EnumUtil::ToChars(SampleMethod value) { - switch(value) { - case SampleMethod::SYSTEM_SAMPLE: - return "System"; - case SampleMethod::BERNOULLI_SAMPLE: - return "Bernoulli"; - case SampleMethod::RESERVOIR_SAMPLE: - return "Reservoir"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSampleMethodValues(), 3, static_cast(value)); } template<> SampleMethod EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "System")) { - return SampleMethod::SYSTEM_SAMPLE; - } - if (StringUtil::Equals(value, "Bernoulli")) { - return SampleMethod::BERNOULLI_SAMPLE; - } - if (StringUtil::Equals(value, "Reservoir")) { - return SampleMethod::RESERVOIR_SAMPLE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSampleMethodValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetSampleTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SampleType::BLOCKING_SAMPLE), "BLOCKING_SAMPLE" }, + { static_cast(SampleType::RESERVOIR_SAMPLE), "RESERVOIR_SAMPLE" }, + { static_cast(SampleType::RESERVOIR_PERCENTAGE_SAMPLE), "RESERVOIR_PERCENTAGE_SAMPLE" } + }; + return values; } template<> const char* EnumUtil::ToChars(SampleType value) { - switch(value) { - case SampleType::BLOCKING_SAMPLE: - return "BLOCKING_SAMPLE"; - case SampleType::RESERVOIR_SAMPLE: - return "RESERVOIR_SAMPLE"; - case SampleType::RESERVOIR_PERCENTAGE_SAMPLE: - return "RESERVOIR_PERCENTAGE_SAMPLE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSampleTypeValues(), 3, static_cast(value)); } template<> SampleType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "BLOCKING_SAMPLE")) { - return SampleType::BLOCKING_SAMPLE; - } - if (StringUtil::Equals(value, "RESERVOIR_SAMPLE")) { - return SampleType::RESERVOIR_SAMPLE; - } - if (StringUtil::Equals(value, "RESERVOIR_PERCENTAGE_SAMPLE")) { - return SampleType::RESERVOIR_PERCENTAGE_SAMPLE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSampleTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetScanTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ScanType::TABLE), "TABLE" }, + { static_cast(ScanType::PARQUET), "PARQUET" }, + { static_cast(ScanType::EXTERNAL), "EXTERNAL" } + }; + return values; } template<> const char* EnumUtil::ToChars(ScanType value) { - switch(value) { - case ScanType::TABLE: - return "TABLE"; - case ScanType::PARQUET: - return "PARQUET"; - case ScanType::EXTERNAL: - return "EXTERNAL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetScanTypeValues(), 3, static_cast(value)); } template<> ScanType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "TABLE")) { - return ScanType::TABLE; - } - if (StringUtil::Equals(value, "PARQUET")) { - return ScanType::PARQUET; - } - if (StringUtil::Equals(value, "EXTERNAL")) { - return ScanType::EXTERNAL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetScanTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetSecretDisplayTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SecretDisplayType::REDACTED), "REDACTED" }, + { static_cast(SecretDisplayType::UNREDACTED), "UNREDACTED" } + }; + return values; } template<> const char* EnumUtil::ToChars(SecretDisplayType value) { - switch(value) { - case SecretDisplayType::REDACTED: - return "REDACTED"; - case SecretDisplayType::UNREDACTED: - return "UNREDACTED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSecretDisplayTypeValues(), 2, static_cast(value)); } template<> SecretDisplayType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "REDACTED")) { - return SecretDisplayType::REDACTED; - } - if (StringUtil::Equals(value, "UNREDACTED")) { - return SecretDisplayType::UNREDACTED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSecretDisplayTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetSecretPersistTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SecretPersistType::DEFAULT), "DEFAULT" }, + { static_cast(SecretPersistType::TEMPORARY), "TEMPORARY" }, + { static_cast(SecretPersistType::PERSISTENT), "PERSISTENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(SecretPersistType value) { - switch(value) { - case SecretPersistType::DEFAULT: - return "DEFAULT"; - case SecretPersistType::TEMPORARY: - return "TEMPORARY"; - case SecretPersistType::PERSISTENT: - return "PERSISTENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSecretPersistTypeValues(), 3, static_cast(value)); } template<> SecretPersistType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "DEFAULT")) { - return SecretPersistType::DEFAULT; - } - if (StringUtil::Equals(value, "TEMPORARY")) { - return SecretPersistType::TEMPORARY; - } - if (StringUtil::Equals(value, "PERSISTENT")) { - return SecretPersistType::PERSISTENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSecretPersistTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetSequenceInfoValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SequenceInfo::SEQ_START), "SEQ_START" }, + { static_cast(SequenceInfo::SEQ_INC), "SEQ_INC" }, + { static_cast(SequenceInfo::SEQ_MIN), "SEQ_MIN" }, + { static_cast(SequenceInfo::SEQ_MAX), "SEQ_MAX" }, + { static_cast(SequenceInfo::SEQ_CYCLE), "SEQ_CYCLE" }, + { static_cast(SequenceInfo::SEQ_OWN), "SEQ_OWN" } + }; + return values; } template<> const char* EnumUtil::ToChars(SequenceInfo value) { - switch(value) { - case SequenceInfo::SEQ_START: - return "SEQ_START"; - case SequenceInfo::SEQ_INC: - return "SEQ_INC"; - case SequenceInfo::SEQ_MIN: - return "SEQ_MIN"; - case SequenceInfo::SEQ_MAX: - return "SEQ_MAX"; - case SequenceInfo::SEQ_CYCLE: - return "SEQ_CYCLE"; - case SequenceInfo::SEQ_OWN: - return "SEQ_OWN"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSequenceInfoValues(), 6, static_cast(value)); } template<> SequenceInfo EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SEQ_START")) { - return SequenceInfo::SEQ_START; - } - if (StringUtil::Equals(value, "SEQ_INC")) { - return SequenceInfo::SEQ_INC; - } - if (StringUtil::Equals(value, "SEQ_MIN")) { - return SequenceInfo::SEQ_MIN; - } - if (StringUtil::Equals(value, "SEQ_MAX")) { - return SequenceInfo::SEQ_MAX; - } - if (StringUtil::Equals(value, "SEQ_CYCLE")) { - return SequenceInfo::SEQ_CYCLE; - } - if (StringUtil::Equals(value, "SEQ_OWN")) { - return SequenceInfo::SEQ_OWN; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSequenceInfoValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetSetOperationTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SetOperationType::NONE), "NONE" }, + { static_cast(SetOperationType::UNION), "UNION" }, + { static_cast(SetOperationType::EXCEPT), "EXCEPT" }, + { static_cast(SetOperationType::INTERSECT), "INTERSECT" }, + { static_cast(SetOperationType::UNION_BY_NAME), "UNION_BY_NAME" } + }; + return values; } template<> const char* EnumUtil::ToChars(SetOperationType value) { - switch(value) { - case SetOperationType::NONE: - return "NONE"; - case SetOperationType::UNION: - return "UNION"; - case SetOperationType::EXCEPT: - return "EXCEPT"; - case SetOperationType::INTERSECT: - return "INTERSECT"; - case SetOperationType::UNION_BY_NAME: - return "UNION_BY_NAME"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSetOperationTypeValues(), 5, static_cast(value)); } template<> SetOperationType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NONE")) { - return SetOperationType::NONE; - } - if (StringUtil::Equals(value, "UNION")) { - return SetOperationType::UNION; - } - if (StringUtil::Equals(value, "EXCEPT")) { - return SetOperationType::EXCEPT; - } - if (StringUtil::Equals(value, "INTERSECT")) { - return SetOperationType::INTERSECT; - } - if (StringUtil::Equals(value, "UNION_BY_NAME")) { - return SetOperationType::UNION_BY_NAME; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSetOperationTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetSetScopeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SetScope::AUTOMATIC), "AUTOMATIC" }, + { static_cast(SetScope::LOCAL), "LOCAL" }, + { static_cast(SetScope::SESSION), "SESSION" }, + { static_cast(SetScope::GLOBAL), "GLOBAL" }, + { static_cast(SetScope::VARIABLE), "VARIABLE" } + }; + return values; } template<> const char* EnumUtil::ToChars(SetScope value) { - switch(value) { - case SetScope::AUTOMATIC: - return "AUTOMATIC"; - case SetScope::LOCAL: - return "LOCAL"; - case SetScope::SESSION: - return "SESSION"; - case SetScope::GLOBAL: - return "GLOBAL"; - case SetScope::VARIABLE: - return "VARIABLE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSetScopeValues(), 5, static_cast(value)); } template<> SetScope EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "AUTOMATIC")) { - return SetScope::AUTOMATIC; - } - if (StringUtil::Equals(value, "LOCAL")) { - return SetScope::LOCAL; - } - if (StringUtil::Equals(value, "SESSION")) { - return SetScope::SESSION; - } - if (StringUtil::Equals(value, "GLOBAL")) { - return SetScope::GLOBAL; - } - if (StringUtil::Equals(value, "VARIABLE")) { - return SetScope::VARIABLE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSetScopeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetSetTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SetType::SET), "SET" }, + { static_cast(SetType::RESET), "RESET" } + }; + return values; } template<> const char* EnumUtil::ToChars(SetType value) { - switch(value) { - case SetType::SET: - return "SET"; - case SetType::RESET: - return "RESET"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSetTypeValues(), 2, static_cast(value)); } template<> SetType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SET")) { - return SetType::SET; - } - if (StringUtil::Equals(value, "RESET")) { - return SetType::RESET; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSetTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetSettingScopeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SettingScope::GLOBAL), "GLOBAL" }, + { static_cast(SettingScope::LOCAL), "LOCAL" }, + { static_cast(SettingScope::SECRET), "SECRET" }, + { static_cast(SettingScope::INVALID), "INVALID" } + }; + return values; } template<> const char* EnumUtil::ToChars(SettingScope value) { - switch(value) { - case SettingScope::GLOBAL: - return "GLOBAL"; - case SettingScope::LOCAL: - return "LOCAL"; - case SettingScope::SECRET: - return "SECRET"; - case SettingScope::INVALID: - return "INVALID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSettingScopeValues(), 4, static_cast(value)); } template<> SettingScope EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "GLOBAL")) { - return SettingScope::GLOBAL; - } - if (StringUtil::Equals(value, "LOCAL")) { - return SettingScope::LOCAL; - } - if (StringUtil::Equals(value, "SECRET")) { - return SettingScope::SECRET; - } - if (StringUtil::Equals(value, "INVALID")) { - return SettingScope::INVALID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSettingScopeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetShowTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ShowType::SUMMARY), "SUMMARY" }, + { static_cast(ShowType::DESCRIBE), "DESCRIBE" } + }; + return values; } template<> const char* EnumUtil::ToChars(ShowType value) { - switch(value) { - case ShowType::SUMMARY: - return "SUMMARY"; - case ShowType::DESCRIBE: - return "DESCRIBE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetShowTypeValues(), 2, static_cast(value)); } template<> ShowType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SUMMARY")) { - return ShowType::SUMMARY; - } - if (StringUtil::Equals(value, "DESCRIBE")) { - return ShowType::DESCRIBE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetShowTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetSimplifiedTokenTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SimplifiedTokenType::SIMPLIFIED_TOKEN_IDENTIFIER), "SIMPLIFIED_TOKEN_IDENTIFIER" }, + { static_cast(SimplifiedTokenType::SIMPLIFIED_TOKEN_NUMERIC_CONSTANT), "SIMPLIFIED_TOKEN_NUMERIC_CONSTANT" }, + { static_cast(SimplifiedTokenType::SIMPLIFIED_TOKEN_STRING_CONSTANT), "SIMPLIFIED_TOKEN_STRING_CONSTANT" }, + { static_cast(SimplifiedTokenType::SIMPLIFIED_TOKEN_OPERATOR), "SIMPLIFIED_TOKEN_OPERATOR" }, + { static_cast(SimplifiedTokenType::SIMPLIFIED_TOKEN_KEYWORD), "SIMPLIFIED_TOKEN_KEYWORD" }, + { static_cast(SimplifiedTokenType::SIMPLIFIED_TOKEN_COMMENT), "SIMPLIFIED_TOKEN_COMMENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(SimplifiedTokenType value) { - switch(value) { - case SimplifiedTokenType::SIMPLIFIED_TOKEN_IDENTIFIER: - return "SIMPLIFIED_TOKEN_IDENTIFIER"; - case SimplifiedTokenType::SIMPLIFIED_TOKEN_NUMERIC_CONSTANT: - return "SIMPLIFIED_TOKEN_NUMERIC_CONSTANT"; - case SimplifiedTokenType::SIMPLIFIED_TOKEN_STRING_CONSTANT: - return "SIMPLIFIED_TOKEN_STRING_CONSTANT"; - case SimplifiedTokenType::SIMPLIFIED_TOKEN_OPERATOR: - return "SIMPLIFIED_TOKEN_OPERATOR"; - case SimplifiedTokenType::SIMPLIFIED_TOKEN_KEYWORD: - return "SIMPLIFIED_TOKEN_KEYWORD"; - case SimplifiedTokenType::SIMPLIFIED_TOKEN_COMMENT: - return "SIMPLIFIED_TOKEN_COMMENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSimplifiedTokenTypeValues(), 6, static_cast(value)); } template<> SimplifiedTokenType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SIMPLIFIED_TOKEN_IDENTIFIER")) { - return SimplifiedTokenType::SIMPLIFIED_TOKEN_IDENTIFIER; - } - if (StringUtil::Equals(value, "SIMPLIFIED_TOKEN_NUMERIC_CONSTANT")) { - return SimplifiedTokenType::SIMPLIFIED_TOKEN_NUMERIC_CONSTANT; - } - if (StringUtil::Equals(value, "SIMPLIFIED_TOKEN_STRING_CONSTANT")) { - return SimplifiedTokenType::SIMPLIFIED_TOKEN_STRING_CONSTANT; - } - if (StringUtil::Equals(value, "SIMPLIFIED_TOKEN_OPERATOR")) { - return SimplifiedTokenType::SIMPLIFIED_TOKEN_OPERATOR; - } - if (StringUtil::Equals(value, "SIMPLIFIED_TOKEN_KEYWORD")) { - return SimplifiedTokenType::SIMPLIFIED_TOKEN_KEYWORD; - } - if (StringUtil::Equals(value, "SIMPLIFIED_TOKEN_COMMENT")) { - return SimplifiedTokenType::SIMPLIFIED_TOKEN_COMMENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSimplifiedTokenTypeValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetSinkCombineResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SinkCombineResultType::FINISHED), "FINISHED" }, + { static_cast(SinkCombineResultType::BLOCKED), "BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(SinkCombineResultType value) { - switch(value) { - case SinkCombineResultType::FINISHED: - return "FINISHED"; - case SinkCombineResultType::BLOCKED: - return "BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSinkCombineResultTypeValues(), 2, static_cast(value)); } template<> SinkCombineResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "FINISHED")) { - return SinkCombineResultType::FINISHED; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return SinkCombineResultType::BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSinkCombineResultTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetSinkFinalizeTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SinkFinalizeType::READY), "READY" }, + { static_cast(SinkFinalizeType::NO_OUTPUT_POSSIBLE), "NO_OUTPUT_POSSIBLE" }, + { static_cast(SinkFinalizeType::BLOCKED), "BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(SinkFinalizeType value) { - switch(value) { - case SinkFinalizeType::READY: - return "READY"; - case SinkFinalizeType::NO_OUTPUT_POSSIBLE: - return "NO_OUTPUT_POSSIBLE"; - case SinkFinalizeType::BLOCKED: - return "BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSinkFinalizeTypeValues(), 3, static_cast(value)); } template<> SinkFinalizeType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "READY")) { - return SinkFinalizeType::READY; - } - if (StringUtil::Equals(value, "NO_OUTPUT_POSSIBLE")) { - return SinkFinalizeType::NO_OUTPUT_POSSIBLE; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return SinkFinalizeType::BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSinkFinalizeTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetSinkNextBatchTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SinkNextBatchType::READY), "READY" }, + { static_cast(SinkNextBatchType::BLOCKED), "BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(SinkNextBatchType value) { - switch(value) { - case SinkNextBatchType::READY: - return "READY"; - case SinkNextBatchType::BLOCKED: - return "BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSinkNextBatchTypeValues(), 2, static_cast(value)); } template<> SinkNextBatchType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "READY")) { - return SinkNextBatchType::READY; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return SinkNextBatchType::BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSinkNextBatchTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetSinkResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SinkResultType::NEED_MORE_INPUT), "NEED_MORE_INPUT" }, + { static_cast(SinkResultType::FINISHED), "FINISHED" }, + { static_cast(SinkResultType::BLOCKED), "BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(SinkResultType value) { - switch(value) { - case SinkResultType::NEED_MORE_INPUT: - return "NEED_MORE_INPUT"; - case SinkResultType::FINISHED: - return "FINISHED"; - case SinkResultType::BLOCKED: - return "BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSinkResultTypeValues(), 3, static_cast(value)); } template<> SinkResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NEED_MORE_INPUT")) { - return SinkResultType::NEED_MORE_INPUT; - } - if (StringUtil::Equals(value, "FINISHED")) { - return SinkResultType::FINISHED; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return SinkResultType::BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSinkResultTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetSourceResultTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SourceResultType::HAVE_MORE_OUTPUT), "HAVE_MORE_OUTPUT" }, + { static_cast(SourceResultType::FINISHED), "FINISHED" }, + { static_cast(SourceResultType::BLOCKED), "BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(SourceResultType value) { - switch(value) { - case SourceResultType::HAVE_MORE_OUTPUT: - return "HAVE_MORE_OUTPUT"; - case SourceResultType::FINISHED: - return "FINISHED"; - case SourceResultType::BLOCKED: - return "BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSourceResultTypeValues(), 3, static_cast(value)); } template<> SourceResultType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "HAVE_MORE_OUTPUT")) { - return SourceResultType::HAVE_MORE_OUTPUT; - } - if (StringUtil::Equals(value, "FINISHED")) { - return SourceResultType::FINISHED; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return SourceResultType::BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSourceResultTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetStatementReturnTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(StatementReturnType::QUERY_RESULT), "QUERY_RESULT" }, + { static_cast(StatementReturnType::CHANGED_ROWS), "CHANGED_ROWS" }, + { static_cast(StatementReturnType::NOTHING), "NOTHING" } + }; + return values; } template<> const char* EnumUtil::ToChars(StatementReturnType value) { - switch(value) { - case StatementReturnType::QUERY_RESULT: - return "QUERY_RESULT"; - case StatementReturnType::CHANGED_ROWS: - return "CHANGED_ROWS"; - case StatementReturnType::NOTHING: - return "NOTHING"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetStatementReturnTypeValues(), 3, static_cast(value)); } template<> StatementReturnType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "QUERY_RESULT")) { - return StatementReturnType::QUERY_RESULT; - } - if (StringUtil::Equals(value, "CHANGED_ROWS")) { - return StatementReturnType::CHANGED_ROWS; - } - if (StringUtil::Equals(value, "NOTHING")) { - return StatementReturnType::NOTHING; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetStatementReturnTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetStatementTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(StatementType::INVALID_STATEMENT), "INVALID_STATEMENT" }, + { static_cast(StatementType::SELECT_STATEMENT), "SELECT_STATEMENT" }, + { static_cast(StatementType::INSERT_STATEMENT), "INSERT_STATEMENT" }, + { static_cast(StatementType::UPDATE_STATEMENT), "UPDATE_STATEMENT" }, + { static_cast(StatementType::CREATE_STATEMENT), "CREATE_STATEMENT" }, + { static_cast(StatementType::DELETE_STATEMENT), "DELETE_STATEMENT" }, + { static_cast(StatementType::PREPARE_STATEMENT), "PREPARE_STATEMENT" }, + { static_cast(StatementType::EXECUTE_STATEMENT), "EXECUTE_STATEMENT" }, + { static_cast(StatementType::ALTER_STATEMENT), "ALTER_STATEMENT" }, + { static_cast(StatementType::TRANSACTION_STATEMENT), "TRANSACTION_STATEMENT" }, + { static_cast(StatementType::COPY_STATEMENT), "COPY_STATEMENT" }, + { static_cast(StatementType::ANALYZE_STATEMENT), "ANALYZE_STATEMENT" }, + { static_cast(StatementType::VARIABLE_SET_STATEMENT), "VARIABLE_SET_STATEMENT" }, + { static_cast(StatementType::CREATE_FUNC_STATEMENT), "CREATE_FUNC_STATEMENT" }, + { static_cast(StatementType::EXPLAIN_STATEMENT), "EXPLAIN_STATEMENT" }, + { static_cast(StatementType::DROP_STATEMENT), "DROP_STATEMENT" }, + { static_cast(StatementType::EXPORT_STATEMENT), "EXPORT_STATEMENT" }, + { static_cast(StatementType::PRAGMA_STATEMENT), "PRAGMA_STATEMENT" }, + { static_cast(StatementType::VACUUM_STATEMENT), "VACUUM_STATEMENT" }, + { static_cast(StatementType::CALL_STATEMENT), "CALL_STATEMENT" }, + { static_cast(StatementType::SET_STATEMENT), "SET_STATEMENT" }, + { static_cast(StatementType::LOAD_STATEMENT), "LOAD_STATEMENT" }, + { static_cast(StatementType::RELATION_STATEMENT), "RELATION_STATEMENT" }, + { static_cast(StatementType::EXTENSION_STATEMENT), "EXTENSION_STATEMENT" }, + { static_cast(StatementType::LOGICAL_PLAN_STATEMENT), "LOGICAL_PLAN_STATEMENT" }, + { static_cast(StatementType::ATTACH_STATEMENT), "ATTACH_STATEMENT" }, + { static_cast(StatementType::DETACH_STATEMENT), "DETACH_STATEMENT" }, + { static_cast(StatementType::MULTI_STATEMENT), "MULTI_STATEMENT" }, + { static_cast(StatementType::COPY_DATABASE_STATEMENT), "COPY_DATABASE_STATEMENT" }, + { static_cast(StatementType::UPDATE_EXTENSIONS_STATEMENT), "UPDATE_EXTENSIONS_STATEMENT" } + }; + return values; } template<> const char* EnumUtil::ToChars(StatementType value) { - switch(value) { - case StatementType::INVALID_STATEMENT: - return "INVALID_STATEMENT"; - case StatementType::SELECT_STATEMENT: - return "SELECT_STATEMENT"; - case StatementType::INSERT_STATEMENT: - return "INSERT_STATEMENT"; - case StatementType::UPDATE_STATEMENT: - return "UPDATE_STATEMENT"; - case StatementType::CREATE_STATEMENT: - return "CREATE_STATEMENT"; - case StatementType::DELETE_STATEMENT: - return "DELETE_STATEMENT"; - case StatementType::PREPARE_STATEMENT: - return "PREPARE_STATEMENT"; - case StatementType::EXECUTE_STATEMENT: - return "EXECUTE_STATEMENT"; - case StatementType::ALTER_STATEMENT: - return "ALTER_STATEMENT"; - case StatementType::TRANSACTION_STATEMENT: - return "TRANSACTION_STATEMENT"; - case StatementType::COPY_STATEMENT: - return "COPY_STATEMENT"; - case StatementType::ANALYZE_STATEMENT: - return "ANALYZE_STATEMENT"; - case StatementType::VARIABLE_SET_STATEMENT: - return "VARIABLE_SET_STATEMENT"; - case StatementType::CREATE_FUNC_STATEMENT: - return "CREATE_FUNC_STATEMENT"; - case StatementType::EXPLAIN_STATEMENT: - return "EXPLAIN_STATEMENT"; - case StatementType::DROP_STATEMENT: - return "DROP_STATEMENT"; - case StatementType::EXPORT_STATEMENT: - return "EXPORT_STATEMENT"; - case StatementType::PRAGMA_STATEMENT: - return "PRAGMA_STATEMENT"; - case StatementType::VACUUM_STATEMENT: - return "VACUUM_STATEMENT"; - case StatementType::CALL_STATEMENT: - return "CALL_STATEMENT"; - case StatementType::SET_STATEMENT: - return "SET_STATEMENT"; - case StatementType::LOAD_STATEMENT: - return "LOAD_STATEMENT"; - case StatementType::RELATION_STATEMENT: - return "RELATION_STATEMENT"; - case StatementType::EXTENSION_STATEMENT: - return "EXTENSION_STATEMENT"; - case StatementType::LOGICAL_PLAN_STATEMENT: - return "LOGICAL_PLAN_STATEMENT"; - case StatementType::ATTACH_STATEMENT: - return "ATTACH_STATEMENT"; - case StatementType::DETACH_STATEMENT: - return "DETACH_STATEMENT"; - case StatementType::MULTI_STATEMENT: - return "MULTI_STATEMENT"; - case StatementType::COPY_DATABASE_STATEMENT: - return "COPY_DATABASE_STATEMENT"; - case StatementType::UPDATE_EXTENSIONS_STATEMENT: - return "UPDATE_EXTENSIONS_STATEMENT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetStatementTypeValues(), 30, static_cast(value)); } template<> StatementType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID_STATEMENT")) { - return StatementType::INVALID_STATEMENT; - } - if (StringUtil::Equals(value, "SELECT_STATEMENT")) { - return StatementType::SELECT_STATEMENT; - } - if (StringUtil::Equals(value, "INSERT_STATEMENT")) { - return StatementType::INSERT_STATEMENT; - } - if (StringUtil::Equals(value, "UPDATE_STATEMENT")) { - return StatementType::UPDATE_STATEMENT; - } - if (StringUtil::Equals(value, "CREATE_STATEMENT")) { - return StatementType::CREATE_STATEMENT; - } - if (StringUtil::Equals(value, "DELETE_STATEMENT")) { - return StatementType::DELETE_STATEMENT; - } - if (StringUtil::Equals(value, "PREPARE_STATEMENT")) { - return StatementType::PREPARE_STATEMENT; - } - if (StringUtil::Equals(value, "EXECUTE_STATEMENT")) { - return StatementType::EXECUTE_STATEMENT; - } - if (StringUtil::Equals(value, "ALTER_STATEMENT")) { - return StatementType::ALTER_STATEMENT; - } - if (StringUtil::Equals(value, "TRANSACTION_STATEMENT")) { - return StatementType::TRANSACTION_STATEMENT; - } - if (StringUtil::Equals(value, "COPY_STATEMENT")) { - return StatementType::COPY_STATEMENT; - } - if (StringUtil::Equals(value, "ANALYZE_STATEMENT")) { - return StatementType::ANALYZE_STATEMENT; - } - if (StringUtil::Equals(value, "VARIABLE_SET_STATEMENT")) { - return StatementType::VARIABLE_SET_STATEMENT; - } - if (StringUtil::Equals(value, "CREATE_FUNC_STATEMENT")) { - return StatementType::CREATE_FUNC_STATEMENT; - } - if (StringUtil::Equals(value, "EXPLAIN_STATEMENT")) { - return StatementType::EXPLAIN_STATEMENT; - } - if (StringUtil::Equals(value, "DROP_STATEMENT")) { - return StatementType::DROP_STATEMENT; - } - if (StringUtil::Equals(value, "EXPORT_STATEMENT")) { - return StatementType::EXPORT_STATEMENT; - } - if (StringUtil::Equals(value, "PRAGMA_STATEMENT")) { - return StatementType::PRAGMA_STATEMENT; - } - if (StringUtil::Equals(value, "VACUUM_STATEMENT")) { - return StatementType::VACUUM_STATEMENT; - } - if (StringUtil::Equals(value, "CALL_STATEMENT")) { - return StatementType::CALL_STATEMENT; - } - if (StringUtil::Equals(value, "SET_STATEMENT")) { - return StatementType::SET_STATEMENT; - } - if (StringUtil::Equals(value, "LOAD_STATEMENT")) { - return StatementType::LOAD_STATEMENT; - } - if (StringUtil::Equals(value, "RELATION_STATEMENT")) { - return StatementType::RELATION_STATEMENT; - } - if (StringUtil::Equals(value, "EXTENSION_STATEMENT")) { - return StatementType::EXTENSION_STATEMENT; - } - if (StringUtil::Equals(value, "LOGICAL_PLAN_STATEMENT")) { - return StatementType::LOGICAL_PLAN_STATEMENT; - } - if (StringUtil::Equals(value, "ATTACH_STATEMENT")) { - return StatementType::ATTACH_STATEMENT; - } - if (StringUtil::Equals(value, "DETACH_STATEMENT")) { - return StatementType::DETACH_STATEMENT; - } - if (StringUtil::Equals(value, "MULTI_STATEMENT")) { - return StatementType::MULTI_STATEMENT; - } - if (StringUtil::Equals(value, "COPY_DATABASE_STATEMENT")) { - return StatementType::COPY_DATABASE_STATEMENT; - } - if (StringUtil::Equals(value, "UPDATE_EXTENSIONS_STATEMENT")) { - return StatementType::UPDATE_EXTENSIONS_STATEMENT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetStatementTypeValues(), 30, value)); +} + +const StringUtil::EnumStringLiteral *GetStatisticsTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(StatisticsType::NUMERIC_STATS), "NUMERIC_STATS" }, + { static_cast(StatisticsType::STRING_STATS), "STRING_STATS" }, + { static_cast(StatisticsType::LIST_STATS), "LIST_STATS" }, + { static_cast(StatisticsType::STRUCT_STATS), "STRUCT_STATS" }, + { static_cast(StatisticsType::BASE_STATS), "BASE_STATS" }, + { static_cast(StatisticsType::ARRAY_STATS), "ARRAY_STATS" } + }; + return values; } template<> const char* EnumUtil::ToChars(StatisticsType value) { - switch(value) { - case StatisticsType::NUMERIC_STATS: - return "NUMERIC_STATS"; - case StatisticsType::STRING_STATS: - return "STRING_STATS"; - case StatisticsType::LIST_STATS: - return "LIST_STATS"; - case StatisticsType::STRUCT_STATS: - return "STRUCT_STATS"; - case StatisticsType::BASE_STATS: - return "BASE_STATS"; - case StatisticsType::ARRAY_STATS: - return "ARRAY_STATS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetStatisticsTypeValues(), 6, static_cast(value)); } template<> StatisticsType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NUMERIC_STATS")) { - return StatisticsType::NUMERIC_STATS; - } - if (StringUtil::Equals(value, "STRING_STATS")) { - return StatisticsType::STRING_STATS; - } - if (StringUtil::Equals(value, "LIST_STATS")) { - return StatisticsType::LIST_STATS; - } - if (StringUtil::Equals(value, "STRUCT_STATS")) { - return StatisticsType::STRUCT_STATS; - } - if (StringUtil::Equals(value, "BASE_STATS")) { - return StatisticsType::BASE_STATS; - } - if (StringUtil::Equals(value, "ARRAY_STATS")) { - return StatisticsType::ARRAY_STATS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetStatisticsTypeValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetStatsInfoValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(StatsInfo::CAN_HAVE_NULL_VALUES), "CAN_HAVE_NULL_VALUES" }, + { static_cast(StatsInfo::CANNOT_HAVE_NULL_VALUES), "CANNOT_HAVE_NULL_VALUES" }, + { static_cast(StatsInfo::CAN_HAVE_VALID_VALUES), "CAN_HAVE_VALID_VALUES" }, + { static_cast(StatsInfo::CANNOT_HAVE_VALID_VALUES), "CANNOT_HAVE_VALID_VALUES" }, + { static_cast(StatsInfo::CAN_HAVE_NULL_AND_VALID_VALUES), "CAN_HAVE_NULL_AND_VALID_VALUES" } + }; + return values; } template<> const char* EnumUtil::ToChars(StatsInfo value) { - switch(value) { - case StatsInfo::CAN_HAVE_NULL_VALUES: - return "CAN_HAVE_NULL_VALUES"; - case StatsInfo::CANNOT_HAVE_NULL_VALUES: - return "CANNOT_HAVE_NULL_VALUES"; - case StatsInfo::CAN_HAVE_VALID_VALUES: - return "CAN_HAVE_VALID_VALUES"; - case StatsInfo::CANNOT_HAVE_VALID_VALUES: - return "CANNOT_HAVE_VALID_VALUES"; - case StatsInfo::CAN_HAVE_NULL_AND_VALID_VALUES: - return "CAN_HAVE_NULL_AND_VALID_VALUES"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetStatsInfoValues(), 5, static_cast(value)); } template<> StatsInfo EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CAN_HAVE_NULL_VALUES")) { - return StatsInfo::CAN_HAVE_NULL_VALUES; - } - if (StringUtil::Equals(value, "CANNOT_HAVE_NULL_VALUES")) { - return StatsInfo::CANNOT_HAVE_NULL_VALUES; - } - if (StringUtil::Equals(value, "CAN_HAVE_VALID_VALUES")) { - return StatsInfo::CAN_HAVE_VALID_VALUES; - } - if (StringUtil::Equals(value, "CANNOT_HAVE_VALID_VALUES")) { - return StatsInfo::CANNOT_HAVE_VALID_VALUES; - } - if (StringUtil::Equals(value, "CAN_HAVE_NULL_AND_VALID_VALUES")) { - return StatsInfo::CAN_HAVE_NULL_AND_VALID_VALUES; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetStatsInfoValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetStrTimeSpecifierValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(StrTimeSpecifier::ABBREVIATED_WEEKDAY_NAME), "ABBREVIATED_WEEKDAY_NAME" }, + { static_cast(StrTimeSpecifier::FULL_WEEKDAY_NAME), "FULL_WEEKDAY_NAME" }, + { static_cast(StrTimeSpecifier::WEEKDAY_DECIMAL), "WEEKDAY_DECIMAL" }, + { static_cast(StrTimeSpecifier::DAY_OF_MONTH_PADDED), "DAY_OF_MONTH_PADDED" }, + { static_cast(StrTimeSpecifier::DAY_OF_MONTH), "DAY_OF_MONTH" }, + { static_cast(StrTimeSpecifier::ABBREVIATED_MONTH_NAME), "ABBREVIATED_MONTH_NAME" }, + { static_cast(StrTimeSpecifier::FULL_MONTH_NAME), "FULL_MONTH_NAME" }, + { static_cast(StrTimeSpecifier::MONTH_DECIMAL_PADDED), "MONTH_DECIMAL_PADDED" }, + { static_cast(StrTimeSpecifier::MONTH_DECIMAL), "MONTH_DECIMAL" }, + { static_cast(StrTimeSpecifier::YEAR_WITHOUT_CENTURY_PADDED), "YEAR_WITHOUT_CENTURY_PADDED" }, + { static_cast(StrTimeSpecifier::YEAR_WITHOUT_CENTURY), "YEAR_WITHOUT_CENTURY" }, + { static_cast(StrTimeSpecifier::YEAR_DECIMAL), "YEAR_DECIMAL" }, + { static_cast(StrTimeSpecifier::HOUR_24_PADDED), "HOUR_24_PADDED" }, + { static_cast(StrTimeSpecifier::HOUR_24_DECIMAL), "HOUR_24_DECIMAL" }, + { static_cast(StrTimeSpecifier::HOUR_12_PADDED), "HOUR_12_PADDED" }, + { static_cast(StrTimeSpecifier::HOUR_12_DECIMAL), "HOUR_12_DECIMAL" }, + { static_cast(StrTimeSpecifier::AM_PM), "AM_PM" }, + { static_cast(StrTimeSpecifier::MINUTE_PADDED), "MINUTE_PADDED" }, + { static_cast(StrTimeSpecifier::MINUTE_DECIMAL), "MINUTE_DECIMAL" }, + { static_cast(StrTimeSpecifier::SECOND_PADDED), "SECOND_PADDED" }, + { static_cast(StrTimeSpecifier::SECOND_DECIMAL), "SECOND_DECIMAL" }, + { static_cast(StrTimeSpecifier::MICROSECOND_PADDED), "MICROSECOND_PADDED" }, + { static_cast(StrTimeSpecifier::MILLISECOND_PADDED), "MILLISECOND_PADDED" }, + { static_cast(StrTimeSpecifier::UTC_OFFSET), "UTC_OFFSET" }, + { static_cast(StrTimeSpecifier::TZ_NAME), "TZ_NAME" }, + { static_cast(StrTimeSpecifier::DAY_OF_YEAR_PADDED), "DAY_OF_YEAR_PADDED" }, + { static_cast(StrTimeSpecifier::DAY_OF_YEAR_DECIMAL), "DAY_OF_YEAR_DECIMAL" }, + { static_cast(StrTimeSpecifier::WEEK_NUMBER_PADDED_SUN_FIRST), "WEEK_NUMBER_PADDED_SUN_FIRST" }, + { static_cast(StrTimeSpecifier::WEEK_NUMBER_PADDED_MON_FIRST), "WEEK_NUMBER_PADDED_MON_FIRST" }, + { static_cast(StrTimeSpecifier::LOCALE_APPROPRIATE_DATE_AND_TIME), "LOCALE_APPROPRIATE_DATE_AND_TIME" }, + { static_cast(StrTimeSpecifier::LOCALE_APPROPRIATE_DATE), "LOCALE_APPROPRIATE_DATE" }, + { static_cast(StrTimeSpecifier::LOCALE_APPROPRIATE_TIME), "LOCALE_APPROPRIATE_TIME" }, + { static_cast(StrTimeSpecifier::NANOSECOND_PADDED), "NANOSECOND_PADDED" }, + { static_cast(StrTimeSpecifier::YEAR_ISO), "YEAR_ISO" }, + { static_cast(StrTimeSpecifier::WEEKDAY_ISO), "WEEKDAY_ISO" }, + { static_cast(StrTimeSpecifier::WEEK_NUMBER_ISO), "WEEK_NUMBER_ISO" } + }; + return values; } template<> const char* EnumUtil::ToChars(StrTimeSpecifier value) { - switch(value) { - case StrTimeSpecifier::ABBREVIATED_WEEKDAY_NAME: - return "ABBREVIATED_WEEKDAY_NAME"; - case StrTimeSpecifier::FULL_WEEKDAY_NAME: - return "FULL_WEEKDAY_NAME"; - case StrTimeSpecifier::WEEKDAY_DECIMAL: - return "WEEKDAY_DECIMAL"; - case StrTimeSpecifier::DAY_OF_MONTH_PADDED: - return "DAY_OF_MONTH_PADDED"; - case StrTimeSpecifier::DAY_OF_MONTH: - return "DAY_OF_MONTH"; - case StrTimeSpecifier::ABBREVIATED_MONTH_NAME: - return "ABBREVIATED_MONTH_NAME"; - case StrTimeSpecifier::FULL_MONTH_NAME: - return "FULL_MONTH_NAME"; - case StrTimeSpecifier::MONTH_DECIMAL_PADDED: - return "MONTH_DECIMAL_PADDED"; - case StrTimeSpecifier::MONTH_DECIMAL: - return "MONTH_DECIMAL"; - case StrTimeSpecifier::YEAR_WITHOUT_CENTURY_PADDED: - return "YEAR_WITHOUT_CENTURY_PADDED"; - case StrTimeSpecifier::YEAR_WITHOUT_CENTURY: - return "YEAR_WITHOUT_CENTURY"; - case StrTimeSpecifier::YEAR_DECIMAL: - return "YEAR_DECIMAL"; - case StrTimeSpecifier::HOUR_24_PADDED: - return "HOUR_24_PADDED"; - case StrTimeSpecifier::HOUR_24_DECIMAL: - return "HOUR_24_DECIMAL"; - case StrTimeSpecifier::HOUR_12_PADDED: - return "HOUR_12_PADDED"; - case StrTimeSpecifier::HOUR_12_DECIMAL: - return "HOUR_12_DECIMAL"; - case StrTimeSpecifier::AM_PM: - return "AM_PM"; - case StrTimeSpecifier::MINUTE_PADDED: - return "MINUTE_PADDED"; - case StrTimeSpecifier::MINUTE_DECIMAL: - return "MINUTE_DECIMAL"; - case StrTimeSpecifier::SECOND_PADDED: - return "SECOND_PADDED"; - case StrTimeSpecifier::SECOND_DECIMAL: - return "SECOND_DECIMAL"; - case StrTimeSpecifier::MICROSECOND_PADDED: - return "MICROSECOND_PADDED"; - case StrTimeSpecifier::MILLISECOND_PADDED: - return "MILLISECOND_PADDED"; - case StrTimeSpecifier::UTC_OFFSET: - return "UTC_OFFSET"; - case StrTimeSpecifier::TZ_NAME: - return "TZ_NAME"; - case StrTimeSpecifier::DAY_OF_YEAR_PADDED: - return "DAY_OF_YEAR_PADDED"; - case StrTimeSpecifier::DAY_OF_YEAR_DECIMAL: - return "DAY_OF_YEAR_DECIMAL"; - case StrTimeSpecifier::WEEK_NUMBER_PADDED_SUN_FIRST: - return "WEEK_NUMBER_PADDED_SUN_FIRST"; - case StrTimeSpecifier::WEEK_NUMBER_PADDED_MON_FIRST: - return "WEEK_NUMBER_PADDED_MON_FIRST"; - case StrTimeSpecifier::LOCALE_APPROPRIATE_DATE_AND_TIME: - return "LOCALE_APPROPRIATE_DATE_AND_TIME"; - case StrTimeSpecifier::LOCALE_APPROPRIATE_DATE: - return "LOCALE_APPROPRIATE_DATE"; - case StrTimeSpecifier::LOCALE_APPROPRIATE_TIME: - return "LOCALE_APPROPRIATE_TIME"; - case StrTimeSpecifier::NANOSECOND_PADDED: - return "NANOSECOND_PADDED"; - case StrTimeSpecifier::YEAR_ISO: - return "YEAR_ISO"; - case StrTimeSpecifier::WEEKDAY_ISO: - return "WEEKDAY_ISO"; - case StrTimeSpecifier::WEEK_NUMBER_ISO: - return "WEEK_NUMBER_ISO"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetStrTimeSpecifierValues(), 36, static_cast(value)); } template<> StrTimeSpecifier EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ABBREVIATED_WEEKDAY_NAME")) { - return StrTimeSpecifier::ABBREVIATED_WEEKDAY_NAME; - } - if (StringUtil::Equals(value, "FULL_WEEKDAY_NAME")) { - return StrTimeSpecifier::FULL_WEEKDAY_NAME; - } - if (StringUtil::Equals(value, "WEEKDAY_DECIMAL")) { - return StrTimeSpecifier::WEEKDAY_DECIMAL; - } - if (StringUtil::Equals(value, "DAY_OF_MONTH_PADDED")) { - return StrTimeSpecifier::DAY_OF_MONTH_PADDED; - } - if (StringUtil::Equals(value, "DAY_OF_MONTH")) { - return StrTimeSpecifier::DAY_OF_MONTH; - } - if (StringUtil::Equals(value, "ABBREVIATED_MONTH_NAME")) { - return StrTimeSpecifier::ABBREVIATED_MONTH_NAME; - } - if (StringUtil::Equals(value, "FULL_MONTH_NAME")) { - return StrTimeSpecifier::FULL_MONTH_NAME; - } - if (StringUtil::Equals(value, "MONTH_DECIMAL_PADDED")) { - return StrTimeSpecifier::MONTH_DECIMAL_PADDED; - } - if (StringUtil::Equals(value, "MONTH_DECIMAL")) { - return StrTimeSpecifier::MONTH_DECIMAL; - } - if (StringUtil::Equals(value, "YEAR_WITHOUT_CENTURY_PADDED")) { - return StrTimeSpecifier::YEAR_WITHOUT_CENTURY_PADDED; - } - if (StringUtil::Equals(value, "YEAR_WITHOUT_CENTURY")) { - return StrTimeSpecifier::YEAR_WITHOUT_CENTURY; - } - if (StringUtil::Equals(value, "YEAR_DECIMAL")) { - return StrTimeSpecifier::YEAR_DECIMAL; - } - if (StringUtil::Equals(value, "HOUR_24_PADDED")) { - return StrTimeSpecifier::HOUR_24_PADDED; - } - if (StringUtil::Equals(value, "HOUR_24_DECIMAL")) { - return StrTimeSpecifier::HOUR_24_DECIMAL; - } - if (StringUtil::Equals(value, "HOUR_12_PADDED")) { - return StrTimeSpecifier::HOUR_12_PADDED; - } - if (StringUtil::Equals(value, "HOUR_12_DECIMAL")) { - return StrTimeSpecifier::HOUR_12_DECIMAL; - } - if (StringUtil::Equals(value, "AM_PM")) { - return StrTimeSpecifier::AM_PM; - } - if (StringUtil::Equals(value, "MINUTE_PADDED")) { - return StrTimeSpecifier::MINUTE_PADDED; - } - if (StringUtil::Equals(value, "MINUTE_DECIMAL")) { - return StrTimeSpecifier::MINUTE_DECIMAL; - } - if (StringUtil::Equals(value, "SECOND_PADDED")) { - return StrTimeSpecifier::SECOND_PADDED; - } - if (StringUtil::Equals(value, "SECOND_DECIMAL")) { - return StrTimeSpecifier::SECOND_DECIMAL; - } - if (StringUtil::Equals(value, "MICROSECOND_PADDED")) { - return StrTimeSpecifier::MICROSECOND_PADDED; - } - if (StringUtil::Equals(value, "MILLISECOND_PADDED")) { - return StrTimeSpecifier::MILLISECOND_PADDED; - } - if (StringUtil::Equals(value, "UTC_OFFSET")) { - return StrTimeSpecifier::UTC_OFFSET; - } - if (StringUtil::Equals(value, "TZ_NAME")) { - return StrTimeSpecifier::TZ_NAME; - } - if (StringUtil::Equals(value, "DAY_OF_YEAR_PADDED")) { - return StrTimeSpecifier::DAY_OF_YEAR_PADDED; - } - if (StringUtil::Equals(value, "DAY_OF_YEAR_DECIMAL")) { - return StrTimeSpecifier::DAY_OF_YEAR_DECIMAL; - } - if (StringUtil::Equals(value, "WEEK_NUMBER_PADDED_SUN_FIRST")) { - return StrTimeSpecifier::WEEK_NUMBER_PADDED_SUN_FIRST; - } - if (StringUtil::Equals(value, "WEEK_NUMBER_PADDED_MON_FIRST")) { - return StrTimeSpecifier::WEEK_NUMBER_PADDED_MON_FIRST; - } - if (StringUtil::Equals(value, "LOCALE_APPROPRIATE_DATE_AND_TIME")) { - return StrTimeSpecifier::LOCALE_APPROPRIATE_DATE_AND_TIME; - } - if (StringUtil::Equals(value, "LOCALE_APPROPRIATE_DATE")) { - return StrTimeSpecifier::LOCALE_APPROPRIATE_DATE; - } - if (StringUtil::Equals(value, "LOCALE_APPROPRIATE_TIME")) { - return StrTimeSpecifier::LOCALE_APPROPRIATE_TIME; - } - if (StringUtil::Equals(value, "NANOSECOND_PADDED")) { - return StrTimeSpecifier::NANOSECOND_PADDED; - } - if (StringUtil::Equals(value, "YEAR_ISO")) { - return StrTimeSpecifier::YEAR_ISO; - } - if (StringUtil::Equals(value, "WEEKDAY_ISO")) { - return StrTimeSpecifier::WEEKDAY_ISO; - } - if (StringUtil::Equals(value, "WEEK_NUMBER_ISO")) { - return StrTimeSpecifier::WEEK_NUMBER_ISO; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetStrTimeSpecifierValues(), 36, value)); +} + +const StringUtil::EnumStringLiteral *GetStreamExecutionResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(StreamExecutionResult::CHUNK_READY), "CHUNK_READY" }, + { static_cast(StreamExecutionResult::CHUNK_NOT_READY), "CHUNK_NOT_READY" }, + { static_cast(StreamExecutionResult::EXECUTION_ERROR), "EXECUTION_ERROR" }, + { static_cast(StreamExecutionResult::EXECUTION_CANCELLED), "EXECUTION_CANCELLED" }, + { static_cast(StreamExecutionResult::BLOCKED), "BLOCKED" }, + { static_cast(StreamExecutionResult::NO_TASKS_AVAILABLE), "NO_TASKS_AVAILABLE" }, + { static_cast(StreamExecutionResult::EXECUTION_FINISHED), "EXECUTION_FINISHED" } + }; + return values; } template<> const char* EnumUtil::ToChars(StreamExecutionResult value) { - switch(value) { - case StreamExecutionResult::CHUNK_READY: - return "CHUNK_READY"; - case StreamExecutionResult::CHUNK_NOT_READY: - return "CHUNK_NOT_READY"; - case StreamExecutionResult::EXECUTION_ERROR: - return "EXECUTION_ERROR"; - case StreamExecutionResult::EXECUTION_CANCELLED: - return "EXECUTION_CANCELLED"; - case StreamExecutionResult::BLOCKED: - return "BLOCKED"; - case StreamExecutionResult::NO_TASKS_AVAILABLE: - return "NO_TASKS_AVAILABLE"; - case StreamExecutionResult::EXECUTION_FINISHED: - return "EXECUTION_FINISHED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetStreamExecutionResultValues(), 7, static_cast(value)); } template<> StreamExecutionResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CHUNK_READY")) { - return StreamExecutionResult::CHUNK_READY; - } - if (StringUtil::Equals(value, "CHUNK_NOT_READY")) { - return StreamExecutionResult::CHUNK_NOT_READY; - } - if (StringUtil::Equals(value, "EXECUTION_ERROR")) { - return StreamExecutionResult::EXECUTION_ERROR; - } - if (StringUtil::Equals(value, "EXECUTION_CANCELLED")) { - return StreamExecutionResult::EXECUTION_CANCELLED; - } - if (StringUtil::Equals(value, "BLOCKED")) { - return StreamExecutionResult::BLOCKED; - } - if (StringUtil::Equals(value, "NO_TASKS_AVAILABLE")) { - return StreamExecutionResult::NO_TASKS_AVAILABLE; - } - if (StringUtil::Equals(value, "EXECUTION_FINISHED")) { - return StreamExecutionResult::EXECUTION_FINISHED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetStreamExecutionResultValues(), 7, value)); +} + +const StringUtil::EnumStringLiteral *GetSubqueryTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(SubqueryType::INVALID), "INVALID" }, + { static_cast(SubqueryType::SCALAR), "SCALAR" }, + { static_cast(SubqueryType::EXISTS), "EXISTS" }, + { static_cast(SubqueryType::NOT_EXISTS), "NOT_EXISTS" }, + { static_cast(SubqueryType::ANY), "ANY" } + }; + return values; } template<> const char* EnumUtil::ToChars(SubqueryType value) { - switch(value) { - case SubqueryType::INVALID: - return "INVALID"; - case SubqueryType::SCALAR: - return "SCALAR"; - case SubqueryType::EXISTS: - return "EXISTS"; - case SubqueryType::NOT_EXISTS: - return "NOT_EXISTS"; - case SubqueryType::ANY: - return "ANY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetSubqueryTypeValues(), 5, static_cast(value)); } template<> SubqueryType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return SubqueryType::INVALID; - } - if (StringUtil::Equals(value, "SCALAR")) { - return SubqueryType::SCALAR; - } - if (StringUtil::Equals(value, "EXISTS")) { - return SubqueryType::EXISTS; - } - if (StringUtil::Equals(value, "NOT_EXISTS")) { - return SubqueryType::NOT_EXISTS; - } - if (StringUtil::Equals(value, "ANY")) { - return SubqueryType::ANY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetSubqueryTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetTableColumnTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TableColumnType::STANDARD), "STANDARD" }, + { static_cast(TableColumnType::GENERATED), "GENERATED" } + }; + return values; } template<> const char* EnumUtil::ToChars(TableColumnType value) { - switch(value) { - case TableColumnType::STANDARD: - return "STANDARD"; - case TableColumnType::GENERATED: - return "GENERATED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTableColumnTypeValues(), 2, static_cast(value)); } template<> TableColumnType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STANDARD")) { - return TableColumnType::STANDARD; - } - if (StringUtil::Equals(value, "GENERATED")) { - return TableColumnType::GENERATED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTableColumnTypeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetTableFilterTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TableFilterType::CONSTANT_COMPARISON), "CONSTANT_COMPARISON" }, + { static_cast(TableFilterType::IS_NULL), "IS_NULL" }, + { static_cast(TableFilterType::IS_NOT_NULL), "IS_NOT_NULL" }, + { static_cast(TableFilterType::CONJUNCTION_OR), "CONJUNCTION_OR" }, + { static_cast(TableFilterType::CONJUNCTION_AND), "CONJUNCTION_AND" }, + { static_cast(TableFilterType::STRUCT_EXTRACT), "STRUCT_EXTRACT" } + }; + return values; } template<> const char* EnumUtil::ToChars(TableFilterType value) { - switch(value) { - case TableFilterType::CONSTANT_COMPARISON: - return "CONSTANT_COMPARISON"; - case TableFilterType::IS_NULL: - return "IS_NULL"; - case TableFilterType::IS_NOT_NULL: - return "IS_NOT_NULL"; - case TableFilterType::CONJUNCTION_OR: - return "CONJUNCTION_OR"; - case TableFilterType::CONJUNCTION_AND: - return "CONJUNCTION_AND"; - case TableFilterType::STRUCT_EXTRACT: - return "STRUCT_EXTRACT"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTableFilterTypeValues(), 6, static_cast(value)); } template<> TableFilterType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "CONSTANT_COMPARISON")) { - return TableFilterType::CONSTANT_COMPARISON; - } - if (StringUtil::Equals(value, "IS_NULL")) { - return TableFilterType::IS_NULL; - } - if (StringUtil::Equals(value, "IS_NOT_NULL")) { - return TableFilterType::IS_NOT_NULL; - } - if (StringUtil::Equals(value, "CONJUNCTION_OR")) { - return TableFilterType::CONJUNCTION_OR; - } - if (StringUtil::Equals(value, "CONJUNCTION_AND")) { - return TableFilterType::CONJUNCTION_AND; - } - if (StringUtil::Equals(value, "STRUCT_EXTRACT")) { - return TableFilterType::STRUCT_EXTRACT; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTableFilterTypeValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetTableReferenceTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TableReferenceType::INVALID), "INVALID" }, + { static_cast(TableReferenceType::BASE_TABLE), "BASE_TABLE" }, + { static_cast(TableReferenceType::SUBQUERY), "SUBQUERY" }, + { static_cast(TableReferenceType::JOIN), "JOIN" }, + { static_cast(TableReferenceType::TABLE_FUNCTION), "TABLE_FUNCTION" }, + { static_cast(TableReferenceType::EXPRESSION_LIST), "EXPRESSION_LIST" }, + { static_cast(TableReferenceType::CTE), "CTE" }, + { static_cast(TableReferenceType::EMPTY_FROM), "EMPTY" }, + { static_cast(TableReferenceType::PIVOT), "PIVOT" }, + { static_cast(TableReferenceType::SHOW_REF), "SHOW_REF" }, + { static_cast(TableReferenceType::COLUMN_DATA), "COLUMN_DATA" }, + { static_cast(TableReferenceType::DELIM_GET), "DELIM_GET" } + }; + return values; } template<> const char* EnumUtil::ToChars(TableReferenceType value) { - switch(value) { - case TableReferenceType::INVALID: - return "INVALID"; - case TableReferenceType::BASE_TABLE: - return "BASE_TABLE"; - case TableReferenceType::SUBQUERY: - return "SUBQUERY"; - case TableReferenceType::JOIN: - return "JOIN"; - case TableReferenceType::TABLE_FUNCTION: - return "TABLE_FUNCTION"; - case TableReferenceType::EXPRESSION_LIST: - return "EXPRESSION_LIST"; - case TableReferenceType::CTE: - return "CTE"; - case TableReferenceType::EMPTY_FROM: - return "EMPTY"; - case TableReferenceType::PIVOT: - return "PIVOT"; - case TableReferenceType::SHOW_REF: - return "SHOW_REF"; - case TableReferenceType::COLUMN_DATA: - return "COLUMN_DATA"; - case TableReferenceType::DELIM_GET: - return "DELIM_GET"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTableReferenceTypeValues(), 12, static_cast(value)); } template<> TableReferenceType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return TableReferenceType::INVALID; - } - if (StringUtil::Equals(value, "BASE_TABLE")) { - return TableReferenceType::BASE_TABLE; - } - if (StringUtil::Equals(value, "SUBQUERY")) { - return TableReferenceType::SUBQUERY; - } - if (StringUtil::Equals(value, "JOIN")) { - return TableReferenceType::JOIN; - } - if (StringUtil::Equals(value, "TABLE_FUNCTION")) { - return TableReferenceType::TABLE_FUNCTION; - } - if (StringUtil::Equals(value, "EXPRESSION_LIST")) { - return TableReferenceType::EXPRESSION_LIST; - } - if (StringUtil::Equals(value, "CTE")) { - return TableReferenceType::CTE; - } - if (StringUtil::Equals(value, "EMPTY")) { - return TableReferenceType::EMPTY_FROM; - } - if (StringUtil::Equals(value, "PIVOT")) { - return TableReferenceType::PIVOT; - } - if (StringUtil::Equals(value, "SHOW_REF")) { - return TableReferenceType::SHOW_REF; - } - if (StringUtil::Equals(value, "COLUMN_DATA")) { - return TableReferenceType::COLUMN_DATA; - } - if (StringUtil::Equals(value, "DELIM_GET")) { - return TableReferenceType::DELIM_GET; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTableReferenceTypeValues(), 12, value)); +} + +const StringUtil::EnumStringLiteral *GetTableScanTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TableScanType::TABLE_SCAN_REGULAR), "TABLE_SCAN_REGULAR" }, + { static_cast(TableScanType::TABLE_SCAN_COMMITTED_ROWS), "TABLE_SCAN_COMMITTED_ROWS" }, + { static_cast(TableScanType::TABLE_SCAN_COMMITTED_ROWS_DISALLOW_UPDATES), "TABLE_SCAN_COMMITTED_ROWS_DISALLOW_UPDATES" }, + { static_cast(TableScanType::TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED), "TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED" }, + { static_cast(TableScanType::TABLE_SCAN_LATEST_COMMITTED_ROWS), "TABLE_SCAN_LATEST_COMMITTED_ROWS" } + }; + return values; } template<> const char* EnumUtil::ToChars(TableScanType value) { - switch(value) { - case TableScanType::TABLE_SCAN_REGULAR: - return "TABLE_SCAN_REGULAR"; - case TableScanType::TABLE_SCAN_COMMITTED_ROWS: - return "TABLE_SCAN_COMMITTED_ROWS"; - case TableScanType::TABLE_SCAN_COMMITTED_ROWS_DISALLOW_UPDATES: - return "TABLE_SCAN_COMMITTED_ROWS_DISALLOW_UPDATES"; - case TableScanType::TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED: - return "TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED"; - case TableScanType::TABLE_SCAN_LATEST_COMMITTED_ROWS: - return "TABLE_SCAN_LATEST_COMMITTED_ROWS"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTableScanTypeValues(), 5, static_cast(value)); } template<> TableScanType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "TABLE_SCAN_REGULAR")) { - return TableScanType::TABLE_SCAN_REGULAR; - } - if (StringUtil::Equals(value, "TABLE_SCAN_COMMITTED_ROWS")) { - return TableScanType::TABLE_SCAN_COMMITTED_ROWS; - } - if (StringUtil::Equals(value, "TABLE_SCAN_COMMITTED_ROWS_DISALLOW_UPDATES")) { - return TableScanType::TABLE_SCAN_COMMITTED_ROWS_DISALLOW_UPDATES; - } - if (StringUtil::Equals(value, "TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED")) { - return TableScanType::TABLE_SCAN_COMMITTED_ROWS_OMIT_PERMANENTLY_DELETED; - } - if (StringUtil::Equals(value, "TABLE_SCAN_LATEST_COMMITTED_ROWS")) { - return TableScanType::TABLE_SCAN_LATEST_COMMITTED_ROWS; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTableScanTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetTaskExecutionModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TaskExecutionMode::PROCESS_ALL), "PROCESS_ALL" }, + { static_cast(TaskExecutionMode::PROCESS_PARTIAL), "PROCESS_PARTIAL" } + }; + return values; } template<> const char* EnumUtil::ToChars(TaskExecutionMode value) { - switch(value) { - case TaskExecutionMode::PROCESS_ALL: - return "PROCESS_ALL"; - case TaskExecutionMode::PROCESS_PARTIAL: - return "PROCESS_PARTIAL"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTaskExecutionModeValues(), 2, static_cast(value)); } template<> TaskExecutionMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "PROCESS_ALL")) { - return TaskExecutionMode::PROCESS_ALL; - } - if (StringUtil::Equals(value, "PROCESS_PARTIAL")) { - return TaskExecutionMode::PROCESS_PARTIAL; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTaskExecutionModeValues(), 2, value)); +} + +const StringUtil::EnumStringLiteral *GetTaskExecutionResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TaskExecutionResult::TASK_FINISHED), "TASK_FINISHED" }, + { static_cast(TaskExecutionResult::TASK_NOT_FINISHED), "TASK_NOT_FINISHED" }, + { static_cast(TaskExecutionResult::TASK_ERROR), "TASK_ERROR" }, + { static_cast(TaskExecutionResult::TASK_BLOCKED), "TASK_BLOCKED" } + }; + return values; } template<> const char* EnumUtil::ToChars(TaskExecutionResult value) { - switch(value) { - case TaskExecutionResult::TASK_FINISHED: - return "TASK_FINISHED"; - case TaskExecutionResult::TASK_NOT_FINISHED: - return "TASK_NOT_FINISHED"; - case TaskExecutionResult::TASK_ERROR: - return "TASK_ERROR"; - case TaskExecutionResult::TASK_BLOCKED: - return "TASK_BLOCKED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTaskExecutionResultValues(), 4, static_cast(value)); } template<> TaskExecutionResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "TASK_FINISHED")) { - return TaskExecutionResult::TASK_FINISHED; - } - if (StringUtil::Equals(value, "TASK_NOT_FINISHED")) { - return TaskExecutionResult::TASK_NOT_FINISHED; - } - if (StringUtil::Equals(value, "TASK_ERROR")) { - return TaskExecutionResult::TASK_ERROR; - } - if (StringUtil::Equals(value, "TASK_BLOCKED")) { - return TaskExecutionResult::TASK_BLOCKED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTaskExecutionResultValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetTimestampCastResultValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TimestampCastResult::SUCCESS), "SUCCESS" }, + { static_cast(TimestampCastResult::ERROR_INCORRECT_FORMAT), "ERROR_INCORRECT_FORMAT" }, + { static_cast(TimestampCastResult::ERROR_NON_UTC_TIMEZONE), "ERROR_NON_UTC_TIMEZONE" } + }; + return values; } template<> const char* EnumUtil::ToChars(TimestampCastResult value) { - switch(value) { - case TimestampCastResult::SUCCESS: - return "SUCCESS"; - case TimestampCastResult::ERROR_INCORRECT_FORMAT: - return "ERROR_INCORRECT_FORMAT"; - case TimestampCastResult::ERROR_NON_UTC_TIMEZONE: - return "ERROR_NON_UTC_TIMEZONE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTimestampCastResultValues(), 3, static_cast(value)); } template<> TimestampCastResult EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "SUCCESS")) { - return TimestampCastResult::SUCCESS; - } - if (StringUtil::Equals(value, "ERROR_INCORRECT_FORMAT")) { - return TimestampCastResult::ERROR_INCORRECT_FORMAT; - } - if (StringUtil::Equals(value, "ERROR_NON_UTC_TIMEZONE")) { - return TimestampCastResult::ERROR_NON_UTC_TIMEZONE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTimestampCastResultValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetTransactionModifierTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TransactionModifierType::TRANSACTION_DEFAULT_MODIFIER), "TRANSACTION_DEFAULT_MODIFIER" }, + { static_cast(TransactionModifierType::TRANSACTION_READ_ONLY), "TRANSACTION_READ_ONLY" }, + { static_cast(TransactionModifierType::TRANSACTION_READ_WRITE), "TRANSACTION_READ_WRITE" } + }; + return values; } template<> const char* EnumUtil::ToChars(TransactionModifierType value) { - switch(value) { - case TransactionModifierType::TRANSACTION_DEFAULT_MODIFIER: - return "TRANSACTION_DEFAULT_MODIFIER"; - case TransactionModifierType::TRANSACTION_READ_ONLY: - return "TRANSACTION_READ_ONLY"; - case TransactionModifierType::TRANSACTION_READ_WRITE: - return "TRANSACTION_READ_WRITE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTransactionModifierTypeValues(), 3, static_cast(value)); } template<> TransactionModifierType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "TRANSACTION_DEFAULT_MODIFIER")) { - return TransactionModifierType::TRANSACTION_DEFAULT_MODIFIER; - } - if (StringUtil::Equals(value, "TRANSACTION_READ_ONLY")) { - return TransactionModifierType::TRANSACTION_READ_ONLY; - } - if (StringUtil::Equals(value, "TRANSACTION_READ_WRITE")) { - return TransactionModifierType::TRANSACTION_READ_WRITE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTransactionModifierTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetTransactionTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TransactionType::INVALID), "INVALID" }, + { static_cast(TransactionType::BEGIN_TRANSACTION), "BEGIN_TRANSACTION" }, + { static_cast(TransactionType::COMMIT), "COMMIT" }, + { static_cast(TransactionType::ROLLBACK), "ROLLBACK" } + }; + return values; } template<> const char* EnumUtil::ToChars(TransactionType value) { - switch(value) { - case TransactionType::INVALID: - return "INVALID"; - case TransactionType::BEGIN_TRANSACTION: - return "BEGIN_TRANSACTION"; - case TransactionType::COMMIT: - return "COMMIT"; - case TransactionType::ROLLBACK: - return "ROLLBACK"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTransactionTypeValues(), 4, static_cast(value)); } template<> TransactionType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return TransactionType::INVALID; - } - if (StringUtil::Equals(value, "BEGIN_TRANSACTION")) { - return TransactionType::BEGIN_TRANSACTION; - } - if (StringUtil::Equals(value, "COMMIT")) { - return TransactionType::COMMIT; - } - if (StringUtil::Equals(value, "ROLLBACK")) { - return TransactionType::ROLLBACK; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTransactionTypeValues(), 4, value)); +} + +const StringUtil::EnumStringLiteral *GetTupleDataPinPropertiesValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(TupleDataPinProperties::INVALID), "INVALID" }, + { static_cast(TupleDataPinProperties::KEEP_EVERYTHING_PINNED), "KEEP_EVERYTHING_PINNED" }, + { static_cast(TupleDataPinProperties::UNPIN_AFTER_DONE), "UNPIN_AFTER_DONE" }, + { static_cast(TupleDataPinProperties::DESTROY_AFTER_DONE), "DESTROY_AFTER_DONE" }, + { static_cast(TupleDataPinProperties::ALREADY_PINNED), "ALREADY_PINNED" } + }; + return values; } template<> const char* EnumUtil::ToChars(TupleDataPinProperties value) { - switch(value) { - case TupleDataPinProperties::INVALID: - return "INVALID"; - case TupleDataPinProperties::KEEP_EVERYTHING_PINNED: - return "KEEP_EVERYTHING_PINNED"; - case TupleDataPinProperties::UNPIN_AFTER_DONE: - return "UNPIN_AFTER_DONE"; - case TupleDataPinProperties::DESTROY_AFTER_DONE: - return "DESTROY_AFTER_DONE"; - case TupleDataPinProperties::ALREADY_PINNED: - return "ALREADY_PINNED"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetTupleDataPinPropertiesValues(), 5, static_cast(value)); } template<> TupleDataPinProperties EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return TupleDataPinProperties::INVALID; - } - if (StringUtil::Equals(value, "KEEP_EVERYTHING_PINNED")) { - return TupleDataPinProperties::KEEP_EVERYTHING_PINNED; - } - if (StringUtil::Equals(value, "UNPIN_AFTER_DONE")) { - return TupleDataPinProperties::UNPIN_AFTER_DONE; - } - if (StringUtil::Equals(value, "DESTROY_AFTER_DONE")) { - return TupleDataPinProperties::DESTROY_AFTER_DONE; - } - if (StringUtil::Equals(value, "ALREADY_PINNED")) { - return TupleDataPinProperties::ALREADY_PINNED; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetTupleDataPinPropertiesValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetUndoFlagsValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(UndoFlags::EMPTY_ENTRY), "EMPTY_ENTRY" }, + { static_cast(UndoFlags::CATALOG_ENTRY), "CATALOG_ENTRY" }, + { static_cast(UndoFlags::INSERT_TUPLE), "INSERT_TUPLE" }, + { static_cast(UndoFlags::DELETE_TUPLE), "DELETE_TUPLE" }, + { static_cast(UndoFlags::UPDATE_TUPLE), "UPDATE_TUPLE" }, + { static_cast(UndoFlags::SEQUENCE_VALUE), "SEQUENCE_VALUE" } + }; + return values; } template<> const char* EnumUtil::ToChars(UndoFlags value) { - switch(value) { - case UndoFlags::EMPTY_ENTRY: - return "EMPTY_ENTRY"; - case UndoFlags::CATALOG_ENTRY: - return "CATALOG_ENTRY"; - case UndoFlags::INSERT_TUPLE: - return "INSERT_TUPLE"; - case UndoFlags::DELETE_TUPLE: - return "DELETE_TUPLE"; - case UndoFlags::UPDATE_TUPLE: - return "UPDATE_TUPLE"; - case UndoFlags::SEQUENCE_VALUE: - return "SEQUENCE_VALUE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetUndoFlagsValues(), 6, static_cast(value)); } template<> UndoFlags EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "EMPTY_ENTRY")) { - return UndoFlags::EMPTY_ENTRY; - } - if (StringUtil::Equals(value, "CATALOG_ENTRY")) { - return UndoFlags::CATALOG_ENTRY; - } - if (StringUtil::Equals(value, "INSERT_TUPLE")) { - return UndoFlags::INSERT_TUPLE; - } - if (StringUtil::Equals(value, "DELETE_TUPLE")) { - return UndoFlags::DELETE_TUPLE; - } - if (StringUtil::Equals(value, "UPDATE_TUPLE")) { - return UndoFlags::UPDATE_TUPLE; - } - if (StringUtil::Equals(value, "SEQUENCE_VALUE")) { - return UndoFlags::SEQUENCE_VALUE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetUndoFlagsValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetUnionInvalidReasonValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(UnionInvalidReason::VALID), "VALID" }, + { static_cast(UnionInvalidReason::TAG_OUT_OF_RANGE), "TAG_OUT_OF_RANGE" }, + { static_cast(UnionInvalidReason::NO_MEMBERS), "NO_MEMBERS" }, + { static_cast(UnionInvalidReason::VALIDITY_OVERLAP), "VALIDITY_OVERLAP" }, + { static_cast(UnionInvalidReason::TAG_MISMATCH), "TAG_MISMATCH" }, + { static_cast(UnionInvalidReason::NULL_TAG), "NULL_TAG" } + }; + return values; } template<> const char* EnumUtil::ToChars(UnionInvalidReason value) { - switch(value) { - case UnionInvalidReason::VALID: - return "VALID"; - case UnionInvalidReason::TAG_OUT_OF_RANGE: - return "TAG_OUT_OF_RANGE"; - case UnionInvalidReason::NO_MEMBERS: - return "NO_MEMBERS"; - case UnionInvalidReason::VALIDITY_OVERLAP: - return "VALIDITY_OVERLAP"; - case UnionInvalidReason::TAG_MISMATCH: - return "TAG_MISMATCH"; - case UnionInvalidReason::NULL_TAG: - return "NULL_TAG"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetUnionInvalidReasonValues(), 6, static_cast(value)); } template<> UnionInvalidReason EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "VALID")) { - return UnionInvalidReason::VALID; - } - if (StringUtil::Equals(value, "TAG_OUT_OF_RANGE")) { - return UnionInvalidReason::TAG_OUT_OF_RANGE; - } - if (StringUtil::Equals(value, "NO_MEMBERS")) { - return UnionInvalidReason::NO_MEMBERS; - } - if (StringUtil::Equals(value, "VALIDITY_OVERLAP")) { - return UnionInvalidReason::VALIDITY_OVERLAP; - } - if (StringUtil::Equals(value, "TAG_MISMATCH")) { - return UnionInvalidReason::TAG_MISMATCH; - } - if (StringUtil::Equals(value, "NULL_TAG")) { - return UnionInvalidReason::NULL_TAG; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetUnionInvalidReasonValues(), 6, value)); +} + +const StringUtil::EnumStringLiteral *GetVectorAuxiliaryDataTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(VectorAuxiliaryDataType::ARROW_AUXILIARY), "ARROW_AUXILIARY" } + }; + return values; } template<> const char* EnumUtil::ToChars(VectorAuxiliaryDataType value) { - switch(value) { - case VectorAuxiliaryDataType::ARROW_AUXILIARY: - return "ARROW_AUXILIARY"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetVectorAuxiliaryDataTypeValues(), 1, static_cast(value)); } template<> VectorAuxiliaryDataType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ARROW_AUXILIARY")) { - return VectorAuxiliaryDataType::ARROW_AUXILIARY; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetVectorAuxiliaryDataTypeValues(), 1, value)); +} + +const StringUtil::EnumStringLiteral *GetVectorBufferTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(VectorBufferType::STANDARD_BUFFER), "STANDARD_BUFFER" }, + { static_cast(VectorBufferType::DICTIONARY_BUFFER), "DICTIONARY_BUFFER" }, + { static_cast(VectorBufferType::VECTOR_CHILD_BUFFER), "VECTOR_CHILD_BUFFER" }, + { static_cast(VectorBufferType::STRING_BUFFER), "STRING_BUFFER" }, + { static_cast(VectorBufferType::FSST_BUFFER), "FSST_BUFFER" }, + { static_cast(VectorBufferType::STRUCT_BUFFER), "STRUCT_BUFFER" }, + { static_cast(VectorBufferType::LIST_BUFFER), "LIST_BUFFER" }, + { static_cast(VectorBufferType::MANAGED_BUFFER), "MANAGED_BUFFER" }, + { static_cast(VectorBufferType::OPAQUE_BUFFER), "OPAQUE_BUFFER" }, + { static_cast(VectorBufferType::ARRAY_BUFFER), "ARRAY_BUFFER" } + }; + return values; } template<> const char* EnumUtil::ToChars(VectorBufferType value) { - switch(value) { - case VectorBufferType::STANDARD_BUFFER: - return "STANDARD_BUFFER"; - case VectorBufferType::DICTIONARY_BUFFER: - return "DICTIONARY_BUFFER"; - case VectorBufferType::VECTOR_CHILD_BUFFER: - return "VECTOR_CHILD_BUFFER"; - case VectorBufferType::STRING_BUFFER: - return "STRING_BUFFER"; - case VectorBufferType::FSST_BUFFER: - return "FSST_BUFFER"; - case VectorBufferType::STRUCT_BUFFER: - return "STRUCT_BUFFER"; - case VectorBufferType::LIST_BUFFER: - return "LIST_BUFFER"; - case VectorBufferType::MANAGED_BUFFER: - return "MANAGED_BUFFER"; - case VectorBufferType::OPAQUE_BUFFER: - return "OPAQUE_BUFFER"; - case VectorBufferType::ARRAY_BUFFER: - return "ARRAY_BUFFER"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetVectorBufferTypeValues(), 10, static_cast(value)); } template<> VectorBufferType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "STANDARD_BUFFER")) { - return VectorBufferType::STANDARD_BUFFER; - } - if (StringUtil::Equals(value, "DICTIONARY_BUFFER")) { - return VectorBufferType::DICTIONARY_BUFFER; - } - if (StringUtil::Equals(value, "VECTOR_CHILD_BUFFER")) { - return VectorBufferType::VECTOR_CHILD_BUFFER; - } - if (StringUtil::Equals(value, "STRING_BUFFER")) { - return VectorBufferType::STRING_BUFFER; - } - if (StringUtil::Equals(value, "FSST_BUFFER")) { - return VectorBufferType::FSST_BUFFER; - } - if (StringUtil::Equals(value, "STRUCT_BUFFER")) { - return VectorBufferType::STRUCT_BUFFER; - } - if (StringUtil::Equals(value, "LIST_BUFFER")) { - return VectorBufferType::LIST_BUFFER; - } - if (StringUtil::Equals(value, "MANAGED_BUFFER")) { - return VectorBufferType::MANAGED_BUFFER; - } - if (StringUtil::Equals(value, "OPAQUE_BUFFER")) { - return VectorBufferType::OPAQUE_BUFFER; - } - if (StringUtil::Equals(value, "ARRAY_BUFFER")) { - return VectorBufferType::ARRAY_BUFFER; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetVectorBufferTypeValues(), 10, value)); +} + +const StringUtil::EnumStringLiteral *GetVectorTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(VectorType::FLAT_VECTOR), "FLAT_VECTOR" }, + { static_cast(VectorType::FSST_VECTOR), "FSST_VECTOR" }, + { static_cast(VectorType::CONSTANT_VECTOR), "CONSTANT_VECTOR" }, + { static_cast(VectorType::DICTIONARY_VECTOR), "DICTIONARY_VECTOR" }, + { static_cast(VectorType::SEQUENCE_VECTOR), "SEQUENCE_VECTOR" } + }; + return values; } template<> const char* EnumUtil::ToChars(VectorType value) { - switch(value) { - case VectorType::FLAT_VECTOR: - return "FLAT_VECTOR"; - case VectorType::FSST_VECTOR: - return "FSST_VECTOR"; - case VectorType::CONSTANT_VECTOR: - return "CONSTANT_VECTOR"; - case VectorType::DICTIONARY_VECTOR: - return "DICTIONARY_VECTOR"; - case VectorType::SEQUENCE_VECTOR: - return "SEQUENCE_VECTOR"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetVectorTypeValues(), 5, static_cast(value)); } template<> VectorType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "FLAT_VECTOR")) { - return VectorType::FLAT_VECTOR; - } - if (StringUtil::Equals(value, "FSST_VECTOR")) { - return VectorType::FSST_VECTOR; - } - if (StringUtil::Equals(value, "CONSTANT_VECTOR")) { - return VectorType::CONSTANT_VECTOR; - } - if (StringUtil::Equals(value, "DICTIONARY_VECTOR")) { - return VectorType::DICTIONARY_VECTOR; - } - if (StringUtil::Equals(value, "SEQUENCE_VECTOR")) { - return VectorType::SEQUENCE_VECTOR; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetVectorTypeValues(), 5, value)); +} + +const StringUtil::EnumStringLiteral *GetVerificationTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(VerificationType::ORIGINAL), "ORIGINAL" }, + { static_cast(VerificationType::COPIED), "COPIED" }, + { static_cast(VerificationType::DESERIALIZED), "DESERIALIZED" }, + { static_cast(VerificationType::PARSED), "PARSED" }, + { static_cast(VerificationType::UNOPTIMIZED), "UNOPTIMIZED" }, + { static_cast(VerificationType::NO_OPERATOR_CACHING), "NO_OPERATOR_CACHING" }, + { static_cast(VerificationType::PREPARED), "PREPARED" }, + { static_cast(VerificationType::EXTERNAL), "EXTERNAL" }, + { static_cast(VerificationType::FETCH_ROW_AS_SCAN), "FETCH_ROW_AS_SCAN" }, + { static_cast(VerificationType::INVALID), "INVALID" } + }; + return values; } template<> const char* EnumUtil::ToChars(VerificationType value) { - switch(value) { - case VerificationType::ORIGINAL: - return "ORIGINAL"; - case VerificationType::COPIED: - return "COPIED"; - case VerificationType::DESERIALIZED: - return "DESERIALIZED"; - case VerificationType::PARSED: - return "PARSED"; - case VerificationType::UNOPTIMIZED: - return "UNOPTIMIZED"; - case VerificationType::NO_OPERATOR_CACHING: - return "NO_OPERATOR_CACHING"; - case VerificationType::PREPARED: - return "PREPARED"; - case VerificationType::EXTERNAL: - return "EXTERNAL"; - case VerificationType::FETCH_ROW_AS_SCAN: - return "FETCH_ROW_AS_SCAN"; - case VerificationType::INVALID: - return "INVALID"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetVerificationTypeValues(), 10, static_cast(value)); } template<> VerificationType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "ORIGINAL")) { - return VerificationType::ORIGINAL; - } - if (StringUtil::Equals(value, "COPIED")) { - return VerificationType::COPIED; - } - if (StringUtil::Equals(value, "DESERIALIZED")) { - return VerificationType::DESERIALIZED; - } - if (StringUtil::Equals(value, "PARSED")) { - return VerificationType::PARSED; - } - if (StringUtil::Equals(value, "UNOPTIMIZED")) { - return VerificationType::UNOPTIMIZED; - } - if (StringUtil::Equals(value, "NO_OPERATOR_CACHING")) { - return VerificationType::NO_OPERATOR_CACHING; - } - if (StringUtil::Equals(value, "PREPARED")) { - return VerificationType::PREPARED; - } - if (StringUtil::Equals(value, "EXTERNAL")) { - return VerificationType::EXTERNAL; - } - if (StringUtil::Equals(value, "FETCH_ROW_AS_SCAN")) { - return VerificationType::FETCH_ROW_AS_SCAN; - } - if (StringUtil::Equals(value, "INVALID")) { - return VerificationType::INVALID; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetVerificationTypeValues(), 10, value)); +} + +const StringUtil::EnumStringLiteral *GetVerifyExistenceTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(VerifyExistenceType::APPEND), "APPEND" }, + { static_cast(VerifyExistenceType::APPEND_FK), "APPEND_FK" }, + { static_cast(VerifyExistenceType::DELETE_FK), "DELETE_FK" } + }; + return values; } template<> const char* EnumUtil::ToChars(VerifyExistenceType value) { - switch(value) { - case VerifyExistenceType::APPEND: - return "APPEND"; - case VerifyExistenceType::APPEND_FK: - return "APPEND_FK"; - case VerifyExistenceType::DELETE_FK: - return "DELETE_FK"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetVerifyExistenceTypeValues(), 3, static_cast(value)); } template<> VerifyExistenceType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "APPEND")) { - return VerifyExistenceType::APPEND; - } - if (StringUtil::Equals(value, "APPEND_FK")) { - return VerifyExistenceType::APPEND_FK; - } - if (StringUtil::Equals(value, "DELETE_FK")) { - return VerifyExistenceType::DELETE_FK; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetVerifyExistenceTypeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetWALTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(WALType::INVALID), "INVALID" }, + { static_cast(WALType::CREATE_TABLE), "CREATE_TABLE" }, + { static_cast(WALType::DROP_TABLE), "DROP_TABLE" }, + { static_cast(WALType::CREATE_SCHEMA), "CREATE_SCHEMA" }, + { static_cast(WALType::DROP_SCHEMA), "DROP_SCHEMA" }, + { static_cast(WALType::CREATE_VIEW), "CREATE_VIEW" }, + { static_cast(WALType::DROP_VIEW), "DROP_VIEW" }, + { static_cast(WALType::CREATE_SEQUENCE), "CREATE_SEQUENCE" }, + { static_cast(WALType::DROP_SEQUENCE), "DROP_SEQUENCE" }, + { static_cast(WALType::SEQUENCE_VALUE), "SEQUENCE_VALUE" }, + { static_cast(WALType::CREATE_MACRO), "CREATE_MACRO" }, + { static_cast(WALType::DROP_MACRO), "DROP_MACRO" }, + { static_cast(WALType::CREATE_TYPE), "CREATE_TYPE" }, + { static_cast(WALType::DROP_TYPE), "DROP_TYPE" }, + { static_cast(WALType::ALTER_INFO), "ALTER_INFO" }, + { static_cast(WALType::CREATE_TABLE_MACRO), "CREATE_TABLE_MACRO" }, + { static_cast(WALType::DROP_TABLE_MACRO), "DROP_TABLE_MACRO" }, + { static_cast(WALType::CREATE_INDEX), "CREATE_INDEX" }, + { static_cast(WALType::DROP_INDEX), "DROP_INDEX" }, + { static_cast(WALType::USE_TABLE), "USE_TABLE" }, + { static_cast(WALType::INSERT_TUPLE), "INSERT_TUPLE" }, + { static_cast(WALType::DELETE_TUPLE), "DELETE_TUPLE" }, + { static_cast(WALType::UPDATE_TUPLE), "UPDATE_TUPLE" }, + { static_cast(WALType::ROW_GROUP_DATA), "ROW_GROUP_DATA" }, + { static_cast(WALType::WAL_VERSION), "WAL_VERSION" }, + { static_cast(WALType::CHECKPOINT), "CHECKPOINT" }, + { static_cast(WALType::WAL_FLUSH), "WAL_FLUSH" } + }; + return values; } template<> const char* EnumUtil::ToChars(WALType value) { - switch(value) { - case WALType::INVALID: - return "INVALID"; - case WALType::CREATE_TABLE: - return "CREATE_TABLE"; - case WALType::DROP_TABLE: - return "DROP_TABLE"; - case WALType::CREATE_SCHEMA: - return "CREATE_SCHEMA"; - case WALType::DROP_SCHEMA: - return "DROP_SCHEMA"; - case WALType::CREATE_VIEW: - return "CREATE_VIEW"; - case WALType::DROP_VIEW: - return "DROP_VIEW"; - case WALType::CREATE_SEQUENCE: - return "CREATE_SEQUENCE"; - case WALType::DROP_SEQUENCE: - return "DROP_SEQUENCE"; - case WALType::SEQUENCE_VALUE: - return "SEQUENCE_VALUE"; - case WALType::CREATE_MACRO: - return "CREATE_MACRO"; - case WALType::DROP_MACRO: - return "DROP_MACRO"; - case WALType::CREATE_TYPE: - return "CREATE_TYPE"; - case WALType::DROP_TYPE: - return "DROP_TYPE"; - case WALType::ALTER_INFO: - return "ALTER_INFO"; - case WALType::CREATE_TABLE_MACRO: - return "CREATE_TABLE_MACRO"; - case WALType::DROP_TABLE_MACRO: - return "DROP_TABLE_MACRO"; - case WALType::CREATE_INDEX: - return "CREATE_INDEX"; - case WALType::DROP_INDEX: - return "DROP_INDEX"; - case WALType::USE_TABLE: - return "USE_TABLE"; - case WALType::INSERT_TUPLE: - return "INSERT_TUPLE"; - case WALType::DELETE_TUPLE: - return "DELETE_TUPLE"; - case WALType::UPDATE_TUPLE: - return "UPDATE_TUPLE"; - case WALType::ROW_GROUP_DATA: - return "ROW_GROUP_DATA"; - case WALType::WAL_VERSION: - return "WAL_VERSION"; - case WALType::CHECKPOINT: - return "CHECKPOINT"; - case WALType::WAL_FLUSH: - return "WAL_FLUSH"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetWALTypeValues(), 27, static_cast(value)); } template<> WALType EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return WALType::INVALID; - } - if (StringUtil::Equals(value, "CREATE_TABLE")) { - return WALType::CREATE_TABLE; - } - if (StringUtil::Equals(value, "DROP_TABLE")) { - return WALType::DROP_TABLE; - } - if (StringUtil::Equals(value, "CREATE_SCHEMA")) { - return WALType::CREATE_SCHEMA; - } - if (StringUtil::Equals(value, "DROP_SCHEMA")) { - return WALType::DROP_SCHEMA; - } - if (StringUtil::Equals(value, "CREATE_VIEW")) { - return WALType::CREATE_VIEW; - } - if (StringUtil::Equals(value, "DROP_VIEW")) { - return WALType::DROP_VIEW; - } - if (StringUtil::Equals(value, "CREATE_SEQUENCE")) { - return WALType::CREATE_SEQUENCE; - } - if (StringUtil::Equals(value, "DROP_SEQUENCE")) { - return WALType::DROP_SEQUENCE; - } - if (StringUtil::Equals(value, "SEQUENCE_VALUE")) { - return WALType::SEQUENCE_VALUE; - } - if (StringUtil::Equals(value, "CREATE_MACRO")) { - return WALType::CREATE_MACRO; - } - if (StringUtil::Equals(value, "DROP_MACRO")) { - return WALType::DROP_MACRO; - } - if (StringUtil::Equals(value, "CREATE_TYPE")) { - return WALType::CREATE_TYPE; - } - if (StringUtil::Equals(value, "DROP_TYPE")) { - return WALType::DROP_TYPE; - } - if (StringUtil::Equals(value, "ALTER_INFO")) { - return WALType::ALTER_INFO; - } - if (StringUtil::Equals(value, "CREATE_TABLE_MACRO")) { - return WALType::CREATE_TABLE_MACRO; - } - if (StringUtil::Equals(value, "DROP_TABLE_MACRO")) { - return WALType::DROP_TABLE_MACRO; - } - if (StringUtil::Equals(value, "CREATE_INDEX")) { - return WALType::CREATE_INDEX; - } - if (StringUtil::Equals(value, "DROP_INDEX")) { - return WALType::DROP_INDEX; - } - if (StringUtil::Equals(value, "USE_TABLE")) { - return WALType::USE_TABLE; - } - if (StringUtil::Equals(value, "INSERT_TUPLE")) { - return WALType::INSERT_TUPLE; - } - if (StringUtil::Equals(value, "DELETE_TUPLE")) { - return WALType::DELETE_TUPLE; - } - if (StringUtil::Equals(value, "UPDATE_TUPLE")) { - return WALType::UPDATE_TUPLE; - } - if (StringUtil::Equals(value, "ROW_GROUP_DATA")) { - return WALType::ROW_GROUP_DATA; - } - if (StringUtil::Equals(value, "WAL_VERSION")) { - return WALType::WAL_VERSION; - } - if (StringUtil::Equals(value, "CHECKPOINT")) { - return WALType::CHECKPOINT; - } - if (StringUtil::Equals(value, "WAL_FLUSH")) { - return WALType::WAL_FLUSH; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetWALTypeValues(), 27, value)); +} + +const StringUtil::EnumStringLiteral *GetWindowAggregationModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(WindowAggregationMode::WINDOW), "WINDOW" }, + { static_cast(WindowAggregationMode::COMBINE), "COMBINE" }, + { static_cast(WindowAggregationMode::SEPARATE), "SEPARATE" } + }; + return values; } template<> const char* EnumUtil::ToChars(WindowAggregationMode value) { - switch(value) { - case WindowAggregationMode::WINDOW: - return "WINDOW"; - case WindowAggregationMode::COMBINE: - return "COMBINE"; - case WindowAggregationMode::SEPARATE: - return "SEPARATE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetWindowAggregationModeValues(), 3, static_cast(value)); } template<> WindowAggregationMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "WINDOW")) { - return WindowAggregationMode::WINDOW; - } - if (StringUtil::Equals(value, "COMBINE")) { - return WindowAggregationMode::COMBINE; - } - if (StringUtil::Equals(value, "SEPARATE")) { - return WindowAggregationMode::SEPARATE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetWindowAggregationModeValues(), 3, value)); +} + +const StringUtil::EnumStringLiteral *GetWindowBoundaryValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(WindowBoundary::INVALID), "INVALID" }, + { static_cast(WindowBoundary::UNBOUNDED_PRECEDING), "UNBOUNDED_PRECEDING" }, + { static_cast(WindowBoundary::UNBOUNDED_FOLLOWING), "UNBOUNDED_FOLLOWING" }, + { static_cast(WindowBoundary::CURRENT_ROW_RANGE), "CURRENT_ROW_RANGE" }, + { static_cast(WindowBoundary::CURRENT_ROW_ROWS), "CURRENT_ROW_ROWS" }, + { static_cast(WindowBoundary::EXPR_PRECEDING_ROWS), "EXPR_PRECEDING_ROWS" }, + { static_cast(WindowBoundary::EXPR_FOLLOWING_ROWS), "EXPR_FOLLOWING_ROWS" }, + { static_cast(WindowBoundary::EXPR_PRECEDING_RANGE), "EXPR_PRECEDING_RANGE" }, + { static_cast(WindowBoundary::EXPR_FOLLOWING_RANGE), "EXPR_FOLLOWING_RANGE" } + }; + return values; } template<> const char* EnumUtil::ToChars(WindowBoundary value) { - switch(value) { - case WindowBoundary::INVALID: - return "INVALID"; - case WindowBoundary::UNBOUNDED_PRECEDING: - return "UNBOUNDED_PRECEDING"; - case WindowBoundary::UNBOUNDED_FOLLOWING: - return "UNBOUNDED_FOLLOWING"; - case WindowBoundary::CURRENT_ROW_RANGE: - return "CURRENT_ROW_RANGE"; - case WindowBoundary::CURRENT_ROW_ROWS: - return "CURRENT_ROW_ROWS"; - case WindowBoundary::EXPR_PRECEDING_ROWS: - return "EXPR_PRECEDING_ROWS"; - case WindowBoundary::EXPR_FOLLOWING_ROWS: - return "EXPR_FOLLOWING_ROWS"; - case WindowBoundary::EXPR_PRECEDING_RANGE: - return "EXPR_PRECEDING_RANGE"; - case WindowBoundary::EXPR_FOLLOWING_RANGE: - return "EXPR_FOLLOWING_RANGE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetWindowBoundaryValues(), 9, static_cast(value)); } template<> WindowBoundary EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "INVALID")) { - return WindowBoundary::INVALID; - } - if (StringUtil::Equals(value, "UNBOUNDED_PRECEDING")) { - return WindowBoundary::UNBOUNDED_PRECEDING; - } - if (StringUtil::Equals(value, "UNBOUNDED_FOLLOWING")) { - return WindowBoundary::UNBOUNDED_FOLLOWING; - } - if (StringUtil::Equals(value, "CURRENT_ROW_RANGE")) { - return WindowBoundary::CURRENT_ROW_RANGE; - } - if (StringUtil::Equals(value, "CURRENT_ROW_ROWS")) { - return WindowBoundary::CURRENT_ROW_ROWS; - } - if (StringUtil::Equals(value, "EXPR_PRECEDING_ROWS")) { - return WindowBoundary::EXPR_PRECEDING_ROWS; - } - if (StringUtil::Equals(value, "EXPR_FOLLOWING_ROWS")) { - return WindowBoundary::EXPR_FOLLOWING_ROWS; - } - if (StringUtil::Equals(value, "EXPR_PRECEDING_RANGE")) { - return WindowBoundary::EXPR_PRECEDING_RANGE; - } - if (StringUtil::Equals(value, "EXPR_FOLLOWING_RANGE")) { - return WindowBoundary::EXPR_FOLLOWING_RANGE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetWindowBoundaryValues(), 9, value)); +} + +const StringUtil::EnumStringLiteral *GetWindowExcludeModeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(WindowExcludeMode::NO_OTHER), "NO_OTHER" }, + { static_cast(WindowExcludeMode::CURRENT_ROW), "CURRENT_ROW" }, + { static_cast(WindowExcludeMode::GROUP), "GROUP" }, + { static_cast(WindowExcludeMode::TIES), "TIES" } + }; + return values; } template<> const char* EnumUtil::ToChars(WindowExcludeMode value) { - switch(value) { - case WindowExcludeMode::NO_OTHER: - return "NO_OTHER"; - case WindowExcludeMode::CURRENT_ROW: - return "CURRENT_ROW"; - case WindowExcludeMode::GROUP: - return "GROUP"; - case WindowExcludeMode::TIES: - return "TIES"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } + return StringUtil::EnumToString(GetWindowExcludeModeValues(), 4, static_cast(value)); } template<> WindowExcludeMode EnumUtil::FromString(const char *value) { - if (StringUtil::Equals(value, "NO_OTHER")) { - return WindowExcludeMode::NO_OTHER; - } - if (StringUtil::Equals(value, "CURRENT_ROW")) { - return WindowExcludeMode::CURRENT_ROW; - } - if (StringUtil::Equals(value, "GROUP")) { - return WindowExcludeMode::GROUP; - } - if (StringUtil::Equals(value, "TIES")) { - return WindowExcludeMode::TIES; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); + return static_cast(StringUtil::StringToEnum(GetWindowExcludeModeValues(), 4, value)); } } diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index dd57bda7b82d..89b3c83ea6bc 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -713,4 +713,22 @@ string StringUtil::URLDecode(const string &input, bool plus_to_space) { return string(result_data.get(), result_size); } +uint32_t StringUtil::StringToEnum(const EnumStringLiteral enum_list[], idx_t enum_count, const char *str_value) { + for(idx_t i = 0; i < enum_count; i++) { + if (CIEquals(enum_list[i].string, str_value)) { + return enum_list[i].number; + } + } + throw NotImplementedException("Enum value: unrecognized string value %s for this enum type", str_value); +} + +const char *StringUtil::EnumToString(const EnumStringLiteral enum_list[], idx_t enum_count, uint32_t enum_value) { + for(idx_t i = 0; i < enum_count; i++) { + if (enum_list[i].number == enum_value) { + return enum_list[i].string; + } + } + throw NotImplementedException("Enum value: unrecognized enum value %s for this enum type", enum_value); +} + } // namespace duckdb diff --git a/src/include/duckdb/common/string_util.hpp b/src/include/duckdb/common/string_util.hpp index bf8c272d34a5..21fdc3ea9149 100644 --- a/src/include/duckdb/common/string_util.hpp +++ b/src/include/duckdb/common/string_util.hpp @@ -296,6 +296,14 @@ class StringUtil { DUCKDB_API static string GetFileExtension(const string &file_name); DUCKDB_API static string GetFileStem(const string &file_name); DUCKDB_API static string GetFilePath(const string &file_path); + + struct EnumStringLiteral { + uint32_t number; + const char *string; + }; + + DUCKDB_API static uint32_t StringToEnum(const EnumStringLiteral enum_list[], idx_t enum_count, const char *str_value); + DUCKDB_API static const char *EnumToString(const EnumStringLiteral enum_list[], idx_t enum_count, uint32_t enum_value); }; } // namespace duckdb From e64412da2bbe70db64aacc67810e393a927c35a8 Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Wed, 16 Oct 2024 09:57:43 +0200 Subject: [PATCH 02/19] Format fix --- scripts/generate_enum_util.py | 10 +++++++--- src/common/string_util.cpp | 15 +++++++++------ src/include/duckdb/common/string_util.hpp | 6 ++++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/generate_enum_util.py b/scripts/generate_enum_util.py index 0dd4bd3dc8a3..df27f747d613 100644 --- a/scripts/generate_enum_util.py +++ b/scripts/generate_enum_util.py @@ -203,16 +203,20 @@ def remove_prefix(str, prefix): f.write(",\n") f.write(f"\t\t{{ static_cast({enum_name}::{key}), \"{str_val}\" }}") member_count += 1 - f.write("\n\t};"); + f.write("\n\t};") f.write("\n\treturn values;") f.write("\n}\n\n") f.write(f"template<>\nconst char* EnumUtil::ToChars<{enum_name}>({enum_name} value) {{\n") - f.write(f"\treturn StringUtil::EnumToString({enum_string_array}, {member_count}, \"{enum_name}\", static_cast(value));\n"); + f.write( + f"\treturn StringUtil::EnumToString({enum_string_array}, {member_count}, \"{enum_name}\", static_cast(value));\n" + ) f.write("}\n\n") # Write the string to enum f.write(f"template<>\n{enum_name} EnumUtil::FromString<{enum_name}>(const char *value) {{\n") - f.write(f"\treturn static_cast<{enum_name}>(StringUtil::StringToEnum({enum_string_array}, {member_count}, \"{enum_name}\", value));") + f.write( + f"\treturn static_cast<{enum_name}>(StringUtil::StringToEnum({enum_string_array}, {member_count}, \"{enum_name}\", value));" + ) f.write("\n}\n\n") f.write("}\n\n") diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 45b43d5c014f..f03a988fbcc2 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -713,24 +713,27 @@ string StringUtil::URLDecode(const string &input, bool plus_to_space) { return string(result_data.get(), result_size); } -uint32_t StringUtil::StringToEnum(const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, const char *str_value) { - for(idx_t i = 0; i < enum_count; i++) { +uint32_t StringUtil::StringToEnum(const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, + const char *str_value) { + for (idx_t i = 0; i < enum_count; i++) { if (CIEquals(enum_list[i].string, str_value)) { return enum_list[i].number; } } // string to enum conversion failed - generate candidates vector candidates; - for(idx_t i = 0; i < enum_count; i++) { + for (idx_t i = 0; i < enum_count; i++) { candidates.push_back(enum_list[i].string); } auto closest_values = TopNJaroWinkler(candidates, str_value); auto message = CandidatesMessage(closest_values, "Candidates"); - throw NotImplementedException("Enum value: unrecognized value \"%s\" for enum \"%s\"\n%s", str_value, enum_name, message); + throw NotImplementedException("Enum value: unrecognized value \"%s\" for enum \"%s\"\n%s", str_value, enum_name, + message); } -const char *StringUtil::EnumToString(const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, uint32_t enum_value) { - for(idx_t i = 0; i < enum_count; i++) { +const char *StringUtil::EnumToString(const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, + uint32_t enum_value) { + for (idx_t i = 0; i < enum_count; i++) { if (enum_list[i].number == enum_value) { return enum_list[i].string; } diff --git a/src/include/duckdb/common/string_util.hpp b/src/include/duckdb/common/string_util.hpp index 232841f33b31..ee4bbc42015e 100644 --- a/src/include/duckdb/common/string_util.hpp +++ b/src/include/duckdb/common/string_util.hpp @@ -302,8 +302,10 @@ class StringUtil { const char *string; }; - DUCKDB_API static uint32_t StringToEnum(const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, const char *str_value); - DUCKDB_API static const char *EnumToString(const EnumStringLiteral enum_list[], idx_t enum_count, const char *enum_name, uint32_t enum_value); + DUCKDB_API static uint32_t StringToEnum(const EnumStringLiteral enum_list[], idx_t enum_count, + const char *enum_name, const char *str_value); + DUCKDB_API static const char *EnumToString(const EnumStringLiteral enum_list[], idx_t enum_count, + const char *enum_name, uint32_t enum_value); }; } // namespace duckdb From d4d6770882f9611722ec3abe0d782f70ca95aacf Mon Sep 17 00:00:00 2001 From: Joseph Hwang Date: Fri, 18 Oct 2024 16:43:51 -0400 Subject: [PATCH 03/19] Fix bool --- src/storage/buffer/buffer_pool.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/storage/buffer/buffer_pool.cpp b/src/storage/buffer/buffer_pool.cpp index 9ed31f6f3262..9ad94b8fdd22 100644 --- a/src/storage/buffer/buffer_pool.cpp +++ b/src/storage/buffer/buffer_pool.cpp @@ -342,7 +342,8 @@ idx_t BufferPool::PurgeAgedBlocksInternal(EvictionQueue &queue, uint32_t max_age bool is_fresh = handle->lru_timestamp_msec >= limit && handle->lru_timestamp_msec <= now; purged_bytes += handle->GetMemoryUsage(); handle->Unload(); - return is_fresh; + // Return false to stop iterating if the current block is_fresh + return !is_fresh; }); return purged_bytes; } From 4496c9cb13574deae900393321852199d2cc74b1 Mon Sep 17 00:00:00 2001 From: Joseph Hwang Date: Tue, 22 Oct 2024 22:01:11 +0900 Subject: [PATCH 04/19] Style --- src/storage/buffer/buffer_pool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/buffer/buffer_pool.cpp b/src/storage/buffer/buffer_pool.cpp index 9ad94b8fdd22..30d6b648bbb8 100644 --- a/src/storage/buffer/buffer_pool.cpp +++ b/src/storage/buffer/buffer_pool.cpp @@ -342,7 +342,7 @@ idx_t BufferPool::PurgeAgedBlocksInternal(EvictionQueue &queue, uint32_t max_age bool is_fresh = handle->lru_timestamp_msec >= limit && handle->lru_timestamp_msec <= now; purged_bytes += handle->GetMemoryUsage(); handle->Unload(); - // Return false to stop iterating if the current block is_fresh + // Return false to stop iterating if the current block is_fresh return !is_fresh; }); return purged_bytes; From 0b6e9deedcf5a8e812a526d9a3b451346b4dae8c Mon Sep 17 00:00:00 2001 From: pdet Date: Mon, 28 Oct 2024 15:23:36 +0100 Subject: [PATCH 05/19] Test fixes for new arrow release --- .../tests/arrow_canonical_extensions.py | 32 ----- .../fast/arrow/test_canonical_extensions.py | 121 ++---------------- .../tests/fast/udf/test_null_filtering.py | 5 - tools/pythonpkg/tests/fast/udf/test_scalar.py | 10 +- 4 files changed, 12 insertions(+), 156 deletions(-) diff --git a/tools/pythonpkg/tests/arrow_canonical_extensions.py b/tools/pythonpkg/tests/arrow_canonical_extensions.py index 8d1d4d4a0157..4f25226a0674 100644 --- a/tools/pythonpkg/tests/arrow_canonical_extensions.py +++ b/tools/pythonpkg/tests/arrow_canonical_extensions.py @@ -3,38 +3,6 @@ pa = pytest.importorskip("pyarrow") -class UuidType(pa.ExtensionType): - def __init__(self): - pa.ExtensionType.__init__(self, pa.binary(16), "arrow.uuid") - - def __arrow_ext_serialize__(self): - # since we don't have a parameterized type, we don't need extra - # metadata to be deserialized - return b'' - - @classmethod - def __arrow_ext_deserialize__(self, storage_type, serialized): - # return an instance of this subclass given the serialized - # metadata. - return UuidType() - - -class JSONType(pa.ExtensionType): - def __init__(self): - pa.ExtensionType.__init__(self, pa.string(), "arrow.json") - - def __arrow_ext_serialize__(self): - # since we don't have a parameterized type, we don't need extra - # metadata to be deserialized - return b'' - - @classmethod - def __arrow_ext_deserialize__(self, storage_type, serialized): - # return an instance of this subclass given the serialized - # metadata. - return JSONType() - - class UHugeIntType(pa.ExtensionType): def __init__(self): pa.ExtensionType.__init__(self, pa.binary(16), "duckdb.uhugeint") diff --git a/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py b/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py index 2857d6d1a516..9fb32b5be0e4 100644 --- a/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py +++ b/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py @@ -7,40 +7,7 @@ pa = pytest.importorskip('pyarrow') -from arrow_canonical_extensions import UuidType, JSONType, UHugeIntType, HugeIntType, VarIntType - - -class UuidTypeWrong(pa.ExtensionType): - def __init__(self): - pa.ExtensionType.__init__(self, pa.binary(4), "arrow.uuid") - - def __arrow_ext_serialize__(self): - # since we don't have a parameterized type, we don't need extra - # metadata to be deserialized - return b'' - - @classmethod - def __arrow_ext_deserialize__(cls, storage_type, serialized): - # return an instance of this subclass given the serialized - # metadata. - return UuidTypeWrong() - - -class JSONTypeWrong(pa.ExtensionType): - def __init__(self): - pa.ExtensionType.__init__(self, pa.int32(), "arrow.json") - - def __arrow_ext_serialize__(self): - # since we don't have a parameterized type, we don't need extra - # metadata to be deserialized - return b'' - - @classmethod - def __arrow_ext_deserialize__(cls, storage_type, serialized): - # return an instance of this subclass given the serialized - # metadata. - return JSONTypeWrong() - +from arrow_canonical_extensions import UHugeIntType, HugeIntType, VarIntType """ These fixtures make sure that the extension_type is registered at the start of the function, @@ -64,27 +31,6 @@ def arrow_duckdb_uhugeint(): pa.unregister_extension_type("duckdb.uhugeint") -@pytest.fixture(scope='function') -def arrow_json(): - pa.register_extension_type(JSONType()) - yield - pa.unregister_extension_type("arrow.json") - - -@pytest.fixture(scope='function') -def arrow_json_wrong(): - pa.register_extension_type(JSONTypeWrong()) - yield - pa.unregister_extension_type("arrow.json") - - -@pytest.fixture(scope='function') -def arrow_uuid(): - pa.register_extension_type(UuidType()) - yield - pa.unregister_extension_type("arrow.uuid") - - @pytest.fixture(scope='function') def arrow_duckdb_varint(): pa.register_extension_type(VarIntType()) @@ -92,22 +38,14 @@ def arrow_duckdb_varint(): pa.unregister_extension_type("duckdb.varint") -@pytest.fixture(scope='function') -def arrow_uuid_wrong(): - pa.register_extension_type(UuidTypeWrong()) - yield - pa.unregister_extension_type("arrow.uuid") - - class TestCanonicalExtensionTypes(object): - def test_uuid(self, arrow_uuid): + def test_uuid(self): duckdb_cursor = duckdb.connect() duckdb_cursor.execute("SET arrow_lossless_conversion = true") storage_array = pa.array([uuid.uuid4().bytes for _ in range(4)], pa.binary(16)) - uuid_type = UuidType() - storage_array = uuid_type.wrap_array(storage_array) + storage_array = pa.uuid().wrap_array(storage_array) arrow_table = pa.Table.from_arrays([storage_array], names=['uuid_col']) @@ -115,15 +53,15 @@ def test_uuid(self, arrow_uuid): assert duck_arrow.equals(arrow_table) - def test_uuid_from_duck(self, arrow_uuid): + def test_uuid_from_duck(self): duckdb_cursor = duckdb.connect() duckdb_cursor.execute("SET arrow_lossless_conversion = true") arrow_table = duckdb_cursor.execute("select uuid from test_all_types()").fetch_arrow_table() assert arrow_table.to_pylist() == [ - {'uuid': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}, - {'uuid': b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'}, + {'uuid': UUID('00000000-0000-0000-0000-000000000000')}, + {'uuid': UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')}, {'uuid': None}, ] @@ -137,33 +75,16 @@ def test_uuid_from_duck(self, arrow_uuid): "select '00000000-0000-0000-0000-000000000100'::UUID as uuid" ).fetch_arrow_table() - assert arrow_table.to_pylist() == [ - {'uuid': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00'} - ] + assert arrow_table.to_pylist() == [{'uuid': UUID('00000000-0000-0000-0000-000000000100')}] assert duckdb_cursor.execute("FROM arrow_table").fetchall() == [(UUID('00000000-0000-0000-0000-000000000100'),)] - def test_uuid_exception(self, arrow_uuid_wrong): - duckdb_cursor = duckdb.connect() - duckdb_cursor.execute("SET arrow_lossless_conversion = true") - - storage_array = pa.array(['aaaa'], pa.binary(4)) - uuid_type = UuidTypeWrong() - storage_array = uuid_type.wrap_array(storage_array) - - arrow_table = pa.Table.from_arrays([storage_array], names=['uuid_col']) - - with pytest.raises(duckdb.InvalidInputException, match="arrow.uuid must be a fixed-size binary of 16 bytes"): - duck_arrow = duckdb_cursor.execute('FROM arrow_table').arrow() - - def test_json(self, duckdb_cursor, arrow_json): + def test_json(self, duckdb_cursor): data = {"name": "Pedro", "age": 28, "car": "VW Fox"} # Convert dictionary to JSON string json_string = json.dumps(data) storage_array = pa.array([json_string], pa.string()) - json_type = JSONType() - storage_array = json_type.wrap_array(storage_array) arrow_table = pa.Table.from_arrays([storage_array], names=['json_col']) @@ -172,16 +93,6 @@ def test_json(self, duckdb_cursor, arrow_json): assert duck_arrow.equals(arrow_table) - def test_json_throw(self, duckdb_cursor, arrow_json_wrong): - storage_array = pa.array([32], pa.int32()) - json_type = JSONTypeWrong() - storage_array = json_type.wrap_array(storage_array) - - arrow_table = pa.Table.from_arrays([storage_array], names=['json_col']) - - with pytest.raises(duckdb.InvalidInputException, match="arrow.json must be of a varchar format "): - duck_arrow = duckdb_cursor.execute('FROM arrow_table').arrow() - def test_uuid_no_def(self): duckdb_cursor = duckdb.connect() duckdb_cursor.execute("SET arrow_lossless_conversion = true") @@ -222,7 +133,7 @@ def test_uuid_no_def_stream(self): (None,), ] - def test_uuid_udf_registered(self, arrow_uuid): + def test_uuid_udf_registered(self): def test_function(x): print(x.type.__class__) return x @@ -233,20 +144,6 @@ def test_function(x): rel = con.sql("select ? as x", params=[uuid.UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')]) rel.project("test(x) from t").fetchall() - def test_uuid_udf_unregistered(self): - con = duckdb.connect() - con.execute("SET arrow_lossless_conversion = true") - - def test_function(x): - print(x.type.__class__) - return x - - con.create_function('test', test_function, ['UUID'], 'UUID', type='arrow') - - rel = con.sql("select ? as x", params=[uuid.UUID('ffffffff-ffff-ffff-ffff-ffffffffffff')]) - with pytest.raises(duckdb.Error, match="It seems that you are using the UUID arrow canonical extension"): - rel.project("test(x) from t").fetchall() - def test_unimplemented_extension(self, duckdb_cursor): class MyType(pa.ExtensionType): def __init__(self): diff --git a/tools/pythonpkg/tests/fast/udf/test_null_filtering.py b/tools/pythonpkg/tests/fast/udf/test_null_filtering.py index 9bee4bad4186..f7bdb828fd79 100644 --- a/tools/pythonpkg/tests/fast/udf/test_null_filtering.py +++ b/tools/pythonpkg/tests/fast/udf/test_null_filtering.py @@ -12,7 +12,6 @@ from typing import NamedTuple, Any, List from duckdb.typing import * -from arrow_canonical_extensions import UuidType class Candidate(NamedTuple): @@ -164,8 +163,6 @@ class TestUDFNullFiltering(object): ) @pytest.mark.parametrize('udf_type', ['arrow', 'native']) def test_null_filtering(self, duckdb_cursor, table_data: dict, test_type: Candidate, udf_type): - if test_type.type == UUID: - pa.register_extension_type(UuidType()) null_count = sum([1 for x in list(zip(*table_data.values())) if any([y == None for y in x])]) row_count = len(table_data) table_data = { @@ -202,8 +199,6 @@ def create_parameters(table_data, dbtype): assert len(result) == row_count # Only the non-null tuples should have been seen by the UDF assert my_func.count == row_count - null_count - if test_type.type == UUID: - pa.unregister_extension_type("arrow.uuid") @pytest.mark.parametrize( 'table_data', diff --git a/tools/pythonpkg/tests/fast/udf/test_scalar.py b/tools/pythonpkg/tests/fast/udf/test_scalar.py index fce4b9862f08..3297c24b14eb 100644 --- a/tools/pythonpkg/tests/fast/udf/test_scalar.py +++ b/tools/pythonpkg/tests/fast/udf/test_scalar.py @@ -13,7 +13,7 @@ from duckdb.typing import * -from arrow_canonical_extensions import UuidType, HugeIntType +from arrow_canonical_extensions import HugeIntType def make_annotated_function(type): @@ -70,9 +70,7 @@ def test_type_coverage(self, test_type, function_type): con = duckdb.connect() con.create_function('test', test_function, type=function_type) - if type == UUID: - pa.register_extension_type(UuidType()) - elif type == HUGEINT: + if type == HUGEINT: pa.register_extension_type(HugeIntType()) # Single value res = con.execute(f"select test(?::{str(type)})", [value]).fetchall() @@ -123,9 +121,7 @@ def test_type_coverage(self, test_type, function_type): table_rel = con.table('tbl') res = table_rel.project('test(x)').fetchall() assert res[0][0] == value - if type == UUID: - pa.unregister_extension_type("arrow.uuid") - elif type == HUGEINT: + if type == HUGEINT: pa.unregister_extension_type("duckdb.hugeint") @pytest.mark.parametrize('udf_type', ['arrow', 'native']) From 297aac89b62201dbb54e78bfaa3447cdc73150db Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Mon, 28 Oct 2024 15:24:32 +0100 Subject: [PATCH 06/19] Enable serialization of LogicalExport --- .../operator/persistent/physical_export.cpp | 14 ++++-- src/execution/physical_plan/plan_export.cpp | 2 +- .../operator/persistent/physical_export.hpp | 7 +-- .../parsed_data/exported_table_data.hpp | 20 ++++++-- .../planner/operator/logical_export.hpp | 23 ++++----- .../serialization/logical_operator.json | 20 ++++++++ .../duckdb/storage/serialization/nodes.json | 49 +++++++++++++++++++ .../storage/serialization/parse_info.json | 15 ++++++ src/parser/parsed_data/CMakeLists.txt | 1 + .../parsed_data/exported_table_data.cpp | 22 +++++++++ src/planner/binder/statement/bind_export.cpp | 7 +-- src/planner/operator/CMakeLists.txt | 1 + src/planner/operator/logical_export.cpp | 28 +++++++++++ src/planner/planner.cpp | 42 ++++++---------- .../serialize_logical_operator.cpp | 16 ++++++ src/storage/serialization/serialize_nodes.cpp | 30 ++++++++++++ .../serialization/serialize_parse_info.cpp | 15 ++++++ test/sql/export/empty_export.test | 3 ++ test/sql/export/export_database.test | 6 +++ test/sql/export/export_external_access.test | 3 ++ test/sql/export/export_functions.test | 3 ++ test/sql/export/export_generated_columns.test | 3 ++ test/sql/export/export_macros.test | 3 ++ test/sql/export/export_quoted_enum.test | 3 ++ test/sql/export/export_quoted_structs.test | 3 ++ test/sql/export/export_quoted_union.test | 3 ++ 26 files changed, 285 insertions(+), 57 deletions(-) create mode 100644 src/parser/parsed_data/exported_table_data.cpp create mode 100644 src/planner/operator/logical_export.cpp diff --git a/src/execution/operator/persistent/physical_export.cpp b/src/execution/operator/persistent/physical_export.cpp index ccb9cd312615..2e0f4bbf4fb4 100644 --- a/src/execution/operator/persistent/physical_export.cpp +++ b/src/execution/operator/persistent/physical_export.cpp @@ -19,6 +19,12 @@ using std::stringstream; void ReorderTableEntries(catalog_entry_vector_t &tables); +PhysicalExport::PhysicalExport(vector types, CopyFunction function, unique_ptr info, + idx_t estimated_cardinality, unique_ptr exported_tables) + : PhysicalOperator(PhysicalOperatorType::EXPORT, std::move(types), estimated_cardinality), + function(std::move(function)), info(std::move(info)), exported_tables(std::move(exported_tables)) { +} + static void WriteCatalogEntries(stringstream &ss, catalog_entry_vector_t &entries) { for (auto &entry : entries) { if (entry.get().internal) { @@ -225,8 +231,8 @@ SourceResultType PhysicalExport::GetData(ExecutionContext &context, DataChunk &c // consider the order of tables because of foreign key constraint entries.tables.clear(); - for (idx_t i = 0; i < exported_tables.data.size(); i++) { - entries.tables.push_back(exported_tables.data[i].entry); + for (idx_t i = 0; i < exported_tables->data.size(); i++) { + entries.tables.push_back(exported_tables->data[i].entry); } // order macro's by timestamp so nested macro's are imported nicely @@ -252,8 +258,8 @@ SourceResultType PhysicalExport::GetData(ExecutionContext &context, DataChunk &c // write the load.sql file // for every table, we write COPY INTO statement with the specified options stringstream load_ss; - for (idx_t i = 0; i < exported_tables.data.size(); i++) { - auto exported_table_info = exported_tables.data[i].table_data; + for (idx_t i = 0; i < exported_tables->data.size(); i++) { + auto exported_table_info = exported_tables->data[i].table_data; WriteCopyStatement(fs, load_ss, *info, exported_table_info, function); } WriteStringStreamToFile(fs, load_ss, fs.JoinPath(info->file_path, "load.sql")); diff --git a/src/execution/physical_plan/plan_export.cpp b/src/execution/physical_plan/plan_export.cpp index 3179ec6f63ca..0f4237d9c06f 100644 --- a/src/execution/physical_plan/plan_export.cpp +++ b/src/execution/physical_plan/plan_export.cpp @@ -11,7 +11,7 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalExport &op throw PermissionException("Export is disabled through configuration"); } auto export_node = make_uniq(op.types, op.function, std::move(op.copy_info), - op.estimated_cardinality, op.exported_tables); + op.estimated_cardinality, std::move(op.exported_tables)); // plan the underlying copy statements, if any if (!op.children.empty()) { auto plan = CreatePlan(*op.children[0]); diff --git a/src/include/duckdb/execution/operator/persistent/physical_export.hpp b/src/include/duckdb/execution/operator/persistent/physical_export.hpp index 4032aea65c3d..fd7f4981fc6f 100644 --- a/src/include/duckdb/execution/operator/persistent/physical_export.hpp +++ b/src/include/duckdb/execution/operator/persistent/physical_export.hpp @@ -34,17 +34,14 @@ class PhysicalExport : public PhysicalOperator { public: PhysicalExport(vector types, CopyFunction function, unique_ptr info, - idx_t estimated_cardinality, BoundExportData exported_tables) - : PhysicalOperator(PhysicalOperatorType::EXPORT, std::move(types), estimated_cardinality), - function(std::move(function)), info(std::move(info)), exported_tables(std::move(exported_tables)) { - } + idx_t estimated_cardinality, unique_ptr exported_tables); //! The copy function to use to read the file CopyFunction function; //! The binding info containing the set of options for reading the file unique_ptr info; //! The table info for each table that will be exported - BoundExportData exported_tables; + unique_ptr exported_tables; public: // Source interface diff --git a/src/include/duckdb/parser/parsed_data/exported_table_data.hpp b/src/include/duckdb/parser/parsed_data/exported_table_data.hpp index b3f26a9be6db..192def09f14e 100644 --- a/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +++ b/src/include/duckdb/parser/parsed_data/exported_table_data.hpp @@ -1,7 +1,7 @@ //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/parser/parsed_data/export_table_data.hpp +// duckdb/parser/parsed_data/exported_table_data.hpp // // //===----------------------------------------------------------------------===// @@ -28,16 +28,23 @@ struct ExportedTableData { string file_path; //! Not Null columns, if any vector not_null_columns; + + void Serialize(Serializer &serializer) const; + static ExportedTableData Deserialize(Deserializer &deserializer); }; struct ExportedTableInfo { - ExportedTableInfo(TableCatalogEntry &entry, ExportedTableData table_data_p, vector ¬_null_columns_p) - : entry(entry), table_data(std::move(table_data_p)) { - table_data.not_null_columns = not_null_columns_p; - } + ExportedTableInfo(TableCatalogEntry &entry, ExportedTableData table_data_p, vector ¬_null_columns_p); + ExportedTableInfo(ClientContext &context, ExportedTableData table_data); TableCatalogEntry &entry; ExportedTableData table_data; + + void Serialize(Serializer &serializer) const; + static ExportedTableInfo Deserialize(Deserializer &deserializer); + +private: + static TableCatalogEntry &GetEntry(ClientContext &context, const ExportedTableData &table_data); }; struct BoundExportData : public ParseInfo { @@ -49,6 +56,9 @@ struct BoundExportData : public ParseInfo { } vector data; + + void Serialize(Serializer &serializer) const override; + static unique_ptr Deserialize(Deserializer &deserializer); }; } // namespace duckdb diff --git a/src/include/duckdb/planner/operator/logical_export.hpp b/src/include/duckdb/planner/operator/logical_export.hpp index 28a3686f3787..2115f09f87e9 100644 --- a/src/include/duckdb/planner/operator/logical_export.hpp +++ b/src/include/duckdb/planner/operator/logical_export.hpp @@ -20,26 +20,23 @@ class LogicalExport : public LogicalOperator { static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_EXPORT; public: - LogicalExport(CopyFunction function, unique_ptr copy_info, BoundExportData exported_tables) - : LogicalOperator(LogicalOperatorType::LOGICAL_EXPORT), function(std::move(function)), - copy_info(std::move(copy_info)), exported_tables(std::move(exported_tables)) { - } - CopyFunction function; + LogicalExport(CopyFunction function, unique_ptr copy_info, unique_ptr exported_tables); + unique_ptr copy_info; - BoundExportData exported_tables; + CopyFunction function; + unique_ptr exported_tables; - void Serialize(Serializer &serializer) const override { - throw NotImplementedException("FIXME: Serialize LogicalExport statement"); - } - unique_ptr Deserialize(Deserializer &deserializer) { - throw NotImplementedException("FIXME: Deserialize LogicalExport statement"); - } + void Serialize(Serializer &serializer) const override; + static unique_ptr Deserialize(Deserializer &deserializer); -public: protected: + LogicalExport(ClientContext &context, unique_ptr copy_info, unique_ptr exported_tables); + void ResolveTypes() override { types.emplace_back(LogicalType::BOOLEAN); } + + CopyFunction GetCopyFunction(ClientContext &context, CopyInfo &info); }; } // namespace duckdb diff --git a/src/include/duckdb/storage/serialization/logical_operator.json b/src/include/duckdb/storage/serialization/logical_operator.json index 28eefe9261fa..1123cbea5828 100644 --- a/src/include/duckdb/storage/serialization/logical_operator.json +++ b/src/include/duckdb/storage/serialization/logical_operator.json @@ -890,6 +890,26 @@ "enum": "LOGICAL_VACUUM", "custom_implementation": true }, + { + "class": "LogicalExport", + "base": "LogicalOperator", + "enum": "LOGICAL_EXPORT", + "members": [ + { + "id": 200, + "name": "copy_info", + "type": "CopyInfo*", + "base": "ParseInfo" + }, + { + "id": 201, + "name": "exported_tables", + "type": "BoundExportData*", + "base": "ParseInfo" + } + ], + "constructor": ["$ClientContext", "copy_info", "exported_tables"] + }, { "class": "FilenamePattern", "pointer_type": "none", diff --git a/src/include/duckdb/storage/serialization/nodes.json b/src/include/duckdb/storage/serialization/nodes.json index c29cb8cb628a..e241ad3bef51 100644 --- a/src/include/duckdb/storage/serialization/nodes.json +++ b/src/include/duckdb/storage/serialization/nodes.json @@ -918,5 +918,54 @@ } ], "pointer_type": "none" + }, + { + "class": "ExportedTableInfo", + "includes": [ + "duckdb/parser/parsed_data/exported_table_data.hpp" + ], + "members": [ + { + "id": 1, + "name": "table_data", + "type": "ExportedTableData" + } + ], + "constructor": ["$ClientContext", "table_data"], + "pointer_type": "none" + }, + { + "class": "ExportedTableData", + "includes": [ + "duckdb/parser/parsed_data/exported_table_data.hpp" + ], + "members": [ + { + "id": 1, + "name": "table_name", + "type": "string" + }, + { + "id": 2, + "name": "schema_name", + "type": "string" + }, + { + "id": 3, + "name": "database_name", + "type": "string" + }, + { + "id": 4, + "name": "file_path", + "type": "string" + }, + { + "id": 5, + "name": "not_null_columns", + "type": "vector" + } + ], + "pointer_type": "none" } ] diff --git a/src/include/duckdb/storage/serialization/parse_info.json b/src/include/duckdb/storage/serialization/parse_info.json index 5721e19d87e0..d86306916785 100644 --- a/src/include/duckdb/storage/serialization/parse_info.json +++ b/src/include/duckdb/storage/serialization/parse_info.json @@ -630,5 +630,20 @@ } ], "constructor": ["options"] + }, + { + "class": "BoundExportData", + "base": "ParseInfo", + "enum": "BOUND_EXPORT_DATA", + "includes": [ + "duckdb/parser/parsed_data/exported_table_data.hpp" + ], + "members": [ + { + "id": 200, + "name": "data", + "type": "vector" + } + ] } ] diff --git a/src/parser/parsed_data/CMakeLists.txt b/src/parser/parsed_data/CMakeLists.txt index 45419115b908..59d17d185f8e 100644 --- a/src/parser/parsed_data/CMakeLists.txt +++ b/src/parser/parsed_data/CMakeLists.txt @@ -25,6 +25,7 @@ add_library_unity( create_view_info.cpp detach_info.cpp drop_info.cpp + exported_table_data.cpp extra_drop_info.cpp load_info.cpp sample_options.cpp diff --git a/src/parser/parsed_data/exported_table_data.cpp b/src/parser/parsed_data/exported_table_data.cpp new file mode 100644 index 000000000000..d3573bc0a563 --- /dev/null +++ b/src/parser/parsed_data/exported_table_data.cpp @@ -0,0 +1,22 @@ +#include "duckdb/parser/parsed_data/exported_table_data.hpp" +#include "duckdb/catalog/catalog.hpp" + +namespace duckdb { + +ExportedTableInfo::ExportedTableInfo(TableCatalogEntry &entry, ExportedTableData table_data_p, + vector ¬_null_columns_p) + : entry(entry), table_data(std::move(table_data_p)) { + table_data.not_null_columns = not_null_columns_p; +} + +ExportedTableInfo::ExportedTableInfo(ClientContext &context, ExportedTableData table_data_p) + : entry(GetEntry(context, table_data_p)), table_data(std::move(table_data_p)) { +} + +TableCatalogEntry &ExportedTableInfo::GetEntry(ClientContext &context, const ExportedTableData &table_data) { + return Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, table_data.database_name, table_data.schema_name, + table_data.table_name) + .Cast(); +} + +} // namespace duckdb diff --git a/src/planner/binder/statement/bind_export.cpp b/src/planner/binder/statement/bind_export.cpp index a183738ade7b..924df011f559 100644 --- a/src/planner/binder/statement/bind_export.cpp +++ b/src/planner/binder/statement/bind_export.cpp @@ -192,7 +192,7 @@ BoundStatement Binder::Bind(ExportStatement &stmt) { // now generate the COPY statements for each of the tables auto &fs = FileSystem::GetFileSystem(context); - BoundExportData exported_tables; + auto exported_tables = make_uniq(); unordered_set table_name_index; vector> export_nodes; @@ -245,7 +245,7 @@ BoundStatement Binder::Bind(ExportStatement &stmt) { exported_data.file_path = info->file_path; ExportedTableInfo table_info(table, std::move(exported_data), not_null_columns); - exported_tables.data.push_back(table_info); + exported_tables->data.push_back(table_info); id++; // generate the copy statement and bind it @@ -270,7 +270,8 @@ BoundStatement Binder::Bind(ExportStatement &stmt) { stmt.info->catalog = catalog; // create the export node - auto export_node = make_uniq(copy_function.function, std::move(stmt.info), exported_tables); + auto export_node = + make_uniq(copy_function.function, std::move(stmt.info), std::move(exported_tables)); if (child_operator) { export_node->children.push_back(std::move(child_operator)); diff --git a/src/planner/operator/CMakeLists.txt b/src/planner/operator/CMakeLists.txt index dacd4a44a1ea..bf633734c314 100644 --- a/src/planner/operator/CMakeLists.txt +++ b/src/planner/operator/CMakeLists.txt @@ -18,6 +18,7 @@ add_library_unity( logical_distinct.cpp logical_dummy_scan.cpp logical_empty_result.cpp + logical_export.cpp logical_expression_get.cpp logical_extension_operator.cpp logical_filter.cpp diff --git a/src/planner/operator/logical_export.cpp b/src/planner/operator/logical_export.cpp new file mode 100644 index 000000000000..046aff3e0f80 --- /dev/null +++ b/src/planner/operator/logical_export.cpp @@ -0,0 +1,28 @@ +#include "duckdb/planner/operator/logical_export.hpp" +#include "duckdb/common/serializer/serializer.hpp" +#include "duckdb/catalog/catalog.hpp" +#include "duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp" + +namespace duckdb { + +LogicalExport::LogicalExport(CopyFunction function, unique_ptr copy_info, + unique_ptr exported_tables) + : LogicalOperator(LogicalOperatorType::LOGICAL_EXPORT), copy_info(std::move(copy_info)), + function(std::move(function)), exported_tables(std::move(exported_tables)) { +} + +LogicalExport::LogicalExport(ClientContext &context, unique_ptr copy_info_p, + unique_ptr exported_tables_p) + : LogicalOperator(LogicalOperatorType::LOGICAL_EXPORT), + copy_info(unique_ptr_cast(std::move(copy_info_p))), + function(GetCopyFunction(context, *copy_info)), + exported_tables(unique_ptr_cast(std::move(exported_tables_p))) { +} + +CopyFunction LogicalExport::GetCopyFunction(ClientContext &context, CopyInfo &info) { + auto ©_entry = + Catalog::GetEntry(context, INVALID_CATALOG, DEFAULT_SCHEMA, info.format); + return copy_entry.function; +} + +} // namespace duckdb diff --git a/src/planner/planner.cpp b/src/planner/planner.cpp index 99a5934ae2c8..66e6eba50246 100644 --- a/src/planner/planner.cpp +++ b/src/planner/planner.cpp @@ -183,35 +183,25 @@ void Planner::VerifyPlan(ClientContext &context, unique_ptr &op ColumnBindingResolver::Verify(*op); // format (de)serialization of this operator - try { - MemoryStream stream; - - SerializationOptions options; - if (config.options.serialization_compatibility.manually_set) { - // Override the default of 'latest' if this was manually set (for testing, mostly) - options.serialization_compatibility = config.options.serialization_compatibility; - } else { - options.serialization_compatibility = SerializationCompatibility::Latest(); - } + MemoryStream stream; + + SerializationOptions options; + if (config.options.serialization_compatibility.manually_set) { + // Override the default of 'latest' if this was manually set (for testing, mostly) + options.serialization_compatibility = config.options.serialization_compatibility; + } else { + options.serialization_compatibility = SerializationCompatibility::Latest(); + } - BinarySerializer::Serialize(*op, stream, options); - stream.Rewind(); - bound_parameter_map_t parameters; - auto new_plan = BinaryDeserializer::Deserialize(stream, context, parameters); + BinarySerializer::Serialize(*op, stream, options); + stream.Rewind(); + bound_parameter_map_t parameters; + auto new_plan = BinaryDeserializer::Deserialize(stream, context, parameters); - if (map) { - *map = std::move(parameters); - } - op = std::move(new_plan); - } catch (std::exception &ex) { - ErrorData error(ex); - switch (error.Type()) { - case ExceptionType::NOT_IMPLEMENTED: // NOLINT: explicitly allowing these errors (for now) - break; // pass - default: - throw; - } + if (map) { + *map = std::move(parameters); } + op = std::move(new_plan); } } // namespace duckdb diff --git a/src/storage/serialization/serialize_logical_operator.cpp b/src/storage/serialization/serialize_logical_operator.cpp index 5bec48199803..d8a4d83b5bef 100644 --- a/src/storage/serialization/serialize_logical_operator.cpp +++ b/src/storage/serialization/serialize_logical_operator.cpp @@ -106,6 +106,9 @@ unique_ptr LogicalOperator::Deserialize(Deserializer &deseriali case LogicalOperatorType::LOGICAL_EXPLAIN: result = LogicalExplain::Deserialize(deserializer); break; + case LogicalOperatorType::LOGICAL_EXPORT: + result = LogicalExport::Deserialize(deserializer); + break; case LogicalOperatorType::LOGICAL_EXPRESSION_GET: result = LogicalExpressionGet::Deserialize(deserializer); break; @@ -442,6 +445,19 @@ unique_ptr LogicalExplain::Deserialize(Deserializer &deserializ return std::move(result); } +void LogicalExport::Serialize(Serializer &serializer) const { + LogicalOperator::Serialize(serializer); + serializer.WritePropertyWithDefault>(200, "copy_info", copy_info); + serializer.WritePropertyWithDefault>(201, "exported_tables", exported_tables); +} + +unique_ptr LogicalExport::Deserialize(Deserializer &deserializer) { + auto copy_info = deserializer.ReadPropertyWithDefault>(200, "copy_info"); + auto exported_tables = deserializer.ReadPropertyWithDefault>(201, "exported_tables"); + auto result = duckdb::unique_ptr(new LogicalExport(deserializer.Get(), std::move(copy_info), std::move(exported_tables))); + return std::move(result); +} + void LogicalExpressionGet::Serialize(Serializer &serializer) const { LogicalOperator::Serialize(serializer); serializer.WritePropertyWithDefault(200, "table_index", table_index); diff --git a/src/storage/serialization/serialize_nodes.cpp b/src/storage/serialization/serialize_nodes.cpp index 872e3a5b8858..0b077ec7c231 100644 --- a/src/storage/serialization/serialize_nodes.cpp +++ b/src/storage/serialization/serialize_nodes.cpp @@ -32,6 +32,8 @@ #include "duckdb/function/scalar/strftime_format.hpp" #include "duckdb/function/table/read_csv.hpp" #include "duckdb/common/types/interval.hpp" +#include "duckdb/parser/parsed_data/exported_table_data.hpp" +#include "duckdb/parser/parsed_data/exported_table_data.hpp" namespace duckdb { @@ -343,6 +345,34 @@ CommonTableExpressionMap CommonTableExpressionMap::Deserialize(Deserializer &des return result; } +void ExportedTableData::Serialize(Serializer &serializer) const { + serializer.WritePropertyWithDefault(1, "table_name", table_name); + serializer.WritePropertyWithDefault(2, "schema_name", schema_name); + serializer.WritePropertyWithDefault(3, "database_name", database_name); + serializer.WritePropertyWithDefault(4, "file_path", file_path); + serializer.WritePropertyWithDefault>(5, "not_null_columns", not_null_columns); +} + +ExportedTableData ExportedTableData::Deserialize(Deserializer &deserializer) { + ExportedTableData result; + deserializer.ReadPropertyWithDefault(1, "table_name", result.table_name); + deserializer.ReadPropertyWithDefault(2, "schema_name", result.schema_name); + deserializer.ReadPropertyWithDefault(3, "database_name", result.database_name); + deserializer.ReadPropertyWithDefault(4, "file_path", result.file_path); + deserializer.ReadPropertyWithDefault>(5, "not_null_columns", result.not_null_columns); + return result; +} + +void ExportedTableInfo::Serialize(Serializer &serializer) const { + serializer.WriteProperty(1, "table_data", table_data); +} + +ExportedTableInfo ExportedTableInfo::Deserialize(Deserializer &deserializer) { + auto table_data = deserializer.ReadProperty(1, "table_data"); + ExportedTableInfo result(deserializer.Get(), table_data); + return result; +} + void HivePartitioningIndex::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault(100, "value", value); serializer.WritePropertyWithDefault(101, "index", index); diff --git a/src/storage/serialization/serialize_parse_info.cpp b/src/storage/serialization/serialize_parse_info.cpp index 590c0954ea77..e68acf36bcdd 100644 --- a/src/storage/serialization/serialize_parse_info.cpp +++ b/src/storage/serialization/serialize_parse_info.cpp @@ -19,6 +19,7 @@ #include "duckdb/parser/parsed_data/pragma_info.hpp" #include "duckdb/parser/parsed_data/transaction_info.hpp" #include "duckdb/parser/parsed_data/vacuum_info.hpp" +#include "duckdb/parser/parsed_data/exported_table_data.hpp" namespace duckdb { @@ -36,6 +37,9 @@ unique_ptr ParseInfo::Deserialize(Deserializer &deserializer) { case ParseInfoType::ATTACH_INFO: result = AttachInfo::Deserialize(deserializer); break; + case ParseInfoType::BOUND_EXPORT_DATA: + result = BoundExportData::Deserialize(deserializer); + break; case ParseInfoType::COPY_DATABASE_INFO: result = CopyDatabaseInfo::Deserialize(deserializer); break; @@ -225,6 +229,17 @@ unique_ptr AttachInfo::Deserialize(Deserializer &deserializer) { return std::move(result); } +void BoundExportData::Serialize(Serializer &serializer) const { + ParseInfo::Serialize(serializer); + serializer.WritePropertyWithDefault>(200, "data", data); +} + +unique_ptr BoundExportData::Deserialize(Deserializer &deserializer) { + auto result = duckdb::unique_ptr(new BoundExportData()); + deserializer.ReadPropertyWithDefault>(200, "data", result->data); + return std::move(result); +} + void ChangeColumnTypeInfo::Serialize(Serializer &serializer) const { AlterTableInfo::Serialize(serializer); serializer.WritePropertyWithDefault(400, "column_name", column_name); diff --git a/test/sql/export/empty_export.test b/test/sql/export/empty_export.test index 0e281e1a83c0..dce988942ca7 100644 --- a/test/sql/export/empty_export.test +++ b/test/sql/export/empty_export.test @@ -2,5 +2,8 @@ # description: Export an empty database # group: [export] +statement ok +PRAGMA enable_verification + statement ok EXPORT DATABASE '__TEST_DIR__/empty_export' (FORMAT CSV) diff --git a/test/sql/export/export_database.test b/test/sql/export/export_database.test index 3d584c63f99e..3f79e53aff4b 100644 --- a/test/sql/export/export_database.test +++ b/test/sql/export/export_database.test @@ -175,10 +175,16 @@ SELECT * FROM s2.table01 ORDER BY i; 5 5 6 6 +statement ok +PRAGMA verify_serializer + # now export the db statement ok EXPORT DATABASE '__TEST_DIR__/export_test' (FORMAT CSV) +statement ok +PRAGMA disable_verification + statement ok ROLLBACK diff --git a/test/sql/export/export_external_access.test b/test/sql/export/export_external_access.test index 468a6c2ea32c..abfec8409f1b 100644 --- a/test/sql/export/export_external_access.test +++ b/test/sql/export/export_external_access.test @@ -2,6 +2,9 @@ # description: Test export database # group: [export] +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION diff --git a/test/sql/export/export_functions.test b/test/sql/export/export_functions.test index c5a6391527d7..61ae2a733510 100644 --- a/test/sql/export/export_functions.test +++ b/test/sql/export/export_functions.test @@ -2,6 +2,9 @@ # description: Test export functions # group: [export] +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION diff --git a/test/sql/export/export_generated_columns.test b/test/sql/export/export_generated_columns.test index 5509d49eb915..b385456cd5c3 100644 --- a/test/sql/export/export_generated_columns.test +++ b/test/sql/export/export_generated_columns.test @@ -2,6 +2,9 @@ # description: Test export of generated columns # group: [export] +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION diff --git a/test/sql/export/export_macros.test b/test/sql/export/export_macros.test index 592499c08488..0cf4ae8231a2 100644 --- a/test/sql/export/export_macros.test +++ b/test/sql/export/export_macros.test @@ -2,6 +2,9 @@ # description: Test export of macro's # group: [export] +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION diff --git a/test/sql/export/export_quoted_enum.test b/test/sql/export/export_quoted_enum.test index 0973985c8b0f..d80b4c61c30b 100644 --- a/test/sql/export/export_quoted_enum.test +++ b/test/sql/export/export_quoted_enum.test @@ -2,6 +2,9 @@ # description: Test export of enum with reserved keyword name # group: [export] +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION diff --git a/test/sql/export/export_quoted_structs.test b/test/sql/export/export_quoted_structs.test index db8053f94abb..319459a94d7c 100644 --- a/test/sql/export/export_quoted_structs.test +++ b/test/sql/export/export_quoted_structs.test @@ -4,6 +4,9 @@ # create a bunch of tables with data and views +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION diff --git a/test/sql/export/export_quoted_union.test b/test/sql/export/export_quoted_union.test index f34e0f3b545b..f5c0008b0e0e 100644 --- a/test/sql/export/export_quoted_union.test +++ b/test/sql/export/export_quoted_union.test @@ -2,6 +2,9 @@ # description: Test export database # group: [export] +statement ok +PRAGMA enable_verification + statement ok BEGIN TRANSACTION From 6b00cdfbc789a6cf442f83bdb21ab58c761f791d Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Mon, 28 Oct 2024 16:29:52 +0100 Subject: [PATCH 07/19] Add AggregateDestructorType which signifies whether or not an aggregate state can be trivially destructible - only AggregateDestructorType::LEGACY can be trivially destructible --- .../aggregate/distributive/arg_min_max.cpp | 25 +++++++------ .../core_functions/aggregate/holistic/mad.cpp | 3 +- .../aggregate/holistic/mode.cpp | 12 ++++-- .../aggregate/holistic/quantile.cpp | 31 +++++++++------- .../aggregate/distributive/minmax.cpp | 2 +- .../aggregate/sorted_aggregate_function.cpp | 3 +- .../duckdb/function/aggregate_function.hpp | 37 +++++++++++++------ 7 files changed, 71 insertions(+), 42 deletions(-) diff --git a/extension/core_functions/aggregate/distributive/arg_min_max.cpp b/extension/core_functions/aggregate/distributive/arg_min_max.cpp index 35b9a77474c2..63c112b3ce3c 100644 --- a/extension/core_functions/aggregate/distributive/arg_min_max.cpp +++ b/extension/core_functions/aggregate/distributive/arg_min_max.cpp @@ -314,21 +314,22 @@ struct VectorArgMinMaxBase : ArgMinMaxBase { template AggregateFunction GetGenericArgMinMaxFunction() { using STATE = ArgMinMaxState; - return AggregateFunction({LogicalType::ANY, LogicalType::ANY}, LogicalType::ANY, - AggregateFunction::StateSize, AggregateFunction::StateInitialize, - OP::template Update, AggregateFunction::StateCombine, - AggregateFunction::StateVoidFinalize, nullptr, OP::Bind, - AggregateFunction::StateDestroy); + return AggregateFunction( + {LogicalType::ANY, LogicalType::ANY}, LogicalType::ANY, AggregateFunction::StateSize, + AggregateFunction::StateInitialize, OP::template Update, + AggregateFunction::StateCombine, AggregateFunction::StateVoidFinalize, nullptr, OP::Bind, + AggregateFunction::StateDestroy); } template AggregateFunction GetVectorArgMinMaxFunctionInternal(const LogicalType &by_type, const LogicalType &type) { #ifndef DUCKDB_SMALLER_BINARY using STATE = ArgMinMaxState; - return AggregateFunction( - {type, by_type}, type, AggregateFunction::StateSize, AggregateFunction::StateInitialize, - OP::template Update, AggregateFunction::StateCombine, - AggregateFunction::StateVoidFinalize, nullptr, OP::Bind, AggregateFunction::StateDestroy); + return AggregateFunction({type, by_type}, type, AggregateFunction::StateSize, + AggregateFunction::StateInitialize, + OP::template Update, AggregateFunction::StateCombine, + AggregateFunction::StateVoidFinalize, nullptr, OP::Bind, + AggregateFunction::StateDestroy); #else auto function = GetGenericArgMinMaxFunction(); function.arguments = {type, by_type}; @@ -380,7 +381,9 @@ template AggregateFunction GetArgMinMaxFunctionInternal(const LogicalType &by_type, const LogicalType &type) { #ifndef DUCKDB_SMALLER_BINARY using STATE = ArgMinMaxState; - auto function = AggregateFunction::BinaryAggregate(type, by_type, type); + auto function = + AggregateFunction::BinaryAggregate( + type, by_type, type); if (type.InternalType() == PhysicalType::VARCHAR || by_type.InternalType() == PhysicalType::VARCHAR) { function.destructor = AggregateFunction::StateDestroy; } @@ -618,7 +621,7 @@ static void SpecializeArgMinMaxNFunction(AggregateFunction &function) { using OP = MinMaxNOperation; function.state_size = AggregateFunction::StateSize; - function.initialize = AggregateFunction::StateInitialize; + function.initialize = AggregateFunction::StateInitialize; function.combine = AggregateFunction::StateCombine; function.destructor = AggregateFunction::StateDestroy; diff --git a/extension/core_functions/aggregate/holistic/mad.cpp b/extension/core_functions/aggregate/holistic/mad.cpp index 03c07df3f38a..93516b59f78c 100644 --- a/extension/core_functions/aggregate/holistic/mad.cpp +++ b/extension/core_functions/aggregate/holistic/mad.cpp @@ -265,7 +265,8 @@ AggregateFunction GetTypedMedianAbsoluteDeviationAggregateFunction(const Logical const LogicalType &target_type) { using STATE = QuantileState; using OP = MedianAbsoluteDeviationOperation; - auto fun = AggregateFunction::UnaryAggregateDestructor(input_type, target_type); + auto fun = AggregateFunction::UnaryAggregateDestructor(input_type, target_type); fun.bind = BindMAD; fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT; #ifndef DUCKDB_SMALLER_BINARY diff --git a/extension/core_functions/aggregate/holistic/mode.cpp b/extension/core_functions/aggregate/holistic/mode.cpp index c0bb248ebbc7..e66fa7f4e6bc 100644 --- a/extension/core_functions/aggregate/holistic/mode.cpp +++ b/extension/core_functions/aggregate/holistic/mode.cpp @@ -424,7 +424,7 @@ AggregateFunction GetFallbackModeFunction(const LogicalType &type) { using STATE = ModeState; using OP = ModeFallbackFunction; AggregateFunction aggr({type}, type, AggregateFunction::StateSize, - AggregateFunction::StateInitialize, + AggregateFunction::StateInitialize, AggregateSortKeyHelpers::UnaryUpdate, AggregateFunction::StateCombine, AggregateFunction::StateVoidFinalize, nullptr); aggr.destructor = AggregateFunction::StateDestroy; @@ -435,7 +435,9 @@ template > AggregateFunction GetTypedModeFunction(const LogicalType &type) { using STATE = ModeState; using OP = ModeFunction; - auto func = AggregateFunction::UnaryAggregateDestructor(type, type); + auto func = + AggregateFunction::UnaryAggregateDestructor( + type, type); func.window = OP::template Window; return func; } @@ -528,7 +530,9 @@ template > AggregateFunction GetTypedEntropyFunction(const LogicalType &type) { using STATE = ModeState; using OP = EntropyFunction; - auto func = AggregateFunction::UnaryAggregateDestructor(type, LogicalType::DOUBLE); + auto func = + AggregateFunction::UnaryAggregateDestructor( + type, LogicalType::DOUBLE); func.null_handling = FunctionNullHandling::SPECIAL_HANDLING; return func; } @@ -537,7 +541,7 @@ AggregateFunction GetFallbackEntropyFunction(const LogicalType &type) { using STATE = ModeState; using OP = EntropyFallbackFunction; AggregateFunction func({type}, LogicalType::DOUBLE, AggregateFunction::StateSize, - AggregateFunction::StateInitialize, + AggregateFunction::StateInitialize, AggregateSortKeyHelpers::UnaryUpdate, AggregateFunction::StateCombine, AggregateFunction::StateFinalize, nullptr); func.destructor = AggregateFunction::StateDestroy; diff --git a/extension/core_functions/aggregate/holistic/quantile.cpp b/extension/core_functions/aggregate/holistic/quantile.cpp index 879be9637bf9..f8f668af636c 100644 --- a/extension/core_functions/aggregate/holistic/quantile.cpp +++ b/extension/core_functions/aggregate/holistic/quantile.cpp @@ -420,7 +420,8 @@ struct ScalarDiscreteQuantile { static AggregateFunction GetFunction(const LogicalType &type) { using STATE = QuantileState; using OP = QuantileScalarOperation; - auto fun = AggregateFunction::UnaryAggregateDestructor(type, type); + auto fun = AggregateFunction::UnaryAggregateDestructor(type, type); #ifndef DUCKDB_SMALLER_BINARY fun.window = OP::Window; fun.window_init = OP::WindowInit; @@ -432,11 +433,12 @@ struct ScalarDiscreteQuantile { using STATE = QuantileState; using OP = QuantileScalarFallback; - AggregateFunction fun( - {type}, type, AggregateFunction::StateSize, AggregateFunction::StateInitialize, - AggregateSortKeyHelpers::UnaryUpdate, AggregateFunction::StateCombine, - AggregateFunction::StateVoidFinalize, nullptr, nullptr, - AggregateFunction::StateDestroy); + AggregateFunction fun({type}, type, AggregateFunction::StateSize, + AggregateFunction::StateInitialize, + AggregateSortKeyHelpers::UnaryUpdate, + AggregateFunction::StateCombine, + AggregateFunction::StateVoidFinalize, nullptr, nullptr, + AggregateFunction::StateDestroy); return fun; } }; @@ -445,7 +447,8 @@ template static AggregateFunction QuantileListAggregate(const LogicalType &input_type, const LogicalType &child_type) { // NOLINT LogicalType result_type = LogicalType::LIST(child_type); return AggregateFunction( - {input_type}, result_type, AggregateFunction::StateSize, AggregateFunction::StateInitialize, + {input_type}, result_type, AggregateFunction::StateSize, + AggregateFunction::StateInitialize, AggregateFunction::UnaryScatterUpdate, AggregateFunction::StateCombine, AggregateFunction::StateFinalize, AggregateFunction::UnaryUpdate, nullptr, AggregateFunction::StateDestroy); @@ -469,11 +472,12 @@ struct ListDiscreteQuantile { using STATE = QuantileState; using OP = QuantileListFallback; - AggregateFunction fun( - {type}, LogicalType::LIST(type), AggregateFunction::StateSize, - AggregateFunction::StateInitialize, AggregateSortKeyHelpers::UnaryUpdate, - AggregateFunction::StateCombine, AggregateFunction::StateFinalize, - nullptr, nullptr, AggregateFunction::StateDestroy); + AggregateFunction fun({type}, LogicalType::LIST(type), AggregateFunction::StateSize, + AggregateFunction::StateInitialize, + AggregateSortKeyHelpers::UnaryUpdate, + AggregateFunction::StateCombine, + AggregateFunction::StateFinalize, nullptr, nullptr, + AggregateFunction::StateDestroy); return fun; } }; @@ -547,7 +551,8 @@ struct ScalarContinuousQuantile { using STATE = QuantileState; using OP = QuantileScalarOperation; auto fun = - AggregateFunction::UnaryAggregateDestructor(input_type, target_type); + AggregateFunction::UnaryAggregateDestructor(input_type, target_type); fun.order_dependent = AggregateOrderDependent::NOT_ORDER_DEPENDENT; #ifndef DUCKDB_SMALLER_BINARY fun.window = OP::template Window; diff --git a/src/function/aggregate/distributive/minmax.cpp b/src/function/aggregate/distributive/minmax.cpp index 537140bf6eaf..3bbeb2210107 100644 --- a/src/function/aggregate/distributive/minmax.cpp +++ b/src/function/aggregate/distributive/minmax.cpp @@ -478,7 +478,7 @@ static void SpecializeMinMaxNFunction(AggregateFunction &function) { using OP = MinMaxNOperation; function.state_size = AggregateFunction::StateSize; - function.initialize = AggregateFunction::StateInitialize; + function.initialize = AggregateFunction::StateInitialize; function.combine = AggregateFunction::StateCombine; function.destructor = AggregateFunction::StateDestroy; diff --git a/src/function/aggregate/sorted_aggregate_function.cpp b/src/function/aggregate/sorted_aggregate_function.cpp index 4e86f930bfb4..87960adb85ba 100644 --- a/src/function/aggregate/sorted_aggregate_function.cpp +++ b/src/function/aggregate/sorted_aggregate_function.cpp @@ -744,7 +744,8 @@ void FunctionBinder::BindSortedAggregate(ClientContext &context, BoundAggregateE // Replace the aggregate with the wrapper AggregateFunction ordered_aggregate( bound_function.name, arguments, bound_function.return_type, AggregateFunction::StateSize, - AggregateFunction::StateInitialize, + AggregateFunction::StateInitialize, SortedAggregateFunction::ScatterUpdate, AggregateFunction::StateCombine, SortedAggregateFunction::Finalize, bound_function.null_handling, SortedAggregateFunction::SimpleUpdate, nullptr, diff --git a/src/include/duckdb/function/aggregate_function.hpp b/src/include/duckdb/function/aggregate_function.hpp index c054040e6fa5..ab6299aa2997 100644 --- a/src/include/duckdb/function/aggregate_function.hpp +++ b/src/include/duckdb/function/aggregate_function.hpp @@ -103,6 +103,13 @@ struct AggregateFunctionInfo { } }; +enum class AggregateDestructorType { + STANDARD, + // legacy destructors allow non-trivial destructors in aggregate states + // these might not be trivial to off-load to disk + LEGACY +}; + class AggregateFunction : public BaseScalarFunction { // NOLINT: work-around bug in clang-tidy public: AggregateFunction(const string &name, const vector &arguments, const LogicalType &return_type, @@ -206,29 +213,33 @@ class AggregateFunction : public BaseScalarFunction { // NOLINT: work-around bug AggregateFunction::StateFinalize, AggregateFunction::NullaryUpdate); } - template + template static AggregateFunction UnaryAggregate(const LogicalType &input_type, LogicalType return_type, FunctionNullHandling null_handling = FunctionNullHandling::DEFAULT_NULL_HANDLING) { - return AggregateFunction( - {input_type}, return_type, AggregateFunction::StateSize, - AggregateFunction::StateInitialize, AggregateFunction::UnaryScatterUpdate, - AggregateFunction::StateCombine, AggregateFunction::StateFinalize, - null_handling, AggregateFunction::UnaryUpdate); + return AggregateFunction({input_type}, return_type, AggregateFunction::StateSize, + AggregateFunction::StateInitialize, + AggregateFunction::UnaryScatterUpdate, + AggregateFunction::StateCombine, + AggregateFunction::StateFinalize, null_handling, + AggregateFunction::UnaryUpdate); } - template + template static AggregateFunction UnaryAggregateDestructor(LogicalType input_type, LogicalType return_type) { - auto aggregate = UnaryAggregate(input_type, return_type); + auto aggregate = UnaryAggregate(input_type, return_type); aggregate.destructor = AggregateFunction::StateDestroy; return aggregate; } - template + template static AggregateFunction BinaryAggregate(const LogicalType &a_type, const LogicalType &b_type, LogicalType return_type) { return AggregateFunction({a_type, b_type}, return_type, AggregateFunction::StateSize, - AggregateFunction::StateInitialize, + AggregateFunction::StateInitialize, AggregateFunction::BinaryScatterUpdate, AggregateFunction::StateCombine, AggregateFunction::StateFinalize, @@ -241,8 +252,12 @@ class AggregateFunction : public BaseScalarFunction { // NOLINT: work-around bug return sizeof(STATE); } - template + template static void StateInitialize(const AggregateFunction &, data_ptr_t state) { + // FIXME: we should remove the "destructor_type" option in the future + static_assert(std::is_trivially_destructible::value || + destructor_type == AggregateDestructorType::LEGACY, + "Aggregate state must be trivially destructible"); OP::Initialize(*reinterpret_cast(state)); } From d751f51e73b3fbbb9d22d222199ab403ce30e3b8 Mon Sep 17 00:00:00 2001 From: Richard Wesley <13156216+hawkfish@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:20:56 -0700 Subject: [PATCH 08/19] Internal #3381: Window Race Condition Multiple threads setting the same global value need a mutex. --- src/execution/window_executor.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/execution/window_executor.cpp b/src/execution/window_executor.cpp index 817f6115b7b1..cd3ab5e2a57c 100644 --- a/src/execution/window_executor.cpp +++ b/src/execution/window_executor.cpp @@ -1791,7 +1791,15 @@ class WindowValueGlobalState : public WindowExecutorGlobalState { child_idx(executor.child_idx) { } + void Finalize(CollectionPtr collection) { + if (child_idx != DConstants::INVALID_INDEX && executor.wexpr.ignore_nulls) { + lock_guard ingore_nulls_guard(lock); + ignore_nulls = &collection->validities[child_idx]; + } + } + // IGNORE NULLS + mutex lock; ValidityMask all_valid; optional_ptr ignore_nulls; @@ -1877,10 +1885,8 @@ unique_ptr WindowValueExecutor::GetGlobalState(const void WindowValueExecutor::Finalize(WindowExecutorGlobalState &gstate, WindowExecutorLocalState &lstate, CollectionPtr collection) const { - if (child_idx != DConstants::INVALID_INDEX && wexpr.ignore_nulls) { - auto &gvstate = gstate.Cast(); - gvstate.ignore_nulls = &collection->validities[child_idx]; - } + auto &gvstate = gstate.Cast(); + gvstate.Finalize(collection); WindowExecutor::Finalize(gstate, lstate, collection); } From b9b1bdf0882c8e857ccb71f37ae117a987971699 Mon Sep 17 00:00:00 2001 From: pdet Date: Tue, 29 Oct 2024 09:34:24 +0100 Subject: [PATCH 09/19] skip tests if pyarrow < 18 --- tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py | 3 ++- tools/pythonpkg/tests/fast/udf/test_null_filtering.py | 2 +- tools/pythonpkg/tests/fast/udf/test_scalar.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py b/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py index 9fb32b5be0e4..f95c71647d56 100644 --- a/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py +++ b/tools/pythonpkg/tests/fast/arrow/test_canonical_extensions.py @@ -5,10 +5,11 @@ from uuid import UUID import datetime -pa = pytest.importorskip('pyarrow') +pa = pytest.importorskip('pyarrow', '18.0.0') from arrow_canonical_extensions import UHugeIntType, HugeIntType, VarIntType + """ These fixtures make sure that the extension_type is registered at the start of the function, and unregistered at the end. diff --git a/tools/pythonpkg/tests/fast/udf/test_null_filtering.py b/tools/pythonpkg/tests/fast/udf/test_null_filtering.py index f7bdb828fd79..c1682da1e839 100644 --- a/tools/pythonpkg/tests/fast/udf/test_null_filtering.py +++ b/tools/pythonpkg/tests/fast/udf/test_null_filtering.py @@ -2,7 +2,7 @@ import pytest pd = pytest.importorskip("pandas") -pa = pytest.importorskip("pyarrow") +pa = pytest.importorskip('pyarrow', '18.0.0') from typing import Union import pyarrow.compute as pc import uuid diff --git a/tools/pythonpkg/tests/fast/udf/test_scalar.py b/tools/pythonpkg/tests/fast/udf/test_scalar.py index 3297c24b14eb..1e77448f1129 100644 --- a/tools/pythonpkg/tests/fast/udf/test_scalar.py +++ b/tools/pythonpkg/tests/fast/udf/test_scalar.py @@ -3,7 +3,7 @@ import pytest pd = pytest.importorskip("pandas") -pa = pytest.importorskip("pyarrow") +pa = pytest.importorskip('pyarrow', '18.0.0') from typing import Union import pyarrow.compute as pc import uuid From 011ed184b334bb3a612618e7c62c342ce90cc988 Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Tue, 29 Oct 2024 09:43:27 +0100 Subject: [PATCH 10/19] Revert check --- src/planner/planner.cpp | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/planner/planner.cpp b/src/planner/planner.cpp index 66e6eba50246..99a5934ae2c8 100644 --- a/src/planner/planner.cpp +++ b/src/planner/planner.cpp @@ -183,25 +183,35 @@ void Planner::VerifyPlan(ClientContext &context, unique_ptr &op ColumnBindingResolver::Verify(*op); // format (de)serialization of this operator - MemoryStream stream; - - SerializationOptions options; - if (config.options.serialization_compatibility.manually_set) { - // Override the default of 'latest' if this was manually set (for testing, mostly) - options.serialization_compatibility = config.options.serialization_compatibility; - } else { - options.serialization_compatibility = SerializationCompatibility::Latest(); - } + try { + MemoryStream stream; + + SerializationOptions options; + if (config.options.serialization_compatibility.manually_set) { + // Override the default of 'latest' if this was manually set (for testing, mostly) + options.serialization_compatibility = config.options.serialization_compatibility; + } else { + options.serialization_compatibility = SerializationCompatibility::Latest(); + } - BinarySerializer::Serialize(*op, stream, options); - stream.Rewind(); - bound_parameter_map_t parameters; - auto new_plan = BinaryDeserializer::Deserialize(stream, context, parameters); + BinarySerializer::Serialize(*op, stream, options); + stream.Rewind(); + bound_parameter_map_t parameters; + auto new_plan = BinaryDeserializer::Deserialize(stream, context, parameters); - if (map) { - *map = std::move(parameters); + if (map) { + *map = std::move(parameters); + } + op = std::move(new_plan); + } catch (std::exception &ex) { + ErrorData error(ex); + switch (error.Type()) { + case ExceptionType::NOT_IMPLEMENTED: // NOLINT: explicitly allowing these errors (for now) + break; // pass + default: + throw; + } } - op = std::move(new_plan); } } // namespace duckdb From 93f9c5f8d98f9e4c50b78fa89f81b5890f0bb495 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 29 Oct 2024 09:45:52 +0100 Subject: [PATCH 11/19] Typo --- src/execution/window_executor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execution/window_executor.cpp b/src/execution/window_executor.cpp index cd3ab5e2a57c..efda8639c382 100644 --- a/src/execution/window_executor.cpp +++ b/src/execution/window_executor.cpp @@ -1793,7 +1793,7 @@ class WindowValueGlobalState : public WindowExecutorGlobalState { void Finalize(CollectionPtr collection) { if (child_idx != DConstants::INVALID_INDEX && executor.wexpr.ignore_nulls) { - lock_guard ingore_nulls_guard(lock); + lock_guard ignore_nulls_guard(lock); ignore_nulls = &collection->validities[child_idx]; } } From db832b26a35129a5fc105b7b673f561f46f3ca65 Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Mon, 28 Oct 2024 16:42:38 +0100 Subject: [PATCH 12/19] CI: Add bot for 'minimal reproducible example' --- .github/workflows/InternalIssuesCreateMirror.yml | 10 +++++++++- .../workflows/needs-reproducible-example-comment.md | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/needs-reproducible-example-comment.md diff --git a/.github/workflows/InternalIssuesCreateMirror.yml b/.github/workflows/InternalIssuesCreateMirror.yml index 27d50e1f8ade..6471f81602a0 100644 --- a/.github/workflows/InternalIssuesCreateMirror.yml +++ b/.github/workflows/InternalIssuesCreateMirror.yml @@ -21,7 +21,15 @@ jobs: run: | gh issue edit --repo duckdb/duckdb ${{ github.event.issue.number }} --remove-label "needs triage" - create_or_label_issue: + add_needs_reproducible_example_comment: + if: github.event.label.name == 'needs reproducible example' + runs-on: ubuntu-latest + steps: + - name: Add comment + run: | + gh issue comment ${{ github.event.issue.number }} --body-file .github/workflows/needs-reproducible-example-comment.md + + create_or_label_mirror_issue: if: github.event.label.name == 'reproduced' || github.event.label.name == 'under review' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/needs-reproducible-example-comment.md b/.github/workflows/needs-reproducible-example-comment.md new file mode 100644 index 000000000000..3d1f16e352d4 --- /dev/null +++ b/.github/workflows/needs-reproducible-example-comment.md @@ -0,0 +1,8 @@ +Thanks for opening this issue in the DuckDB issue tracker! To resolve this issue, our team needs a reproducible example. This includes: + +* A source code snippet which reproduces the issue. + * The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid `/Users/JohnDoe/...`). + * A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). If you can provide such an example, it greatly simplifies the reproduction process and likely results in a faster fix. +* If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortuantely, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA. + +For more detailed guidelines on how to create reproducible examples, please visit Stack Overflow's [“Minimal, Reproducible Example”](https://stackoverflow.com/help/minimal-reproducible-example) page. From cb77cd9c0c00a60ecfa4c5954311c385983d8981 Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Tue, 29 Oct 2024 10:25:20 +0100 Subject: [PATCH 13/19] Regenerate enums --- src/common/enum_util.cpp | 475 +-------------------------------------- 1 file changed, 10 insertions(+), 465 deletions(-) diff --git a/src/common/enum_util.cpp b/src/common/enum_util.cpp index 66ff68fcb566..2a876bcec8c4 100644 --- a/src/common/enum_util.cpp +++ b/src/common/enum_util.cpp @@ -2109,53 +2109,20 @@ const StringUtil::EnumStringLiteral *GetMemoryTagValues() { { static_cast(MemoryTag::OVERFLOW_STRINGS), "OVERFLOW_STRINGS" }, { static_cast(MemoryTag::IN_MEMORY_TABLE), "IN_MEMORY_TABLE" }, { static_cast(MemoryTag::ALLOCATOR), "ALLOCATOR" }, - { static_cast(MemoryTag::EXTENSION), "EXTENSION" } + { static_cast(MemoryTag::EXTENSION), "EXTENSION" }, + { static_cast(MemoryTag::TRANSACTION), "TRANSACTION" } }; return values; } template<> const char* EnumUtil::ToChars(MemoryTag value) { -<<<<<<< HEAD - return StringUtil::EnumToString(GetMemoryTagValues(), 12, "MemoryTag", static_cast(value)); -======= - switch(value) { - case MemoryTag::BASE_TABLE: - return "BASE_TABLE"; - case MemoryTag::HASH_TABLE: - return "HASH_TABLE"; - case MemoryTag::PARQUET_READER: - return "PARQUET_READER"; - case MemoryTag::CSV_READER: - return "CSV_READER"; - case MemoryTag::ORDER_BY: - return "ORDER_BY"; - case MemoryTag::ART_INDEX: - return "ART_INDEX"; - case MemoryTag::COLUMN_DATA: - return "COLUMN_DATA"; - case MemoryTag::METADATA: - return "METADATA"; - case MemoryTag::OVERFLOW_STRINGS: - return "OVERFLOW_STRINGS"; - case MemoryTag::IN_MEMORY_TABLE: - return "IN_MEMORY_TABLE"; - case MemoryTag::ALLOCATOR: - return "ALLOCATOR"; - case MemoryTag::EXTENSION: - return "EXTENSION"; - case MemoryTag::TRANSACTION: - return "TRANSACTION"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } ->>>>>>> feature + return StringUtil::EnumToString(GetMemoryTagValues(), 13, "MemoryTag", static_cast(value)); } template<> MemoryTag EnumUtil::FromString(const char *value) { -<<<<<<< HEAD - return static_cast(StringUtil::StringToEnum(GetMemoryTagValues(), 12, "MemoryTag", value)); + return static_cast(StringUtil::StringToEnum(GetMemoryTagValues(), 13, "MemoryTag", value)); } const StringUtil::EnumStringLiteral *GetMetaPipelineTypeValues() { @@ -2164,48 +2131,6 @@ const StringUtil::EnumStringLiteral *GetMetaPipelineTypeValues() { { static_cast(MetaPipelineType::JOIN_BUILD), "JOIN_BUILD" } }; return values; -======= - if (StringUtil::Equals(value, "BASE_TABLE")) { - return MemoryTag::BASE_TABLE; - } - if (StringUtil::Equals(value, "HASH_TABLE")) { - return MemoryTag::HASH_TABLE; - } - if (StringUtil::Equals(value, "PARQUET_READER")) { - return MemoryTag::PARQUET_READER; - } - if (StringUtil::Equals(value, "CSV_READER")) { - return MemoryTag::CSV_READER; - } - if (StringUtil::Equals(value, "ORDER_BY")) { - return MemoryTag::ORDER_BY; - } - if (StringUtil::Equals(value, "ART_INDEX")) { - return MemoryTag::ART_INDEX; - } - if (StringUtil::Equals(value, "COLUMN_DATA")) { - return MemoryTag::COLUMN_DATA; - } - if (StringUtil::Equals(value, "METADATA")) { - return MemoryTag::METADATA; - } - if (StringUtil::Equals(value, "OVERFLOW_STRINGS")) { - return MemoryTag::OVERFLOW_STRINGS; - } - if (StringUtil::Equals(value, "IN_MEMORY_TABLE")) { - return MemoryTag::IN_MEMORY_TABLE; - } - if (StringUtil::Equals(value, "ALLOCATOR")) { - return MemoryTag::ALLOCATOR; - } - if (StringUtil::Equals(value, "EXTENSION")) { - return MemoryTag::EXTENSION; - } - if (StringUtil::Equals(value, "TRANSACTION")) { - return MemoryTag::TRANSACTION; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); ->>>>>>> feature } template<> @@ -2257,6 +2182,7 @@ const StringUtil::EnumStringLiteral *GetMetricsTypeValues() { { static_cast(MetricsType::OPTIMIZER_COLUMN_LIFETIME), "OPTIMIZER_COLUMN_LIFETIME" }, { static_cast(MetricsType::OPTIMIZER_BUILD_SIDE_PROBE_SIDE), "OPTIMIZER_BUILD_SIDE_PROBE_SIDE" }, { static_cast(MetricsType::OPTIMIZER_LIMIT_PUSHDOWN), "OPTIMIZER_LIMIT_PUSHDOWN" }, + { static_cast(MetricsType::OPTIMIZER_SAMPLING_PUSHDOWN), "OPTIMIZER_SAMPLING_PUSHDOWN" }, { static_cast(MetricsType::OPTIMIZER_TOP_N), "OPTIMIZER_TOP_N" }, { static_cast(MetricsType::OPTIMIZER_COMPRESSED_MATERIALIZATION), "OPTIMIZER_COMPRESSED_MATERIALIZATION" }, { static_cast(MetricsType::OPTIMIZER_DUPLICATE_GROUPS), "OPTIMIZER_DUPLICATE_GROUPS" }, @@ -2271,112 +2197,12 @@ const StringUtil::EnumStringLiteral *GetMetricsTypeValues() { template<> const char* EnumUtil::ToChars(MetricsType value) { -<<<<<<< HEAD - return StringUtil::EnumToString(GetMetricsTypeValues(), 45, "MetricsType", static_cast(value)); -======= - switch(value) { - case MetricsType::QUERY_NAME: - return "QUERY_NAME"; - case MetricsType::BLOCKED_THREAD_TIME: - return "BLOCKED_THREAD_TIME"; - case MetricsType::CPU_TIME: - return "CPU_TIME"; - case MetricsType::EXTRA_INFO: - return "EXTRA_INFO"; - case MetricsType::CUMULATIVE_CARDINALITY: - return "CUMULATIVE_CARDINALITY"; - case MetricsType::OPERATOR_TYPE: - return "OPERATOR_TYPE"; - case MetricsType::OPERATOR_CARDINALITY: - return "OPERATOR_CARDINALITY"; - case MetricsType::CUMULATIVE_ROWS_SCANNED: - return "CUMULATIVE_ROWS_SCANNED"; - case MetricsType::OPERATOR_ROWS_SCANNED: - return "OPERATOR_ROWS_SCANNED"; - case MetricsType::OPERATOR_TIMING: - return "OPERATOR_TIMING"; - case MetricsType::LATENCY: - return "LATENCY"; - case MetricsType::ROWS_RETURNED: - return "ROWS_RETURNED"; - case MetricsType::RESULT_SET_SIZE: - return "RESULT_SET_SIZE"; - case MetricsType::ALL_OPTIMIZERS: - return "ALL_OPTIMIZERS"; - case MetricsType::CUMULATIVE_OPTIMIZER_TIMING: - return "CUMULATIVE_OPTIMIZER_TIMING"; - case MetricsType::PLANNER: - return "PLANNER"; - case MetricsType::PLANNER_BINDING: - return "PLANNER_BINDING"; - case MetricsType::PHYSICAL_PLANNER: - return "PHYSICAL_PLANNER"; - case MetricsType::PHYSICAL_PLANNER_COLUMN_BINDING: - return "PHYSICAL_PLANNER_COLUMN_BINDING"; - case MetricsType::PHYSICAL_PLANNER_RESOLVE_TYPES: - return "PHYSICAL_PLANNER_RESOLVE_TYPES"; - case MetricsType::PHYSICAL_PLANNER_CREATE_PLAN: - return "PHYSICAL_PLANNER_CREATE_PLAN"; - case MetricsType::OPTIMIZER_EXPRESSION_REWRITER: - return "OPTIMIZER_EXPRESSION_REWRITER"; - case MetricsType::OPTIMIZER_FILTER_PULLUP: - return "OPTIMIZER_FILTER_PULLUP"; - case MetricsType::OPTIMIZER_FILTER_PUSHDOWN: - return "OPTIMIZER_FILTER_PUSHDOWN"; - case MetricsType::OPTIMIZER_CTE_FILTER_PUSHER: - return "OPTIMIZER_CTE_FILTER_PUSHER"; - case MetricsType::OPTIMIZER_REGEX_RANGE: - return "OPTIMIZER_REGEX_RANGE"; - case MetricsType::OPTIMIZER_IN_CLAUSE: - return "OPTIMIZER_IN_CLAUSE"; - case MetricsType::OPTIMIZER_JOIN_ORDER: - return "OPTIMIZER_JOIN_ORDER"; - case MetricsType::OPTIMIZER_DELIMINATOR: - return "OPTIMIZER_DELIMINATOR"; - case MetricsType::OPTIMIZER_UNNEST_REWRITER: - return "OPTIMIZER_UNNEST_REWRITER"; - case MetricsType::OPTIMIZER_UNUSED_COLUMNS: - return "OPTIMIZER_UNUSED_COLUMNS"; - case MetricsType::OPTIMIZER_STATISTICS_PROPAGATION: - return "OPTIMIZER_STATISTICS_PROPAGATION"; - case MetricsType::OPTIMIZER_COMMON_SUBEXPRESSIONS: - return "OPTIMIZER_COMMON_SUBEXPRESSIONS"; - case MetricsType::OPTIMIZER_COMMON_AGGREGATE: - return "OPTIMIZER_COMMON_AGGREGATE"; - case MetricsType::OPTIMIZER_COLUMN_LIFETIME: - return "OPTIMIZER_COLUMN_LIFETIME"; - case MetricsType::OPTIMIZER_BUILD_SIDE_PROBE_SIDE: - return "OPTIMIZER_BUILD_SIDE_PROBE_SIDE"; - case MetricsType::OPTIMIZER_LIMIT_PUSHDOWN: - return "OPTIMIZER_LIMIT_PUSHDOWN"; - case MetricsType::OPTIMIZER_SAMPLING_PUSHDOWN: - return "OPTIMIZER_SAMPLING_PUSHDOWN"; - case MetricsType::OPTIMIZER_TOP_N: - return "OPTIMIZER_TOP_N"; - case MetricsType::OPTIMIZER_COMPRESSED_MATERIALIZATION: - return "OPTIMIZER_COMPRESSED_MATERIALIZATION"; - case MetricsType::OPTIMIZER_DUPLICATE_GROUPS: - return "OPTIMIZER_DUPLICATE_GROUPS"; - case MetricsType::OPTIMIZER_REORDER_FILTER: - return "OPTIMIZER_REORDER_FILTER"; - case MetricsType::OPTIMIZER_JOIN_FILTER_PUSHDOWN: - return "OPTIMIZER_JOIN_FILTER_PUSHDOWN"; - case MetricsType::OPTIMIZER_EXTENSION: - return "OPTIMIZER_EXTENSION"; - case MetricsType::OPTIMIZER_MATERIALIZED_CTE: - return "OPTIMIZER_MATERIALIZED_CTE"; - case MetricsType::OPTIMIZER_EMPTY_RESULT_PULLUP: - return "OPTIMIZER_EMPTY_RESULT_PULLUP"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } ->>>>>>> feature + return StringUtil::EnumToString(GetMetricsTypeValues(), 46, "MetricsType", static_cast(value)); } template<> MetricsType EnumUtil::FromString(const char *value) { -<<<<<<< HEAD - return static_cast(StringUtil::StringToEnum(GetMetricsTypeValues(), 45, "MetricsType", value)); + return static_cast(StringUtil::StringToEnum(GetMetricsTypeValues(), 46, "MetricsType", value)); } const StringUtil::EnumStringLiteral *GetNTypeValues() { @@ -2393,147 +2219,6 @@ const StringUtil::EnumStringLiteral *GetNTypeValues() { { static_cast(NType::NODE_256_LEAF), "NODE_256_LEAF" } }; return values; -======= - if (StringUtil::Equals(value, "QUERY_NAME")) { - return MetricsType::QUERY_NAME; - } - if (StringUtil::Equals(value, "BLOCKED_THREAD_TIME")) { - return MetricsType::BLOCKED_THREAD_TIME; - } - if (StringUtil::Equals(value, "CPU_TIME")) { - return MetricsType::CPU_TIME; - } - if (StringUtil::Equals(value, "EXTRA_INFO")) { - return MetricsType::EXTRA_INFO; - } - if (StringUtil::Equals(value, "CUMULATIVE_CARDINALITY")) { - return MetricsType::CUMULATIVE_CARDINALITY; - } - if (StringUtil::Equals(value, "OPERATOR_TYPE")) { - return MetricsType::OPERATOR_TYPE; - } - if (StringUtil::Equals(value, "OPERATOR_CARDINALITY")) { - return MetricsType::OPERATOR_CARDINALITY; - } - if (StringUtil::Equals(value, "CUMULATIVE_ROWS_SCANNED")) { - return MetricsType::CUMULATIVE_ROWS_SCANNED; - } - if (StringUtil::Equals(value, "OPERATOR_ROWS_SCANNED")) { - return MetricsType::OPERATOR_ROWS_SCANNED; - } - if (StringUtil::Equals(value, "OPERATOR_TIMING")) { - return MetricsType::OPERATOR_TIMING; - } - if (StringUtil::Equals(value, "LATENCY")) { - return MetricsType::LATENCY; - } - if (StringUtil::Equals(value, "ROWS_RETURNED")) { - return MetricsType::ROWS_RETURNED; - } - if (StringUtil::Equals(value, "RESULT_SET_SIZE")) { - return MetricsType::RESULT_SET_SIZE; - } - if (StringUtil::Equals(value, "ALL_OPTIMIZERS")) { - return MetricsType::ALL_OPTIMIZERS; - } - if (StringUtil::Equals(value, "CUMULATIVE_OPTIMIZER_TIMING")) { - return MetricsType::CUMULATIVE_OPTIMIZER_TIMING; - } - if (StringUtil::Equals(value, "PLANNER")) { - return MetricsType::PLANNER; - } - if (StringUtil::Equals(value, "PLANNER_BINDING")) { - return MetricsType::PLANNER_BINDING; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER")) { - return MetricsType::PHYSICAL_PLANNER; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER_COLUMN_BINDING")) { - return MetricsType::PHYSICAL_PLANNER_COLUMN_BINDING; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER_RESOLVE_TYPES")) { - return MetricsType::PHYSICAL_PLANNER_RESOLVE_TYPES; - } - if (StringUtil::Equals(value, "PHYSICAL_PLANNER_CREATE_PLAN")) { - return MetricsType::PHYSICAL_PLANNER_CREATE_PLAN; - } - if (StringUtil::Equals(value, "OPTIMIZER_EXPRESSION_REWRITER")) { - return MetricsType::OPTIMIZER_EXPRESSION_REWRITER; - } - if (StringUtil::Equals(value, "OPTIMIZER_FILTER_PULLUP")) { - return MetricsType::OPTIMIZER_FILTER_PULLUP; - } - if (StringUtil::Equals(value, "OPTIMIZER_FILTER_PUSHDOWN")) { - return MetricsType::OPTIMIZER_FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_CTE_FILTER_PUSHER")) { - return MetricsType::OPTIMIZER_CTE_FILTER_PUSHER; - } - if (StringUtil::Equals(value, "OPTIMIZER_REGEX_RANGE")) { - return MetricsType::OPTIMIZER_REGEX_RANGE; - } - if (StringUtil::Equals(value, "OPTIMIZER_IN_CLAUSE")) { - return MetricsType::OPTIMIZER_IN_CLAUSE; - } - if (StringUtil::Equals(value, "OPTIMIZER_JOIN_ORDER")) { - return MetricsType::OPTIMIZER_JOIN_ORDER; - } - if (StringUtil::Equals(value, "OPTIMIZER_DELIMINATOR")) { - return MetricsType::OPTIMIZER_DELIMINATOR; - } - if (StringUtil::Equals(value, "OPTIMIZER_UNNEST_REWRITER")) { - return MetricsType::OPTIMIZER_UNNEST_REWRITER; - } - if (StringUtil::Equals(value, "OPTIMIZER_UNUSED_COLUMNS")) { - return MetricsType::OPTIMIZER_UNUSED_COLUMNS; - } - if (StringUtil::Equals(value, "OPTIMIZER_STATISTICS_PROPAGATION")) { - return MetricsType::OPTIMIZER_STATISTICS_PROPAGATION; - } - if (StringUtil::Equals(value, "OPTIMIZER_COMMON_SUBEXPRESSIONS")) { - return MetricsType::OPTIMIZER_COMMON_SUBEXPRESSIONS; - } - if (StringUtil::Equals(value, "OPTIMIZER_COMMON_AGGREGATE")) { - return MetricsType::OPTIMIZER_COMMON_AGGREGATE; - } - if (StringUtil::Equals(value, "OPTIMIZER_COLUMN_LIFETIME")) { - return MetricsType::OPTIMIZER_COLUMN_LIFETIME; - } - if (StringUtil::Equals(value, "OPTIMIZER_BUILD_SIDE_PROBE_SIDE")) { - return MetricsType::OPTIMIZER_BUILD_SIDE_PROBE_SIDE; - } - if (StringUtil::Equals(value, "OPTIMIZER_LIMIT_PUSHDOWN")) { - return MetricsType::OPTIMIZER_LIMIT_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_SAMPLING_PUSHDOWN")) { - return MetricsType::OPTIMIZER_SAMPLING_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_TOP_N")) { - return MetricsType::OPTIMIZER_TOP_N; - } - if (StringUtil::Equals(value, "OPTIMIZER_COMPRESSED_MATERIALIZATION")) { - return MetricsType::OPTIMIZER_COMPRESSED_MATERIALIZATION; - } - if (StringUtil::Equals(value, "OPTIMIZER_DUPLICATE_GROUPS")) { - return MetricsType::OPTIMIZER_DUPLICATE_GROUPS; - } - if (StringUtil::Equals(value, "OPTIMIZER_REORDER_FILTER")) { - return MetricsType::OPTIMIZER_REORDER_FILTER; - } - if (StringUtil::Equals(value, "OPTIMIZER_JOIN_FILTER_PUSHDOWN")) { - return MetricsType::OPTIMIZER_JOIN_FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "OPTIMIZER_EXTENSION")) { - return MetricsType::OPTIMIZER_EXTENSION; - } - if (StringUtil::Equals(value, "OPTIMIZER_MATERIALIZED_CTE")) { - return MetricsType::OPTIMIZER_MATERIALIZED_CTE; - } - if (StringUtil::Equals(value, "OPTIMIZER_EMPTY_RESULT_PULLUP")) { - return MetricsType::OPTIMIZER_EMPTY_RESULT_PULLUP; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); ->>>>>>> feature } template<> @@ -2686,6 +2371,7 @@ const StringUtil::EnumStringLiteral *GetOptimizerTypeValues() { { static_cast(OptimizerType::COMPRESSED_MATERIALIZATION), "COMPRESSED_MATERIALIZATION" }, { static_cast(OptimizerType::DUPLICATE_GROUPS), "DUPLICATE_GROUPS" }, { static_cast(OptimizerType::REORDER_FILTER), "REORDER_FILTER" }, + { static_cast(OptimizerType::SAMPLING_PUSHDOWN), "SAMPLING_PUSHDOWN" }, { static_cast(OptimizerType::JOIN_FILTER_PUSHDOWN), "JOIN_FILTER_PUSHDOWN" }, { static_cast(OptimizerType::EXTENSION), "EXTENSION" }, { static_cast(OptimizerType::MATERIALIZED_CTE), "MATERIALIZED_CTE" } @@ -2695,72 +2381,12 @@ const StringUtil::EnumStringLiteral *GetOptimizerTypeValues() { template<> const char* EnumUtil::ToChars(OptimizerType value) { -<<<<<<< HEAD - return StringUtil::EnumToString(GetOptimizerTypeValues(), 25, "OptimizerType", static_cast(value)); -======= - switch(value) { - case OptimizerType::INVALID: - return "INVALID"; - case OptimizerType::EXPRESSION_REWRITER: - return "EXPRESSION_REWRITER"; - case OptimizerType::FILTER_PULLUP: - return "FILTER_PULLUP"; - case OptimizerType::FILTER_PUSHDOWN: - return "FILTER_PUSHDOWN"; - case OptimizerType::EMPTY_RESULT_PULLUP: - return "EMPTY_RESULT_PULLUP"; - case OptimizerType::CTE_FILTER_PUSHER: - return "CTE_FILTER_PUSHER"; - case OptimizerType::REGEX_RANGE: - return "REGEX_RANGE"; - case OptimizerType::IN_CLAUSE: - return "IN_CLAUSE"; - case OptimizerType::JOIN_ORDER: - return "JOIN_ORDER"; - case OptimizerType::DELIMINATOR: - return "DELIMINATOR"; - case OptimizerType::UNNEST_REWRITER: - return "UNNEST_REWRITER"; - case OptimizerType::UNUSED_COLUMNS: - return "UNUSED_COLUMNS"; - case OptimizerType::STATISTICS_PROPAGATION: - return "STATISTICS_PROPAGATION"; - case OptimizerType::COMMON_SUBEXPRESSIONS: - return "COMMON_SUBEXPRESSIONS"; - case OptimizerType::COMMON_AGGREGATE: - return "COMMON_AGGREGATE"; - case OptimizerType::COLUMN_LIFETIME: - return "COLUMN_LIFETIME"; - case OptimizerType::BUILD_SIDE_PROBE_SIDE: - return "BUILD_SIDE_PROBE_SIDE"; - case OptimizerType::LIMIT_PUSHDOWN: - return "LIMIT_PUSHDOWN"; - case OptimizerType::TOP_N: - return "TOP_N"; - case OptimizerType::COMPRESSED_MATERIALIZATION: - return "COMPRESSED_MATERIALIZATION"; - case OptimizerType::DUPLICATE_GROUPS: - return "DUPLICATE_GROUPS"; - case OptimizerType::REORDER_FILTER: - return "REORDER_FILTER"; - case OptimizerType::SAMPLING_PUSHDOWN: - return "SAMPLING_PUSHDOWN"; - case OptimizerType::JOIN_FILTER_PUSHDOWN: - return "JOIN_FILTER_PUSHDOWN"; - case OptimizerType::EXTENSION: - return "EXTENSION"; - case OptimizerType::MATERIALIZED_CTE: - return "MATERIALIZED_CTE"; - default: - throw NotImplementedException(StringUtil::Format("Enum value: '%d' not implemented in ToChars", value)); - } ->>>>>>> feature + return StringUtil::EnumToString(GetOptimizerTypeValues(), 26, "OptimizerType", static_cast(value)); } template<> OptimizerType EnumUtil::FromString(const char *value) { -<<<<<<< HEAD - return static_cast(StringUtil::StringToEnum(GetOptimizerTypeValues(), 25, "OptimizerType", value)); + return static_cast(StringUtil::StringToEnum(GetOptimizerTypeValues(), 26, "OptimizerType", value)); } const StringUtil::EnumStringLiteral *GetOrderByNullTypeValues() { @@ -2774,87 +2400,6 @@ const StringUtil::EnumStringLiteral *GetOrderByNullTypeValues() { { static_cast(OrderByNullType::NULLS_LAST), "NULLS LAST" } }; return values; -======= - if (StringUtil::Equals(value, "INVALID")) { - return OptimizerType::INVALID; - } - if (StringUtil::Equals(value, "EXPRESSION_REWRITER")) { - return OptimizerType::EXPRESSION_REWRITER; - } - if (StringUtil::Equals(value, "FILTER_PULLUP")) { - return OptimizerType::FILTER_PULLUP; - } - if (StringUtil::Equals(value, "FILTER_PUSHDOWN")) { - return OptimizerType::FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "EMPTY_RESULT_PULLUP")) { - return OptimizerType::EMPTY_RESULT_PULLUP; - } - if (StringUtil::Equals(value, "CTE_FILTER_PUSHER")) { - return OptimizerType::CTE_FILTER_PUSHER; - } - if (StringUtil::Equals(value, "REGEX_RANGE")) { - return OptimizerType::REGEX_RANGE; - } - if (StringUtil::Equals(value, "IN_CLAUSE")) { - return OptimizerType::IN_CLAUSE; - } - if (StringUtil::Equals(value, "JOIN_ORDER")) { - return OptimizerType::JOIN_ORDER; - } - if (StringUtil::Equals(value, "DELIMINATOR")) { - return OptimizerType::DELIMINATOR; - } - if (StringUtil::Equals(value, "UNNEST_REWRITER")) { - return OptimizerType::UNNEST_REWRITER; - } - if (StringUtil::Equals(value, "UNUSED_COLUMNS")) { - return OptimizerType::UNUSED_COLUMNS; - } - if (StringUtil::Equals(value, "STATISTICS_PROPAGATION")) { - return OptimizerType::STATISTICS_PROPAGATION; - } - if (StringUtil::Equals(value, "COMMON_SUBEXPRESSIONS")) { - return OptimizerType::COMMON_SUBEXPRESSIONS; - } - if (StringUtil::Equals(value, "COMMON_AGGREGATE")) { - return OptimizerType::COMMON_AGGREGATE; - } - if (StringUtil::Equals(value, "COLUMN_LIFETIME")) { - return OptimizerType::COLUMN_LIFETIME; - } - if (StringUtil::Equals(value, "BUILD_SIDE_PROBE_SIDE")) { - return OptimizerType::BUILD_SIDE_PROBE_SIDE; - } - if (StringUtil::Equals(value, "LIMIT_PUSHDOWN")) { - return OptimizerType::LIMIT_PUSHDOWN; - } - if (StringUtil::Equals(value, "TOP_N")) { - return OptimizerType::TOP_N; - } - if (StringUtil::Equals(value, "COMPRESSED_MATERIALIZATION")) { - return OptimizerType::COMPRESSED_MATERIALIZATION; - } - if (StringUtil::Equals(value, "DUPLICATE_GROUPS")) { - return OptimizerType::DUPLICATE_GROUPS; - } - if (StringUtil::Equals(value, "REORDER_FILTER")) { - return OptimizerType::REORDER_FILTER; - } - if (StringUtil::Equals(value, "SAMPLING_PUSHDOWN")) { - return OptimizerType::SAMPLING_PUSHDOWN; - } - if (StringUtil::Equals(value, "JOIN_FILTER_PUSHDOWN")) { - return OptimizerType::JOIN_FILTER_PUSHDOWN; - } - if (StringUtil::Equals(value, "EXTENSION")) { - return OptimizerType::EXTENSION; - } - if (StringUtil::Equals(value, "MATERIALIZED_CTE")) { - return OptimizerType::MATERIALIZED_CTE; - } - throw NotImplementedException(StringUtil::Format("Enum value: '%s' not implemented in FromString", value)); ->>>>>>> feature } template<> From 750b99acab5a6283c448e8c52e3e9385a016dd0a Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Tue, 29 Oct 2024 10:32:45 +0100 Subject: [PATCH 14/19] Remove duplicate includes in generate_serialization --- extension/parquet/serialize_parquet.cpp | 2 -- scripts/generate_serialization.py | 7 ++++++- src/storage/serialization/serialize_nodes.cpp | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/extension/parquet/serialize_parquet.cpp b/extension/parquet/serialize_parquet.cpp index e6aeac023926..b72a78be2085 100644 --- a/extension/parquet/serialize_parquet.cpp +++ b/extension/parquet/serialize_parquet.cpp @@ -7,8 +7,6 @@ #include "duckdb/common/serializer/deserializer.hpp" #include "parquet_reader.hpp" #include "parquet_crypto.hpp" -#include "parquet_reader.hpp" -#include "parquet_writer.hpp" #include "parquet_writer.hpp" namespace duckdb { diff --git a/scripts/generate_serialization.py b/scripts/generate_serialization.py index 5e8a50d3de9b..db5f8d52e437 100644 --- a/scripts/generate_serialization.py +++ b/scripts/generate_serialization.py @@ -771,7 +771,12 @@ def check_children_for_duplicate_members(node: SerializableClass, parents: list, for entry in json_data: if 'includes' in entry: - include_list += entry['includes'] + if type(entry['includes']) != type([]): + print(f"Include list must be a list, found {type(entry['includes'])} (in {str(entry)})") + exit(1) + for include_entry in entry['includes']: + if include_entry not in include_list: + include_list.append(include_entry) new_class = SerializableClass(entry) if new_class.is_base_class: # this class is a base class itself - construct the base class list diff --git a/src/storage/serialization/serialize_nodes.cpp b/src/storage/serialization/serialize_nodes.cpp index 0b077ec7c231..7e6f7174abbf 100644 --- a/src/storage/serialization/serialize_nodes.cpp +++ b/src/storage/serialization/serialize_nodes.cpp @@ -33,7 +33,6 @@ #include "duckdb/function/table/read_csv.hpp" #include "duckdb/common/types/interval.hpp" #include "duckdb/parser/parsed_data/exported_table_data.hpp" -#include "duckdb/parser/parsed_data/exported_table_data.hpp" namespace duckdb { From ed0dcef406941c0784d85c6f1d804df90a6968c1 Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Tue, 29 Oct 2024 10:51:57 +0100 Subject: [PATCH 15/19] Use LEGACY destructor type in spatial --- .../extensions/spatial/random_test_fix.patch | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/patches/extensions/spatial/random_test_fix.patch b/.github/patches/extensions/spatial/random_test_fix.patch index 19ed486b336a..36351bce70f8 100644 --- a/.github/patches/extensions/spatial/random_test_fix.patch +++ b/.github/patches/extensions/spatial/random_test_fix.patch @@ -56,10 +56,10 @@ index 465cb87..5aa49dd 100644 ExtensionUtil::RegisterFunction(db, read); diff --git a/spatial/src/spatial/gdal/functions/st_read.cpp b/spatial/src/spatial/gdal/functions/st_read.cpp -index 177548c..42d2df7 100644 +index b730baa..8d08898 100644 --- a/spatial/src/spatial/gdal/functions/st_read.cpp +++ b/spatial/src/spatial/gdal/functions/st_read.cpp -@@ -675,7 +675,7 @@ void GdalTableFunction::Register(DatabaseInstance &db) { +@@ -676,7 +676,7 @@ void GdalTableFunction::Register(DatabaseInstance &db) { GdalTableFunction::InitGlobal, GdalTableFunction::InitLocal); scan.cardinality = GdalTableFunction::Cardinality; @@ -68,3 +68,25 @@ index 177548c..42d2df7 100644 scan.projection_pushdown = true; scan.filter_pushdown = true; +diff --git a/spatial/src/spatial/geos/functions/aggregate.cpp b/spatial/src/spatial/geos/functions/aggregate.cpp +index aacc668..c478786 100644 +--- a/spatial/src/spatial/geos/functions/aggregate.cpp ++++ b/spatial/src/spatial/geos/functions/aggregate.cpp +@@ -197,7 +197,7 @@ void GeosAggregateFunctions::Register(DatabaseInstance &db) { + + AggregateFunctionSet st_intersection_agg("ST_Intersection_Agg"); + st_intersection_agg.AddFunction( +- AggregateFunction::UnaryAggregateDestructor( ++ AggregateFunction::UnaryAggregateDestructor( + core::GeoTypes::GEOMETRY(), core::GeoTypes::GEOMETRY())); + + ExtensionUtil::RegisterFunction(db, st_intersection_agg); +@@ -206,7 +206,7 @@ void GeosAggregateFunctions::Register(DatabaseInstance &db) { + + AggregateFunctionSet st_union_agg("ST_Union_Agg"); + st_union_agg.AddFunction( +- AggregateFunction::UnaryAggregateDestructor( ++ AggregateFunction::UnaryAggregateDestructor( + core::GeoTypes::GEOMETRY(), core::GeoTypes::GEOMETRY())); + + ExtensionUtil::RegisterFunction(db, st_union_agg); From 366e127398c7ca4b733975da66d665fa2762ffb8 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 29 Oct 2024 10:53:04 +0100 Subject: [PATCH 16/19] Fix typo --- .github/workflows/needs-reproducible-example-comment.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/needs-reproducible-example-comment.md b/.github/workflows/needs-reproducible-example-comment.md index 3d1f16e352d4..30648567f9fe 100644 --- a/.github/workflows/needs-reproducible-example-comment.md +++ b/.github/workflows/needs-reproducible-example-comment.md @@ -1,8 +1,8 @@ Thanks for opening this issue in the DuckDB issue tracker! To resolve this issue, our team needs a reproducible example. This includes: * A source code snippet which reproduces the issue. - * The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid `/Users/JohnDoe/...`). - * A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). If you can provide such an example, it greatly simplifies the reproduction process and likely results in a faster fix. -* If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortuantely, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA. +* The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid `/Users/JohnDoe/...`). +* A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). If you can provide such an example, it greatly simplifies the reproduction process and likely results in a faster fix. +* If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortunately, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA. For more detailed guidelines on how to create reproducible examples, please visit Stack Overflow's [“Minimal, Reproducible Example”](https://stackoverflow.com/help/minimal-reproducible-example) page. From ac87ce263574723d45115d91225fcc5177293ffe Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Tue, 29 Oct 2024 13:17:20 +0100 Subject: [PATCH 17/19] CI: Fix and simplify 'needs reproducible example' labelling --- .github/workflows/InternalIssuesCreateMirror.yml | 12 +++++++++++- .../workflows/needs-reproducible-example-comment.md | 8 -------- 2 files changed, 11 insertions(+), 9 deletions(-) delete mode 100644 .github/workflows/needs-reproducible-example-comment.md diff --git a/.github/workflows/InternalIssuesCreateMirror.yml b/.github/workflows/InternalIssuesCreateMirror.yml index 6471f81602a0..01ab31e0c117 100644 --- a/.github/workflows/InternalIssuesCreateMirror.yml +++ b/.github/workflows/InternalIssuesCreateMirror.yml @@ -27,7 +27,17 @@ jobs: steps: - name: Add comment run: | - gh issue comment ${{ github.event.issue.number }} --body-file .github/workflows/needs-reproducible-example-comment.md + cat > needs-reproducible-example-comment.md << EOF + Thanks for opening this issue in the DuckDB issue tracker! To resolve this issue, our team needs a reproducible example. This includes: + + * A source code snippet which reproduces the issue. + * The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid \`/Users/JohnDoe/...`). + * A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). If you can provide such an example, it greatly simplifies the reproduction process and likely results in a faster fix. + * If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortunately, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA. + + For more detailed guidelines on how to create reproducible examples, please visit Stack Overflow's [“Minimal, Reproducible Example”](https://stackoverflow.com/help/minimal-reproducible-example) page. + EOF + gh issue comment ${{ github.event.issue.number }} --body-file needs-reproducible-example-comment.md create_or_label_mirror_issue: if: github.event.label.name == 'reproduced' || github.event.label.name == 'under review' diff --git a/.github/workflows/needs-reproducible-example-comment.md b/.github/workflows/needs-reproducible-example-comment.md deleted file mode 100644 index 30648567f9fe..000000000000 --- a/.github/workflows/needs-reproducible-example-comment.md +++ /dev/null @@ -1,8 +0,0 @@ -Thanks for opening this issue in the DuckDB issue tracker! To resolve this issue, our team needs a reproducible example. This includes: - -* A source code snippet which reproduces the issue. -* The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid `/Users/JohnDoe/...`). -* A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). If you can provide such an example, it greatly simplifies the reproduction process and likely results in a faster fix. -* If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortunately, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA. - -For more detailed guidelines on how to create reproducible examples, please visit Stack Overflow's [“Minimal, Reproducible Example”](https://stackoverflow.com/help/minimal-reproducible-example) page. From 22654bb445abea3394a172d7c47e7eb6a3ad885c Mon Sep 17 00:00:00 2001 From: pdet Date: Tue, 29 Oct 2024 13:19:35 +0100 Subject: [PATCH 18/19] add thijs fix --- tools/pythonpkg/tests/fast/test_replacement_scan.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/pythonpkg/tests/fast/test_replacement_scan.py b/tools/pythonpkg/tests/fast/test_replacement_scan.py index c7287bba3ffe..078c82e394ff 100644 --- a/tools/pythonpkg/tests/fast/test_replacement_scan.py +++ b/tools/pythonpkg/tests/fast/test_replacement_scan.py @@ -8,13 +8,15 @@ def using_table(con, to_scan, object_name): - exec(f"{object_name} = to_scan") - return con.table(object_name) + local_scope = {'con': con, object_name: to_scan, 'object_name': object_name} + exec(f"result = con.table(object_name)", globals(), local_scope) + return local_scope["result"] def using_sql(con, to_scan, object_name): - exec(f"{object_name} = to_scan") - return con.sql(f"select * from to_scan") + local_scope = {'con': con, object_name: to_scan, 'object_name': object_name} + exec(f"result = con.sql('select * from \"{object_name}\"')", globals(), local_scope) + return local_scope["result"] # Fetch methods From 85e9b5d202abbc52b43fb0d9d5bb5f31d45dbc4a Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Tue, 29 Oct 2024 15:19:37 +0100 Subject: [PATCH 19/19] Fix --- .github/workflows/InternalIssuesCreateMirror.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/InternalIssuesCreateMirror.yml b/.github/workflows/InternalIssuesCreateMirror.yml index 01ab31e0c117..ec3ebda90024 100644 --- a/.github/workflows/InternalIssuesCreateMirror.yml +++ b/.github/workflows/InternalIssuesCreateMirror.yml @@ -31,7 +31,7 @@ jobs: Thanks for opening this issue in the DuckDB issue tracker! To resolve this issue, our team needs a reproducible example. This includes: * A source code snippet which reproduces the issue. - * The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid \`/Users/JohnDoe/...`). + * The snippet should be self-contained, i.e., it should contain all imports and should use relative paths instead of hard coded paths (please avoid \`/Users/JohnDoe/...\`). * A lot of issues can be reproduced with plain SQL code executed in the [DuckDB command line client](https://duckdb.org/docs/api/cli/overview). If you can provide such an example, it greatly simplifies the reproduction process and likely results in a faster fix. * If the script needs additional data, please share the data as a CSV, JSON, or Parquet file. Unfortunately, we cannot fix issues that can only be reproduced with a confidential data set. [Support contracts](https://duckdblabs.com/#support) allow sharing confidential data with the core DuckDB team under NDA.