Skip to content

Commit 79abe8f

Browse files
committed
vendor: Update vendored sources to duckdb/duckdb@0fc27e2
Expressions in create secret (duckdb/duckdb#15801)
1 parent 272aa7e commit 79abe8f

File tree

13 files changed

+16149
-16054
lines changed

13 files changed

+16149
-16054
lines changed

src/duckdb/src/execution/operator/helper/physical_create_secret.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SourceResultType PhysicalCreateSecret::GetData(ExecutionContext &context, DataCh
1010
auto &client = context.client;
1111
auto &secret_manager = SecretManager::Get(client);
1212

13-
secret_manager.CreateSecret(client, info);
13+
secret_manager.CreateSecret(client, create_input);
1414

1515
chunk.SetValue(0, 0, true);
1616
chunk.SetCardinality(1);

src/duckdb/src/execution/physical_plan/plan_create_secret.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace duckdb {
66

77
PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalCreateSecret &op) {
8-
return Make<PhysicalCreateSecret>(op.info, op.estimated_cardinality);
8+
return Make<PhysicalCreateSecret>(op.secret_input, op.estimated_cardinality);
99
}
1010

1111
} // namespace duckdb

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev1945"
2+
#define DUCKDB_PATCH_VERSION "0-dev1955"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 3
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.3.0-dev1945"
11+
#define DUCKDB_VERSION "v1.3.0-dev1955"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "a0c8127fe6"
14+
#define DUCKDB_SOURCE_ID "0fc27e253f"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/execution/operator/helper/physical_create_secret.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#pragma once
1010

1111
#include "duckdb/execution/physical_operator.hpp"
12-
#include "duckdb/parser/parsed_data/create_secret_info.hpp"
12+
#include "duckdb/main/secret/secret.hpp"
1313

1414
namespace duckdb {
1515

@@ -19,12 +19,12 @@ class PhysicalCreateSecret : public PhysicalOperator {
1919
static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::CREATE_SECRET;
2020

2121
public:
22-
PhysicalCreateSecret(CreateSecretInfo info_p, idx_t estimated_cardinality)
22+
PhysicalCreateSecret(CreateSecretInput input_p, idx_t estimated_cardinality)
2323
: PhysicalOperator(PhysicalOperatorType::CREATE_SECRET, {LogicalType::BOOLEAN}, estimated_cardinality),
24-
info(std::move(info_p)) {
24+
create_input(std::move(input_p)) {
2525
}
2626

27-
CreateSecretInfo info;
27+
CreateSecretInput create_input;
2828

2929
public:
3030
// Source interface

src/duckdb/src/include/duckdb/main/secret/secret.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace duckdb {
1717
class BaseSecret;
1818
struct SecretEntry;
1919
struct FileOpenerInfo;
20+
struct CreateSecretInfo;
2021

2122
//! Whether a secret is persistent or temporary
2223
enum class SecretPersistType : uint8_t { DEFAULT, TEMPORARY, PERSISTENT };
@@ -35,6 +36,10 @@ struct CreateSecretInput {
3536
vector<string> scope;
3637
//! (optional) named parameter map, each create secret function has defined it's own set of these
3738
case_insensitive_map_t<Value> options;
39+
//! how to handle conflicts
40+
OnCreateConflict on_conflict;
41+
//! persistence of secret
42+
SecretPersistType persist_type;
3843
};
3944

4045
typedef unique_ptr<BaseSecret> (*secret_deserializer_t)(Deserializer &deserializer, BaseSecret base_secret);

src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ class SecretManager {
119119
unique_ptr<const BaseSecret> secret, OnCreateConflict on_conflict,
120120
SecretPersistType persist_type, const string &storage = "");
121121
//! Create a secret from a CreateSecretInfo
122-
DUCKDB_API unique_ptr<SecretEntry> CreateSecret(ClientContext &context, const CreateSecretInfo &info);
122+
DUCKDB_API unique_ptr<SecretEntry> CreateSecret(ClientContext &context, const CreateSecretInput &info);
123123
//! The Bind for create secret is done by the secret manager
124-
DUCKDB_API BoundStatement BindCreateSecret(CatalogTransaction transaction, CreateSecretInfo &info);
124+
DUCKDB_API BoundStatement BindCreateSecret(CatalogTransaction transaction, CreateSecretInput &info);
125125
//! Lookup the best matching secret by matching the secret scopes to the path
126126
DUCKDB_API SecretMatch LookupSecret(CatalogTransaction transaction, const string &path, const string &type);
127127
//! Get a secret by name, optionally from a specific storage

src/duckdb/src/include/duckdb/parser/parsed_data/create_secret_info.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,25 @@ struct CreateSecretInfo : public CreateInfo { // NOLINT: work-around bug in clan
2424

2525
public:
2626
explicit CreateSecretInfo(OnCreateConflict on_conflict, SecretPersistType persist_type);
27+
~CreateSecretInfo() override;
28+
2729
//! How to handle conflict
2830
OnCreateConflict on_conflict;
2931
//! Whether the secret can be persisted
3032
SecretPersistType persist_type;
3133
//! The type of secret
32-
string type;
34+
unique_ptr<ParsedExpression> type;
3335
//! Which storage to use (empty for default)
3436
string storage_type;
3537
//! (optionally) the provider of the secret credentials
36-
string provider;
38+
unique_ptr<ParsedExpression> provider;
3739
//! (optionally) the name of the secret
3840
string name;
3941
//! (optionally) the scope of the secret
40-
vector<string> scope;
42+
unique_ptr<ParsedExpression> scope;
4143
//! Named parameter list (if any)
42-
case_insensitive_map_t<Value> options;
44+
case_insensitive_map_t<unique_ptr<ParsedExpression>> options;
4345

4446
unique_ptr<CreateInfo> Copy() const override;
4547
};
46-
4748
} // namespace duckdb

src/duckdb/src/include/duckdb/planner/operator/logical_create_secret.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ class LogicalCreateSecret : public LogicalOperator {
1919
static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_CREATE_SECRET;
2020

2121
public:
22-
explicit LogicalCreateSecret(CreateSecretInfo info_p)
23-
: LogicalOperator(LogicalOperatorType::LOGICAL_CREATE_SECRET), info(std::move(info_p)) {
22+
explicit LogicalCreateSecret(CreateSecretInput secret_input_p)
23+
: LogicalOperator(LogicalOperatorType::LOGICAL_CREATE_SECRET), secret_input(std::move(secret_input_p)) {
2424
}
2525

26-
CreateSecretInfo info;
26+
CreateSecretInput secret_input;
2727

2828
public:
2929
idx_t EstimateCardinality(ClientContext &context) override {

src/duckdb/src/main/secret/secret_manager.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ optional_ptr<CreateSecretFunction> SecretManager::LookupFunctionInternal(const s
225225
return nullptr;
226226
}
227227

228-
unique_ptr<SecretEntry> SecretManager::CreateSecret(ClientContext &context, const CreateSecretInfo &info) {
228+
unique_ptr<SecretEntry> SecretManager::CreateSecret(ClientContext &context, const CreateSecretInput &input) {
229229
// Note that a context is required for CreateSecret, as the CreateSecretFunction expects one
230230
auto transaction = CatalogTransaction::GetSystemCatalogTransaction(context);
231231
InitializeSecrets(transaction);
232232

233233
// Make a copy to set the provider to default if necessary
234-
CreateSecretInput function_input {info.type, info.provider, info.storage_type, info.name, info.scope, info.options};
234+
auto function_input = input;
235235
if (function_input.provider.empty()) {
236236
auto secret_type = LookupTypeInternal(function_input.type);
237237
function_input.provider = secret_type.default_provider;
@@ -240,23 +240,23 @@ unique_ptr<SecretEntry> SecretManager::CreateSecret(ClientContext &context, cons
240240
// Lookup function
241241
auto function_lookup = LookupFunctionInternal(function_input.type, function_input.provider);
242242
if (!function_lookup) {
243-
ThrowProviderNotFoundError(info.type, info.provider);
243+
ThrowProviderNotFoundError(input.type, input.provider);
244244
}
245245

246246
// Call the function
247247
auto secret = function_lookup->function(context, function_input);
248248

249249
if (!secret) {
250250
throw InternalException("CreateSecretFunction for type: '%s' and provider: '%s' did not return a secret!",
251-
info.type, info.provider);
251+
input.type, input.provider);
252252
}
253253

254254
// Register the secret at the secret_manager
255-
return RegisterSecretInternal(transaction, std::move(secret), info.on_conflict, info.persist_type,
256-
info.storage_type);
255+
return RegisterSecretInternal(transaction, std::move(secret), input.on_conflict, input.persist_type,
256+
input.storage_type);
257257
}
258258

259-
BoundStatement SecretManager::BindCreateSecret(CatalogTransaction transaction, CreateSecretInfo &info) {
259+
BoundStatement SecretManager::BindCreateSecret(CatalogTransaction transaction, CreateSecretInput &info) {
260260
InitializeSecrets(transaction);
261261

262262
auto type = info.type;

src/duckdb/src/parser/parsed_data/create_secret_info.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "duckdb/parser/parsed_data/create_secret_info.hpp"
2-
2+
#include "duckdb/parser/parsed_expression.hpp"
33
#include "duckdb/parser/parsed_data/create_info.hpp"
44

55
namespace duckdb {
@@ -8,14 +8,29 @@ CreateSecretInfo::CreateSecretInfo(OnCreateConflict on_conflict, SecretPersistTy
88
: CreateInfo(CatalogType::SECRET_ENTRY), on_conflict(on_conflict), persist_type(persist_type), options() {
99
}
1010

11+
CreateSecretInfo::~CreateSecretInfo() {
12+
}
13+
1114
unique_ptr<CreateInfo> CreateSecretInfo::Copy() const {
1215
auto result = make_uniq<CreateSecretInfo>(on_conflict, persist_type);
13-
result->type = type;
16+
1417
result->storage_type = storage_type;
15-
result->provider = provider;
1618
result->name = name;
17-
result->scope = scope;
18-
result->options = options;
19+
20+
if (type) {
21+
result->type = type->Copy();
22+
}
23+
if (provider) {
24+
result->provider = provider->Copy();
25+
}
26+
if (scope) {
27+
result->scope = scope->Copy();
28+
}
29+
30+
for (const auto &option : options) {
31+
result->options.insert({option.first, option.second->Copy()});
32+
}
33+
1934
return std::move(result);
2035
}
2136

0 commit comments

Comments
 (0)