Skip to content

Commit 21b711a

Browse files
Update vendored DuckDB sources to 9612b5bea5
1 parent 50fbf79 commit 21b711a

221 files changed

Lines changed: 16441 additions & 13796 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/duckdb/extension/core_functions/lambda_functions.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ struct LambdaExecuteInfo {
2222

2323
// get the input types for the input chunk
2424
vector<LogicalType> input_types;
25+
26+
input_types.push_back(child_vector.GetType());
2527
if (has_index) {
2628
input_types.push_back(LogicalType::BIGINT);
2729
}
28-
input_types.push_back(child_vector.GetType());
2930
for (idx_t i = 1; i < args.ColumnCount(); i++) {
3031
input_types.push_back(args.data[i].GetType());
3132
}
@@ -152,8 +153,9 @@ struct ListFilterFunctor {
152153

153154
// slice the input chunk's corresponding vector to get the new lists
154155
// and append them to the result
155-
idx_t source_list_idx = execute_info.has_index ? 1 : 0;
156-
Vector result_lists(execute_info.input_chunk.data[source_list_idx], sel, count);
156+
157+
// The first vector in the input chunk is always the list vector
158+
Vector result_lists(execute_info.input_chunk.data[0], sel, count);
157159
ListVector::Append(result, result_lists, count, 0);
158160
}
159161
};
@@ -190,8 +192,8 @@ static void ExecuteExpression(const idx_t elem_cnt, const LambdaFunctions::Colum
190192

191193
// reference the child vector (and the index vector)
192194
if (info.has_index) {
193-
info.input_chunk.data[0].Reference(index_vector);
194-
info.input_chunk.data[1].Reference(slice);
195+
info.input_chunk.data[0].Reference(slice);
196+
info.input_chunk.data[1].Reference(index_vector);
195197
} else {
196198
info.input_chunk.data[0].Reference(slice);
197199
}
@@ -247,7 +249,8 @@ LogicalType LambdaFunctions::DetermineListChildType(const LogicalType &child_typ
247249
} else if (child_type.id() == LogicalTypeId::LIST) {
248250
return ListType::GetChildType(child_type);
249251
}
250-
throw InternalException("The first argument must be a list or array type");
252+
253+
throw BinderException("Invalid LIST argument during lambda function binding!");
251254
}
252255

253256
return child_type;

src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ struct ReduceExecuteInfo {
4141
}
4242
left_slice->Slice(left_vector, reduced_row_idx);
4343

44+
input_types.push_back(left_slice->GetType());
45+
input_types.push_back(left_slice->GetType());
46+
4447
if (info.has_index) {
4548
input_types.push_back(LogicalType::BIGINT);
4649
}
47-
input_types.push_back(left_slice->GetType());
48-
input_types.push_back(left_slice->GetType());
50+
4951
// skip the first entry if there is an initial value
5052
for (idx_t i = info.has_initial ? 1 : 0; i < info.column_infos.size(); i++) {
5153
input_types.push_back(info.column_infos[i].vector.get().GetType());
@@ -133,18 +135,19 @@ bool ExecuteReduce(const idx_t loops, ReduceExecuteInfo &execute_info, LambdaFun
133135
input_chunk.InitializeEmpty(execute_info.input_types);
134136
input_chunk.SetCardinality(reduced_row_idx);
135137

136-
const idx_t slice_offset = info.has_index ? 1 : 0;
137-
if (info.has_index) {
138-
input_chunk.data[0].Reference(index_vector);
139-
}
138+
idx_t vec_offset = 0;
140139

141140
if (loops == 0 && info.has_initial) {
142-
info.column_infos[0].vector.get().Slice(execute_info.active_rows_sel, reduced_row_idx);
143-
input_chunk.data[slice_offset + 1].Reference(info.column_infos[0].vector);
141+
info.column_infos[vec_offset].vector.get().Slice(execute_info.active_rows_sel, reduced_row_idx);
142+
input_chunk.data[vec_offset++].Reference(info.column_infos[0].vector);
144143
} else {
145-
input_chunk.data[slice_offset + 1].Reference(*execute_info.left_slice);
144+
input_chunk.data[vec_offset++].Reference(*execute_info.left_slice);
145+
}
146+
input_chunk.data[vec_offset++].Reference(right_slice);
147+
148+
if (info.has_index) {
149+
input_chunk.data[vec_offset++].Reference(index_vector);
146150
}
147-
input_chunk.data[slice_offset].Reference(right_slice);
148151

149152
// add the other columns
150153
// skip the initial value if there is one
@@ -153,12 +156,12 @@ bool ExecuteReduce(const idx_t loops, ReduceExecuteInfo &execute_info, LambdaFun
153156
for (idx_t i = 0; i < info.column_infos.size() - initial_offset; i++) {
154157
if (info.column_infos[i].vector.get().GetVectorType() == VectorType::CONSTANT_VECTOR) {
155158
// only reference constant vectors
156-
input_chunk.data[slice_offset + 2 + i].Reference(info.column_infos[initial_offset + i].vector);
159+
input_chunk.data[vec_offset++].Reference(info.column_infos[initial_offset + i].vector);
157160
} else {
158161
// slice the other vectors
159162
slices.emplace_back(info.column_infos[initial_offset + i].vector, execute_info.active_rows_sel,
160163
reduced_row_idx);
161-
input_chunk.data[slice_offset + 2 + i].Reference(slices.back());
164+
input_chunk.data[vec_offset++].Reference(slices.back());
162165
}
163166
}
164167

src/duckdb/extension/icu/icu-timezone.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct ICUFromNaiveTimestamp : public ICUDateFunc {
164164
if (!input.context) {
165165
throw InternalException("Missing context for TIMESTAMP to TIMESTAMPTZ cast.");
166166
}
167-
if (DBConfig::GetSetting<DisableTimestamptzCastsSetting>(*input.context)) {
167+
if (Settings::Get<DisableTimestamptzCastsSetting>(*input.context)) {
168168
throw BinderException("Casting from TIMESTAMP to TIMESTAMP WITH TIME ZONE without an explicit time zone "
169169
"has been disabled - use \"AT TIME ZONE ...\"");
170170
}
@@ -251,7 +251,7 @@ struct ICUToNaiveTimestamp : public ICUDateFunc {
251251
if (!input.context) {
252252
throw InternalException("Missing context for TIMESTAMPTZ to TIMESTAMP cast.");
253253
}
254-
if (DBConfig::GetSetting<DisableTimestamptzCastsSetting>(*input.context)) {
254+
if (Settings::Get<DisableTimestamptzCastsSetting>(*input.context)) {
255255
throw BinderException("Casting from TIMESTAMP WITH TIME ZONE to TIMESTAMP without an explicit time zone "
256256
"has been disabled - use \"AT TIME ZONE ...\"");
257257
}

src/duckdb/extension/parquet/parquet_extension.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static unique_ptr<FunctionData> ParquetWriteBind(ClientContext &context, CopyFun
340340
}
341341
}
342342
if (row_group_size_bytes_set) {
343-
if (DBConfig::GetSetting<PreserveInsertionOrderSetting>(context)) {
343+
if (Settings::Get<PreserveInsertionOrderSetting>(context)) {
344344
throw BinderException("ROW_GROUP_SIZE_BYTES does not work while preserving insertion order. Use \"SET "
345345
"preserve_insertion_order=false;\" to disable preserving insertion order.");
346346
}

src/duckdb/src/catalog/catalog.cpp

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ optional_ptr<CatalogEntry> Catalog::CreateTable(ClientContext &context, unique_p
139139

140140
optional_ptr<CatalogEntry> Catalog::CreateTable(CatalogTransaction transaction, SchemaCatalogEntry &schema,
141141
BoundCreateTableInfo &info) {
142+
auto supports_create_table = SupportsCreateTable(info);
143+
if (supports_create_table.HasError()) {
144+
supports_create_table.Throw();
145+
}
142146
return schema.CreateTable(transaction, info);
143147
}
144148

@@ -520,8 +524,7 @@ bool Catalog::TryAutoLoad(ClientContext &context, const string &original_name) n
520524
return true;
521525
}
522526
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
523-
auto &dbconfig = DBConfig::GetConfig(context);
524-
if (!dbconfig.options.autoload_known_extensions) {
527+
if (!Settings::Get<AutoloadKnownExtensionsSetting>(context)) {
525528
return false;
526529
}
527530
try {
@@ -537,8 +540,7 @@ bool Catalog::TryAutoLoad(ClientContext &context, const string &original_name) n
537540

538541
String Catalog::AutoloadExtensionByConfigName(ClientContext &context, const String &configuration_name) {
539542
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
540-
auto &dbconfig = DBConfig::GetConfig(context);
541-
if (dbconfig.options.autoload_known_extensions) {
543+
if (Settings::Get<AutoloadKnownExtensionsSetting>(context)) {
542544
auto extension_name =
543545
ExtensionHelper::FindExtensionInEntries(configuration_name.ToStdString(), EXTENSION_SETTINGS);
544546
if (ExtensionHelper::CanAutoloadExtension(extension_name)) {
@@ -594,8 +596,7 @@ static bool CompareCatalogTypes(CatalogType type_a, CatalogType type_b) {
594596

595597
bool Catalog::AutoLoadExtensionByCatalogEntry(DatabaseInstance &db, CatalogType type, const string &entry_name) {
596598
#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
597-
auto &dbconfig = DBConfig::GetConfig(db);
598-
if (dbconfig.options.autoload_known_extensions) {
599+
if (Settings::Get<AutoloadKnownExtensionsSetting>(db)) {
599600
string extension_name;
600601
if (IsAutoloadableFunction(type)) {
601602
auto lookup_result = ExtensionHelper::FindExtensionInFunctionEntries(entry_name, EXTENSION_FUNCTIONS);
@@ -640,7 +641,7 @@ CatalogException Catalog::UnrecognizedConfigurationError(ClientContext &context,
640641
// the setting is not in an extension
641642
// get a list of all options
642643
vector<string> potential_names = DBConfig::GetOptionNames();
643-
for (auto &entry : DBConfig::GetConfig(context).extension_parameters) {
644+
for (auto &entry : DBConfig::GetConfig(context).GetExtensionSettings()) {
644645
potential_names.push_back(entry.first);
645646
}
646647
throw CatalogException::MissingEntry("configuration parameter", name, potential_names);
@@ -651,7 +652,7 @@ CatalogException Catalog::CreateMissingEntryException(CatalogEntryRetriever &ret
651652
const reference_set_t<SchemaCatalogEntry> &schemas) {
652653
auto &context = retriever.GetContext();
653654
auto entries = SimilarEntriesInSchemas(context, lookup_info, schemas);
654-
auto max_schema_count = DBConfig::GetSetting<CatalogErrorMaxSchemasSetting>(context);
655+
auto max_schema_count = Settings::Get<CatalogErrorMaxSchemasSetting>(context);
655656

656657
reference_set_t<SchemaCatalogEntry> unseen_schemas;
657658
auto &db_manager = DatabaseManager::Get(context);
@@ -1211,6 +1212,25 @@ optional_ptr<DependencyManager> Catalog::GetDependencyManager() {
12111212
return nullptr;
12121213
}
12131214

1215+
ErrorData Catalog::SupportsCreateTable(BoundCreateTableInfo &info) {
1216+
auto &base = info.Base().Cast<CreateTableInfo>();
1217+
if (!base.partition_keys.empty()) {
1218+
return ErrorData(
1219+
ExceptionType::CATALOG,
1220+
StringUtil::Format("PARTITIONED BY is not supported for tables in a %s catalog", GetCatalogType()));
1221+
}
1222+
if (!base.sort_keys.empty()) {
1223+
return ErrorData(ExceptionType::CATALOG,
1224+
StringUtil::Format("SORTED BY is not supported for tables in a %s catalog", GetCatalogType()));
1225+
}
1226+
if (!base.options.empty()) {
1227+
return ErrorData(
1228+
ExceptionType::CATALOG,
1229+
StringUtil::Format("WITH clause is not supported for tables in a %s catalog", GetCatalogType()));
1230+
}
1231+
return ErrorData();
1232+
}
1233+
12141234
string Catalog::GetDefaultSchema() const {
12151235
return DEFAULT_SCHEMA;
12161236
}

src/duckdb/src/common/encryption_state.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ void EncryptionState::GenerateRandomData(data_ptr_t, idx_t) {
2929
throw NotImplementedException("EncryptionState Abstract Class is called");
3030
}
3131

32+
static constexpr EncryptionTypes::EncryptionVersion MAX_VERSION = EncryptionTypes::V0_1;
33+
3234
string EncryptionTypes::CipherToString(CipherType cipher_p) {
3335
switch (cipher_p) {
3436
case GCM:
@@ -56,6 +58,17 @@ EncryptionTypes::CipherType EncryptionTypes::StringToCipher(const string &encryp
5658
return INVALID;
5759
}
5860

61+
EncryptionTypes::EncryptionVersion EncryptionTypes::StringToVersion(const string &encryption_version_p) {
62+
if (encryption_version_p == "v0") {
63+
return V0_0;
64+
} else if (encryption_version_p == "v1") {
65+
return V0_1;
66+
} else {
67+
throw NotImplementedException("No encryption version higher then v%d is supported yet in this DuckDB version",
68+
MAX_VERSION);
69+
}
70+
}
71+
5972
string EncryptionTypes::KDFToString(KeyDerivationFunction kdf_p) {
6073
switch (kdf_p) {
6174
case SHA256:

0 commit comments

Comments
 (0)