Skip to content

Commit b6e3388

Browse files
committed
vendor: Update vendored sources to duckdb/duckdb@cae7a68
Pull OpenFileExtended through the opener and virtual file system layers (duckdb/duckdb#17102)
1 parent 97c3baa commit b6e3388

File tree

5 files changed

+29
-20
lines changed

5 files changed

+29
-20
lines changed

src/duckdb/src/common/virtual_file_system.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@ VirtualFileSystem::VirtualFileSystem() : default_fs(FileSystem::CreateLocal()) {
99
VirtualFileSystem::RegisterSubSystem(FileCompressionType::GZIP, make_uniq<GZipFileSystem>());
1010
}
1111

12-
unique_ptr<FileHandle> VirtualFileSystem::OpenFile(const string &path, FileOpenFlags flags,
13-
optional_ptr<FileOpener> opener) {
12+
unique_ptr<FileHandle> VirtualFileSystem::OpenFileExtended(const OpenFileInfo &file, FileOpenFlags flags,
13+
optional_ptr<FileOpener> opener) {
1414
auto compression = flags.Compression();
1515
if (compression == FileCompressionType::AUTO_DETECT) {
1616
// auto-detect compression settings based on file name
17-
auto lower_path = StringUtil::Lower(path);
17+
auto lower_path = StringUtil::Lower(file.path);
1818
if (StringUtil::EndsWith(lower_path, ".tmp")) {
1919
// strip .tmp
2020
lower_path = lower_path.substr(0, lower_path.length() - 4);
2121
}
22-
if (IsFileCompressed(path, FileCompressionType::GZIP)) {
22+
if (IsFileCompressed(file.path, FileCompressionType::GZIP)) {
2323
compression = FileCompressionType::GZIP;
24-
} else if (IsFileCompressed(path, FileCompressionType::ZSTD)) {
24+
} else if (IsFileCompressed(file.path, FileCompressionType::ZSTD)) {
2525
compression = FileCompressionType::ZSTD;
2626
} else {
2727
compression = FileCompressionType::UNCOMPRESSED;
2828
}
2929
}
3030
// open the base file handle in UNCOMPRESSED mode
3131
flags.SetCompression(FileCompressionType::UNCOMPRESSED);
32-
auto file_handle = FindFileSystem(path).OpenFile(path, flags, opener);
32+
auto file_handle = FindFileSystem(file.path).OpenFile(file, flags, opener);
3333
if (!file_handle) {
3434
return nullptr;
3535
}

src/duckdb/src/function/table/read_file.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static void ReadFileExecute(ClientContext &context, TableFunctionInput &input, D
133133

134134
// Given the columns requested, do we even need to open the file?
135135
if (state.requires_file_open) {
136-
file_handle = fs.OpenFile(file.path, FileFlags::FILE_FLAGS_READ);
136+
file_handle = fs.OpenFile(file, FileFlags::FILE_FLAGS_READ);
137137
}
138138

139139
for (idx_t col_idx = 0; col_idx < state.column_ids.size(); col_idx++) {

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-dev2454"
2+
#define DUCKDB_PATCH_VERSION "0-dev2456"
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-dev2454"
11+
#define DUCKDB_VERSION "v1.3.0-dev2456"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "93a9d9f9b5"
14+
#define DUCKDB_SOURCE_ID "cae7a680bc"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/common/opener_file_system.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ class OpenerFileSystem : public FileSystem {
2222
void VerifyCanAccessDirectory(const string &path);
2323
void VerifyCanAccessFile(const string &path);
2424

25-
unique_ptr<FileHandle> OpenFile(const string &path, FileOpenFlags flags,
26-
optional_ptr<FileOpener> opener = nullptr) override {
27-
VerifyNoOpener(opener);
28-
VerifyCanAccessFile(path);
29-
return GetFileSystem().OpenFile(path, flags, GetOpener());
30-
}
31-
3225
void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override {
3326
GetFileSystem().Read(handle, buffer, nr_bytes, location);
3427
};
@@ -152,6 +145,18 @@ class OpenerFileSystem : public FileSystem {
152145
return GetFileSystem().ListSubSystems();
153146
}
154147

148+
protected:
149+
unique_ptr<FileHandle> OpenFileExtended(const OpenFileInfo &file, FileOpenFlags flags,
150+
optional_ptr<FileOpener> opener = nullptr) override {
151+
VerifyNoOpener(opener);
152+
VerifyCanAccessFile(file.path);
153+
return GetFileSystem().OpenFile(file, flags, GetOpener());
154+
}
155+
156+
bool SupportsOpenFileExtended() const override {
157+
return true;
158+
}
159+
155160
private:
156161
void VerifyCanAccessFileInternal(const string &path, FileType type);
157162
};

src/duckdb/src/include/duckdb/common/virtual_file_system.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ class VirtualFileSystem : public FileSystem {
1919
public:
2020
VirtualFileSystem();
2121

22-
unique_ptr<FileHandle> OpenFile(const string &path, FileOpenFlags flags,
23-
optional_ptr<FileOpener> opener = nullptr) override;
24-
2522
void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override;
2623
void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override;
2724

@@ -71,6 +68,13 @@ class VirtualFileSystem : public FileSystem {
7168

7269
string PathSeparator(const string &path) override;
7370

71+
protected:
72+
unique_ptr<FileHandle> OpenFileExtended(const OpenFileInfo &file, FileOpenFlags flags,
73+
optional_ptr<FileOpener> opener) override;
74+
bool SupportsOpenFileExtended() const override {
75+
return true;
76+
}
77+
7478
private:
7579
FileSystem &FindFileSystem(const string &path);
7680
FileSystem &FindFileSystemInternal(const string &path);

0 commit comments

Comments
 (0)