Skip to content

Commit 577a55d

Browse files
authored
Merge pull request #110 from Tmonster/fix-v1.4-andium
Merge main into v1.4-andium
2 parents c31f9e9 + c5ad14f commit 577a55d

16 files changed

+272
-56
lines changed

duckdb

Submodule duckdb updated 1398 files

extension/httpfs/create_secret_functions.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,13 @@ unique_ptr<BaseSecret> CreateS3SecretFunctions::CreateSecretFunctionInternal(Cli
111111
} else if (lower_name == "requester_pays") {
112112
if (named_param.second.type() != LogicalType::BOOLEAN) {
113113
throw InvalidInputException("Invalid type past to secret option: '%s', found '%s', expected: 'BOOLEAN'",
114-
lower_name, named_param.second.type().ToString());
114+
lower_name, named_param.second.type().ToString());
115115
}
116116
secret->secret_map["requester_pays"] = Value::BOOLEAN(named_param.second.GetValue<bool>());
117+
} else if (lower_name == "bearer_token" && input.type == "gcs") {
118+
secret->secret_map["bearer_token"] = named_param.second.ToString();
119+
// Mark it as sensitive
120+
secret->redact_keys.insert("bearer_token");
117121
} else {
118122
throw InvalidInputException("Unknown named parameter passed to CreateSecretFunctionInternal: " +
119123
lower_name);
@@ -191,7 +195,7 @@ void CreateS3SecretFunctions::SetBaseNamedParams(CreateSecretFunction &function,
191195
function.named_parameters["use_ssl"] = LogicalType::BOOLEAN;
192196
function.named_parameters["kms_key_id"] = LogicalType::VARCHAR;
193197
function.named_parameters["url_compatibility_mode"] = LogicalType::BOOLEAN;
194-
function.named_parameters["requester_pays"] = LogicalType::BOOLEAN;
198+
function.named_parameters["requester_pays"] = LogicalType::BOOLEAN;
195199

196200
// Whether a secret refresh attempt should be made when the secret appears to be incorrect
197201
function.named_parameters["refresh"] = LogicalType::VARCHAR;
@@ -210,6 +214,10 @@ void CreateS3SecretFunctions::SetBaseNamedParams(CreateSecretFunction &function,
210214
if (type == "r2") {
211215
function.named_parameters["account_id"] = LogicalType::VARCHAR;
212216
}
217+
218+
if (type == "gcs") {
219+
function.named_parameters["bearer_token"] = LogicalType::VARCHAR;
220+
}
213221
}
214222

215223
void CreateS3SecretFunctions::RegisterCreateSecretFunction(ExtensionLoader &loader, string type) {

extension/httpfs/httpfs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ unique_ptr<HTTPResponse> HTTPFileSystem::GetRangeRequest(FileHandle &handle, str
263263
HTTPFileHandle::HTTPFileHandle(FileSystem &fs, const OpenFileInfo &file, FileOpenFlags flags,
264264
unique_ptr<HTTPParams> params_p)
265265
: FileHandle(fs, file.path, flags), params(std::move(params_p)), http_params(params->Cast<HTTPFSParams>()),
266-
flags(flags), length(0), force_full_download(false), buffer_available(0), buffer_idx(0), file_offset(0), buffer_start(0), buffer_end(0) {
266+
flags(flags), length(0), force_full_download(false), buffer_available(0), buffer_idx(0), file_offset(0),
267+
buffer_start(0), buffer_end(0) {
267268
// check if the handle has extended properties that can be set directly in the handle
268269
// if we have these properties we don't need to do a head request to obtain them later
269270
if (file.extended_info) {

extension/httpfs/httpfs_client_wasm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ unique_ptr<HTTPClient> HTTPFSUtil::InitializeClient(HTTPParams &http_params, con
99

1010
unordered_map<string, string> HTTPFSUtil::ParseGetParameters(const string &text) {
1111
unordered_map<string, string> result;
12-
//TODO: HTTPFSUtil::ParseGetParameters is currently not implemented
12+
// TODO: HTTPFSUtil::ParseGetParameters is currently not implemented
1313
return result;
1414
}
1515

extension/httpfs/httpfs_extension.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
namespace duckdb {
1313

1414
static void SetHttpfsClientImplementation(DBConfig &config, const string &value) {
15-
if (config.http_util && config.http_util->GetName() == "WasmHTTPUtils") {
16-
if (value == "wasm" || value == "default") {
17-
// Already handled, do not override
18-
return;
19-
}
20-
throw InvalidInputException("Unsupported option for httpfs_client_implementation, only `wasm` and "
21-
"`default` are currently supported for duckdb-wasm");
22-
}
23-
if (value == "httplib" || value == "default") {
24-
if (!config.http_util || config.http_util->GetName() != "HTTPFSUtil") {
25-
config.http_util = make_shared_ptr<HTTPFSUtil>();
26-
}
15+
if (config.http_util && config.http_util->GetName() == "WasmHTTPUtils") {
16+
if (value == "wasm" || value == "default") {
17+
// Already handled, do not override
2718
return;
2819
}
29-
throw InvalidInputException("Unsupported option for httpfs_client_implementation, only `curl`, `httplib` and "
30-
"`default` are currently supported");
20+
throw InvalidInputException("Unsupported option for httpfs_client_implementation, only `wasm` and "
21+
"`default` are currently supported for duckdb-wasm");
22+
}
23+
if (value == "httplib" || value == "default") {
24+
if (!config.http_util || config.http_util->GetName() != "HTTPFSUtil") {
25+
config.http_util = make_shared_ptr<HTTPFSUtil>();
26+
}
27+
return;
3128
}
29+
throw InvalidInputException("Unsupported option for httpfs_client_implementation, only `curl`, `httplib` and "
30+
"`default` are currently supported");
31+
}
3232

3333
static void LoadInternal(ExtensionLoader &loader) {
3434
auto &instance = loader.GetDatabaseInstance();

extension/httpfs/include/s3fs.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ struct S3AuthParams {
3030
string url_style;
3131
bool use_ssl = true;
3232
bool s3_url_compatibility_mode = false;
33-
bool requester_pays = false;
33+
bool requester_pays = false;
34+
string oauth2_bearer_token; // OAuth2 bearer token for GCS
3435

3536
static S3AuthParams ReadFrom(optional_ptr<FileOpener> opener, FileOpenerInfo &info);
3637
};
@@ -46,7 +47,6 @@ struct AWSEnvironmentCredentialsProvider {
4647
static constexpr const char *DUCKDB_KMS_KEY_ID_ENV_VAR = "DUCKDB_S3_KMS_KEY_ID";
4748
static constexpr const char *DUCKDB_REQUESTER_PAYS_ENV_VAR = "DUCKDB_S3_REQUESTER_PAYS";
4849

49-
5050
explicit AWSEnvironmentCredentialsProvider(DBConfig &config) : config(config) {};
5151

5252
DBConfig &config;
@@ -228,6 +228,7 @@ class S3FileSystem : public HTTPFileSystem {
228228

229229
static string GetS3BadRequestError(S3AuthParams &s3_auth_params);
230230
static string GetS3AuthError(S3AuthParams &s3_auth_params);
231+
static string GetGCSAuthError(S3AuthParams &s3_auth_params);
231232
static HTTPException GetS3Error(S3AuthParams &s3_auth_params, const HTTPResponse &response, const string &url);
232233

233234
protected:

0 commit comments

Comments
 (0)