forked from duckdb/duckdb-wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from monolithical patch to multiple patches
- Loading branch information
Showing
5 changed files
with
109 additions
and
91 deletions.
There are no files selected for viewing
91 changes: 0 additions & 91 deletions
91
duckdb_patches/duckdb.patch → ...db_patches/extension_install_rework.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/src/include/duckdb/common/file_open_flags.hpp b/src/include/duckdb/common/file_open_flags.hpp | ||
index d0509a214b..1b5107e849 100644 | ||
--- a/src/include/duckdb/common/file_open_flags.hpp | ||
+++ b/src/include/duckdb/common/file_open_flags.hpp | ||
@@ -100,8 +100,9 @@ public: | ||
return flags & FILE_FLAGS_PARALLEL_ACCESS; | ||
} | ||
|
||
-private: | ||
idx_t flags = 0; | ||
+ | ||
+private: | ||
FileLockType lock = FileLockType::NO_LOCK; | ||
FileCompressionType compression = FileCompressionType::UNCOMPRESSED; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp | ||
index 27160adc3f..f3dfc7441b 100644 | ||
--- a/src/common/file_system.cpp | ||
+++ b/src/common/file_system.cpp | ||
@@ -623,9 +623,14 @@ FileType FileHandle::GetType() { | ||
} | ||
|
||
bool FileSystem::IsRemoteFile(const string &path) { | ||
- const string prefixes[] = {"http://", "https://", "s3://", "s3a://", "s3n://", "gcs://", "gs://", "r2://", "hf://"}; | ||
- for (auto &prefix : prefixes) { | ||
- if (StringUtil::StartsWith(path, prefix)) { | ||
+ string extension = ""; | ||
+ return IsRemoteFile(path, extension); | ||
+} | ||
+ | ||
+bool FileSystem::IsRemoteFile(const string &path, string &extension) { | ||
+ for (const auto &entry : EXTENSION_FILE_PREFIXES) { | ||
+ if (StringUtil::StartsWith(path, entry.name)) { | ||
+ extension = entry.extension; | ||
return true; | ||
} | ||
} | ||
diff --git a/src/execution/operator/schema/physical_attach.cpp b/src/execution/operator/schema/physical_attach.cpp | ||
index 2c2b76a0fc..2d835441c2 100644 | ||
--- a/src/execution/operator/schema/physical_attach.cpp | ||
+++ b/src/execution/operator/schema/physical_attach.cpp | ||
@@ -96,6 +96,25 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c | ||
} | ||
} | ||
|
||
+ string extension = ""; | ||
+ if (FileSystem::IsRemoteFile(path, extension)) { | ||
+ if (!ExtensionHelper::TryAutoLoadExtension(context.client, extension)) { | ||
+ throw MissingExtensionException("Attaching path '%s' requires extension '%s' to be loaded", path, | ||
+ extension); | ||
+ } | ||
+ if (access_mode == AccessMode::AUTOMATIC) { | ||
+ // Attaching of remote files gets bumped to READ_ONLY | ||
+ // This is due to the fact that on most (all?) remote files writes to DB are not available | ||
+ // and having this raised later is not super helpful | ||
+ access_mode = AccessMode::READ_ONLY; | ||
+ } | ||
+ if (access_mode == AccessMode::READ_WRITE) { | ||
+ auto attached_mode = EnumUtil::ToString(access_mode); | ||
+ throw BinderException("Remote database \"%s\" can't be attached in %s mode", | ||
+ name, attached_mode); | ||
+ } | ||
+ } | ||
+ | ||
// get the database type and attach the database | ||
db_manager.GetDatabaseType(context.client, db_type, *info, config, unrecognized_option); | ||
auto attached_db = db_manager.AttachDatabase(context.client, *info, db_type, access_mode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/extension/json/CMakeLists.txt b/extension/json/CMakeLists.txt | ||
index 4101111df8..3e035e80d3 100644 | ||
--- a/extension/json/CMakeLists.txt | ||
+++ b/extension/json/CMakeLists.txt | ||
@@ -34,6 +34,7 @@ set(JSON_EXTENSION_FILES | ||
build_static_extension(json ${JSON_EXTENSION_FILES}) | ||
set(PARAMETERS "-warnings") | ||
build_loadable_extension(json ${PARAMETERS} ${JSON_EXTENSION_FILES}) | ||
+target_link_libraries(json_loadable_extension duckdb_yyjson) | ||
|
||
install( | ||
TARGETS json_extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/src/execution/operator/schema/physical_attach.cpp b/src/execution/operator/schema/physical_attach.cpp | ||
index 2c2b76a0fc..2d835441c2 100644 | ||
--- a/src/execution/operator/schema/physical_attach.cpp | ||
+++ b/src/execution/operator/schema/physical_attach.cpp | ||
@@ -96,6 +96,25 @@ SourceResultType PhysicalAttach::GetData(ExecutionContext &context, DataChunk &c | ||
} | ||
} | ||
|
||
+ string extension = ""; | ||
+ if (FileSystem::IsRemoteFile(path, extension)) { | ||
+ if (!ExtensionHelper::TryAutoLoadExtension(context.client, extension)) { | ||
+ throw MissingExtensionException("Attaching path '%s' requires extension '%s' to be loaded", path, | ||
+ extension); | ||
+ } | ||
+ if (access_mode == AccessMode::AUTOMATIC) { | ||
+ // Attaching of remote files gets bumped to READ_ONLY | ||
+ // This is due to the fact that on most (all?) remote files writes to DB are not available | ||
+ // and having this raised later is not super helpful | ||
+ access_mode = AccessMode::READ_ONLY; | ||
+ } | ||
+ if (access_mode == AccessMode::READ_WRITE) { | ||
+ auto attached_mode = EnumUtil::ToString(access_mode); | ||
+ throw BinderException("Remote database \"%s\" can't be attached in %s mode", | ||
+ name, attached_mode); | ||
+ } | ||
+ } | ||
+ | ||
// get the database type and attach the database | ||
db_manager.GetDatabaseType(context.client, db_type, *info, config, unrecognized_option); | ||
auto attached_db = db_manager.AttachDatabase(context.client, *info, db_type, access_mode); |