Skip to content

Commit

Permalink
Update vendored DuckDB sources to 79f8413
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdblabs-bot committed Sep 1, 2024
1 parent 79f8413 commit 0044f40
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 27 deletions.
12 changes: 6 additions & 6 deletions src/duckdb/src/execution/window_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,13 @@ static idx_t FindTypedRangeBound(const WindowInputColumn &over, const idx_t orde

// Check that the value we are searching for is in range.
if (range == WindowBoundary::EXPR_PRECEDING_RANGE) {
// Preceding but value past the end
const auto cur_val = over.GetCell<T>(order_end);
// Preceding but value past the current value
const auto cur_val = over.GetCell<T>(order_end - 1);
if (comp(cur_val, val)) {
throw OutOfRangeException("Invalid RANGE PRECEDING value");
}
} else {
// Following but value before beginning
// Following but value before the current value
D_ASSERT(range == WindowBoundary::EXPR_FOLLOWING_RANGE);
const auto cur_val = over.GetCell<T>(order_begin);
if (comp(val, cur_val)) {
Expand Down Expand Up @@ -570,7 +570,7 @@ void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn
if (boundary_start.CellIsNull(chunk_idx)) {
window_start = peer_start;
} else {
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, valid_start, row_idx,
prev.start = FindOrderedRangeBound<true>(range_collection, range_sense, valid_start, row_idx + 1,
start_boundary, boundary_start, chunk_idx, prev);
window_start = prev.start;
}
Expand Down Expand Up @@ -624,8 +624,8 @@ void WindowBoundariesState::Update(const idx_t row_idx, const WindowInputColumn
if (boundary_end.CellIsNull(chunk_idx)) {
window_end = peer_end;
} else {
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, valid_start, row_idx, end_boundary,
boundary_end, chunk_idx, prev);
prev.end = FindOrderedRangeBound<false>(range_collection, range_sense, valid_start, row_idx + 1,
end_boundary, boundary_end, chunk_idx, prev);
window_end = prev.end;
}
break;
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "1-dev5058"
#define DUCKDB_PATCH_VERSION "1-dev5071"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 0
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.0.1-dev5058"
#define DUCKDB_VERSION "v1.0.1-dev5071"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "7691b57aa1"
#define DUCKDB_SOURCE_ID "08d1b8aa03"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
11 changes: 7 additions & 4 deletions src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ class SecretManager {
//! Load a secret storage
DUCKDB_API void LoadSecretStorage(unique_ptr<SecretStorage> storage);

//! Deserialize a secret by automatically selecting the correct deserializer
DUCKDB_API unique_ptr<BaseSecret> DeserializeSecret(Deserializer &deserializer);
//! Deserialize a secret by automatically selecting the correct deserializer, secret_path can be set to improve
//! error hints
DUCKDB_API unique_ptr<BaseSecret> DeserializeSecret(Deserializer &deserializer, const string &secret_path = "");
//! Register a new SecretType
DUCKDB_API void RegisterSecretType(SecretType &type);
//! Lookup a SecretType
Expand Down Expand Up @@ -155,8 +156,10 @@ class SecretManager {
private:
//! Register a secret type
void RegisterSecretTypeInternal(SecretType &type);
//! Lookup a SecretType
//! Lookup a SecretType, throws if not found
SecretType LookupTypeInternal(const string &type);
//! Try to lookup a SecretType
bool TryLookupTypeInternal(const string &type, SecretType &type_out);
//! Register a secret provider
void RegisterSecretFunctionInternal(CreateSecretFunction function, OnCreateConflict on_conflict);
//! Lookup a CreateSecretFunction
Expand All @@ -176,7 +179,7 @@ class SecretManager {
void AutoloadExtensionForFunction(const string &type, const string &provider);

//! Will throw appropriate error message when type not found
[[noreturn]] void ThrowTypeNotFoundError(const string &type);
[[noreturn]] void ThrowTypeNotFoundError(const string &type, const string &secret_path = "");
[[noreturn]] void ThrowProviderNotFoundError(const string &type, const string &provider, bool was_default = false);

//! Thread-safe accessors for secret_storages
Expand Down
54 changes: 41 additions & 13 deletions src/duckdb/src/main/secret/secret_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,25 @@ void SecretManager::LoadSecretStorageInternal(unique_ptr<SecretStorage> storage)
}

// FIXME: use serialization scripts?
unique_ptr<BaseSecret> SecretManager::DeserializeSecret(Deserializer &deserializer) {
unique_ptr<BaseSecret> SecretManager::DeserializeSecret(Deserializer &deserializer, const string &secret_path) {
auto type = deserializer.ReadProperty<string>(100, "type");
auto provider = deserializer.ReadProperty<string>(101, "provider");
auto name = deserializer.ReadProperty<string>(102, "name");
vector<string> scope;
deserializer.ReadList(103, "scope",
[&](Deserializer::List &list, idx_t i) { scope.push_back(list.ReadElement<string>()); });

auto secret_type = LookupTypeInternal(type);
SecretType deserialized_type;
if (!TryLookupTypeInternal(type, deserialized_type)) {
ThrowTypeNotFoundError(type, secret_path);
}

if (!secret_type.deserializer) {
if (!deserialized_type.deserializer) {
throw InternalException(
"Attempted to deserialize secret type '%s' which does not have a deserialization method", type);
}

return secret_type.deserializer(deserializer, {scope, type, provider, name});
return deserialized_type.deserializer(deserializer, {scope, type, provider, name});
}

void SecretManager::RegisterSecretType(SecretType &type) {
Expand Down Expand Up @@ -415,11 +418,12 @@ void SecretManager::RegisterSecretTypeInternal(SecretType &type) {
secret_types[type.name] = type;
}

SecretType SecretManager::LookupTypeInternal(const string &type) {
bool SecretManager::TryLookupTypeInternal(const string &type, SecretType &type_out) {
unique_lock<mutex> lck(manager_lock);
auto lookup = secret_types.find(type);
if (lookup != secret_types.end()) {
return lookup->second;
type_out = lookup->second;
return true;
}

// Try autoloading
Expand All @@ -429,10 +433,19 @@ SecretType SecretManager::LookupTypeInternal(const string &type) {

lookup = secret_types.find(type);
if (lookup != secret_types.end()) {
return lookup->second;
type_out = lookup->second;
return true;
}

ThrowTypeNotFoundError(type);
return false;
}

SecretType SecretManager::LookupTypeInternal(const string &type) {
SecretType return_value;
if (!TryLookupTypeInternal(type, return_value)) {
ThrowTypeNotFoundError(type);
}
return return_value;
}

void SecretManager::RegisterSecretFunctionInternal(CreateSecretFunction function, OnCreateConflict on_conflict) {
Expand Down Expand Up @@ -534,15 +547,30 @@ void SecretManager::AutoloadExtensionForType(const string &type) {
ExtensionHelper::TryAutoloadFromEntry(*db, StringUtil::Lower(type), EXTENSION_SECRET_TYPES);
}

void SecretManager::ThrowTypeNotFoundError(const string &type) {
void SecretManager::ThrowTypeNotFoundError(const string &type, const string &secret_path) {
auto entry = ExtensionHelper::FindExtensionInEntries(StringUtil::Lower(type), EXTENSION_SECRET_TYPES);
string error_message;

if (!entry.empty() && db) {
auto error_message = "Secret type '" + type + "' does not exist, but it exists in the " + entry + " extension.";
error_message = "Secret type '" + type + "' does not exist, but it exists in the " + entry + " extension.";
error_message = ExtensionHelper::AddExtensionInstallHintToErrorMsg(*db, error_message, entry);

throw InvalidInputException(error_message);
if (!secret_path.empty()) {
error_message += "\n\nAlternatively, ";
}
} else {
error_message = StringUtil::Format("Secret type '%s' not found", type);

if (!secret_path.empty()) {
error_message += ", ";
}
}
throw InvalidInputException("Secret type '%s' not found", type);

if (!secret_path.empty()) {
error_message += StringUtil::Format("try removing the secret at path '%s'.", secret_path);
}

throw InvalidInputException(error_message);
}

void SecretManager::AutoloadExtensionForFunction(const string &type, const string &provider) {
Expand Down Expand Up @@ -617,7 +645,7 @@ unique_ptr<CatalogEntry> DefaultSecretGenerator::CreateDefaultEntryInternal(cons
BinaryDeserializer deserializer(file_reader);

deserializer.Begin();
auto deserialized_secret = secret_manager.DeserializeSecret(deserializer);
auto deserialized_secret = secret_manager.DeserializeSecret(deserializer, secret_path);
deserializer.End();

auto entry = make_uniq<SecretCatalogEntry>(std::move(deserialized_secret), catalog);
Expand Down
2 changes: 1 addition & 1 deletion src/duckdb/src/parser/parsed_data/create_index_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace duckdb {

CreateIndexInfo::CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
CreateIndexInfo::CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY, INVALID_SCHEMA) {
}

CreateIndexInfo::CreateIndexInfo(const duckdb::CreateIndexInfo &info)
Expand Down

0 comments on commit 0044f40

Please sign in to comment.