Skip to content

Commit 33025dd

Browse files
duckdblabs-botgithub-actions[bot]
authored andcommitted
Update vendored DuckDB sources to acc36fbe6e
1 parent 72ad349 commit 33025dd

9 files changed

Lines changed: 35 additions & 13 deletions

File tree

src/duckdb/src/common/file_system.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,14 @@ int64_t FileHandle::Write(void *buffer, idx_t nr_bytes) {
708708
return file_system.Write(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes));
709709
}
710710

711+
int64_t FileHandle::Write(QueryContext context, void *buffer, idx_t nr_bytes) {
712+
if (context.GetClientContext() != nullptr) {
713+
context.GetClientContext()->client_data->profiler->AddBytesWritten(nr_bytes);
714+
}
715+
716+
return file_system.Write(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes));
717+
}
718+
711719
void FileHandle::Read(void *buffer, idx_t nr_bytes, idx_t location) {
712720
file_system.Read(*this, buffer, UnsafeNumericCast<int64_t>(nr_bytes), location);
713721
}

src/duckdb/src/common/gzip_file_system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void MiniZStreamWrapper::Initialize(QueryContext context, CompressedFile &file,
111111
total_size = 0;
112112

113113
MiniZStream::InitializeGZIPHeader(gzip_hdr);
114-
file.child_handle->Write(gzip_hdr, GZIP_HEADER_MINSIZE);
114+
file.child_handle->Write(context, gzip_hdr, GZIP_HEADER_MINSIZE);
115115

116116
auto ret = mz_deflateInit2(mz_stream_ptr.get(), duckdb_miniz::MZ_DEFAULT_LEVEL, MZ_DEFLATED,
117117
-MZ_DEFAULT_WINDOW_BITS, 1, 0);

src/duckdb/src/common/pipe_file_system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int64_t PipeFile::ReadChunk(void *buffer, int64_t nr_bytes) {
3232
return child_handle->Read(context, buffer, UnsafeNumericCast<idx_t>(nr_bytes));
3333
}
3434
int64_t PipeFile::WriteChunk(void *buffer, int64_t nr_bytes) {
35-
return child_handle->Write(buffer, UnsafeNumericCast<idx_t>(nr_bytes));
35+
return child_handle->Write(context, buffer, UnsafeNumericCast<idx_t>(nr_bytes));
3636
}
3737

3838
void PipeFileSystem::Reset(FileHandle &handle) {

src/duckdb/src/function/copy_blob.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "duckdb/common/vector_operations/unary_executor.hpp"
33
#include "duckdb/function/built_in_functions.hpp"
44
#include "duckdb/function/copy_function.hpp"
5+
#include "duckdb/main/client_context.hpp"
56

67
namespace duckdb {
78

@@ -99,6 +100,8 @@ void WriteBlobSink(ExecutionContext &context, FunctionData &bind_data, GlobalFun
99100
input.data[0].ToUnifiedFormat(input.size(), vdata);
100101
const auto blobs = UnifiedVectorFormat::GetData<string_t>(vdata);
101102

103+
QueryContext query_context(context.client);
104+
102105
for (idx_t row_idx = 0; row_idx < input.size(); row_idx++) {
103106
const auto out_idx = vdata.sel->get_index(row_idx);
104107
if (vdata.validity.RowIsValid(out_idx)) {
@@ -109,7 +112,7 @@ void WriteBlobSink(ExecutionContext &context, FunctionData &bind_data, GlobalFun
109112
auto blob_end = blob_ptr + blob_len;
110113

111114
while (blob_ptr < blob_end) {
112-
auto written = handle->Write(blob_ptr, blob_len);
115+
auto written = handle->Write(query_context, blob_ptr, blob_len);
113116
if (written <= 0) {
114117
throw IOException("Failed to write to file!");
115118
}

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 "4-dev123"
2+
#define DUCKDB_PATCH_VERSION "4-dev136"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 4
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.4.4-dev123"
11+
#define DUCKDB_VERSION "v1.4.4-dev136"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "686f25a362"
14+
#define DUCKDB_SOURCE_ID "acc36fbe6e"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/common/file_system.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ struct FileHandle {
6666
DUCKDB_API int64_t Read(void *buffer, idx_t nr_bytes);
6767
DUCKDB_API int64_t Read(QueryContext context, void *buffer, idx_t nr_bytes);
6868
DUCKDB_API int64_t Write(void *buffer, idx_t nr_bytes);
69+
DUCKDB_API int64_t Write(QueryContext context, void *buffer, idx_t nr_bytes);
6970
// Read at [nr_bytes] bytes into [buffer].
7071
// File offset will not be changed.
7172
DUCKDB_API void Read(void *buffer, idx_t nr_bytes, idx_t location);

src/duckdb/src/include/duckdb/planner/expression_binder/qualify_binder.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class QualifyBinder : public BaseSelectBinder {
2121

2222
protected:
2323
BindResult BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) override;
24+
bool QualifyColumnAlias(const ColumnRefExpression &colref) override;
2425

2526
private:
2627
ColumnAliasBinder column_alias_binder;

src/duckdb/src/main/extension/extension_install.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ static unsafe_unique_array<data_t> ReadExtensionFileFromDisk(FileSystem &fs, con
174174
return in_buffer;
175175
}
176176

177-
static void WriteExtensionFileToDisk(FileSystem &fs, const string &path, void *data, idx_t data_size) {
177+
static void WriteExtensionFileToDisk(QueryContext &query_context, FileSystem &fs, const string &path, void *data,
178+
idx_t data_size) {
178179
auto target_file = fs.OpenFile(path, FileFlags::FILE_FLAGS_WRITE | FileFlags::FILE_FLAGS_APPEND |
179180
FileFlags::FILE_FLAGS_FILE_CREATE_NEW);
180-
target_file->Write(data, data_size);
181+
target_file->Write(query_context, data, data_size);
181182
target_file->Close();
182183
target_file.reset();
183184
}
@@ -236,10 +237,11 @@ static void CheckExtensionMetadataOnInstall(DatabaseInstance &db, void *in_buffe
236237
// 1. Crash after extension removal: extension is now uninstalled, metadata file still present
237238
// 2. Crash after metadata removal: extension is now uninstalled, extension dir is clean
238239
// 3. Crash after extension move: extension is now uninstalled, new metadata file present
239-
static void WriteExtensionFiles(FileSystem &fs, const string &temp_path, const string &local_extension_path,
240-
void *in_buffer, idx_t file_size, ExtensionInstallInfo &info) {
240+
static void WriteExtensionFiles(QueryContext &query_context, FileSystem &fs, const string &temp_path,
241+
const string &local_extension_path, void *in_buffer, idx_t file_size,
242+
ExtensionInstallInfo &info) {
241243
// Write extension to tmp file
242-
WriteExtensionFileToDisk(fs, temp_path, in_buffer, file_size);
244+
WriteExtensionFileToDisk(query_context, fs, temp_path, in_buffer, file_size);
243245

244246
// Write metadata to tmp file
245247
auto metadata_tmp_path = temp_path + ".info";
@@ -327,7 +329,9 @@ static unique_ptr<ExtensionInstallInfo> DirectInstallExtension(DatabaseInstance
327329
info.repository_url = options.repository->path;
328330
}
329331

330-
WriteExtensionFiles(fs, temp_path, local_extension_path, extension_decompressed, extension_decompressed_size, info);
332+
QueryContext query_context(context);
333+
WriteExtensionFiles(query_context, fs, temp_path, local_extension_path, extension_decompressed,
334+
extension_decompressed_size, info);
331335

332336
return make_uniq<ExtensionInstallInfo>(info);
333337
}
@@ -416,8 +420,9 @@ static unique_ptr<ExtensionInstallInfo> InstallFromHttpUrl(DatabaseInstance &db,
416420
info.full_path = url;
417421
}
418422

423+
QueryContext query_context(context);
419424
auto fs = FileSystem::CreateLocal();
420-
WriteExtensionFiles(*fs, temp_path, local_extension_path, (void *)decompressed_body.data(),
425+
WriteExtensionFiles(query_context, *fs, temp_path, local_extension_path, (void *)decompressed_body.data(),
421426
decompressed_body.size(), info);
422427

423428
return make_uniq<ExtensionInstallInfo>(info);

src/duckdb/src/planner/expression_binder/qualify_binder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ BindResult QualifyBinder::BindColumnRef(unique_ptr<ParsedExpression> &expr_ptr,
3434
*expr_ptr, "Referenced column %s not found in FROM clause and can't find in alias map.", expr_string));
3535
}
3636

37+
bool QualifyBinder::QualifyColumnAlias(const ColumnRefExpression &colref) {
38+
return column_alias_binder.QualifyColumnAlias(colref);
39+
}
40+
3741
} // namespace duckdb

0 commit comments

Comments
 (0)