Skip to content

Commit 1c8db4f

Browse files
duckdblabs-botgithub-actions[bot]
authored andcommitted
Update vendored DuckDB sources to 396c86228b
1 parent 4e07810 commit 1c8db4f

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

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 "2-dev284"
2+
#define DUCKDB_PATCH_VERSION "2-dev291"
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.2-dev284"
11+
#define DUCKDB_VERSION "v1.4.2-dev291"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "7ce99bc041"
14+
#define DUCKDB_SOURCE_ID "396c86228b"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/common/http_util.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "duckdb/common/types.hpp"
1212
#include "duckdb/common/case_insensitive_map.hpp"
1313
#include "duckdb/common/enums/http_status_code.hpp"
14+
#include "duckdb/common/types/timestamp.hpp"
1415
#include <functional>
1516

1617
namespace duckdb {
@@ -143,6 +144,11 @@ struct BaseRequest {
143144
//! Whether or not to return failed requests (instead of throwing)
144145
bool try_request = false;
145146

147+
// Requests will optionally contain their timings
148+
bool have_request_timing = false;
149+
timestamp_t request_start;
150+
timestamp_t request_end;
151+
146152
template <class TARGET>
147153
TARGET &Cast() {
148154
return reinterpret_cast<TARGET &>(*this);

src/duckdb/src/logging/log_types.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ LogicalType HTTPLogType::GetLogType() {
5959
child_list_t<LogicalType> request_child_list = {
6060
{"type", LogicalType::VARCHAR},
6161
{"url", LogicalType::VARCHAR},
62+
{"start_time", LogicalType::TIMESTAMP_TZ},
63+
{"duration_ms", LogicalType::BIGINT},
6264
{"headers", LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)},
6365
};
6466
auto request_type = LogicalType::STRUCT(request_child_list);
@@ -91,7 +93,10 @@ string HTTPLogType::ConstructLogMessage(BaseRequest &request, optional_ptr<HTTPR
9193
{"type", Value(EnumUtil::ToString(request.type))},
9294
{"url", Value(request.url)},
9395
{"headers", CreateHTTPHeadersValue(request.headers)},
94-
};
96+
{"start_time", request.have_request_timing ? Value::TIMESTAMP(request.request_start) : Value()},
97+
{"duration_ms", request.have_request_timing ? Value::BIGINT(Timestamp::GetEpochMs(request.request_end) -
98+
Timestamp::GetEpochMs(request.request_start))
99+
: Value()}};
95100
auto request_value = Value::STRUCT(request_child_list);
96101
Value response_value;
97102
if (response) {

src/duckdb/src/main/http/http_util.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,27 @@ unique_ptr<HTTPResponse> HTTPUtil::SendRequest(BaseRequest &request, unique_ptr<
228228

229229
std::function<unique_ptr<HTTPResponse>(void)> on_request([&]() {
230230
unique_ptr<HTTPResponse> response;
231+
232+
// When logging is enabled, we collect request timings
233+
if (request.params.logger) {
234+
request.have_request_timing = request.params.logger->ShouldLog(HTTPLogType::NAME, HTTPLogType::LEVEL);
235+
}
236+
231237
try {
238+
if (request.have_request_timing) {
239+
request.request_start = Timestamp::GetCurrentTimestamp();
240+
}
232241
response = client->Request(request);
233242
} catch (...) {
243+
if (request.have_request_timing) {
244+
request.request_end = Timestamp::GetCurrentTimestamp();
245+
}
234246
LogRequest(request, nullptr);
235247
throw;
236248
}
249+
if (request.have_request_timing) {
250+
request.request_end = Timestamp::GetCurrentTimestamp();
251+
}
237252
LogRequest(request, response ? response.get() : nullptr);
238253
return response;
239254
});

src/duckdb/src/parser/transform/expression/transform_cast.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ unique_ptr<ParsedExpression> Transformer::TransformTypeCast(duckdb_libpgquery::P
2121
parameters.query_location = NumericCast<idx_t>(root.location);
2222
}
2323
auto blob_data = Blob::ToBlob(string(c->val.val.str), parameters);
24-
return make_uniq<ConstantExpression>(Value::BLOB_RAW(blob_data));
24+
auto result = make_uniq<ConstantExpression>(Value::BLOB_RAW(blob_data));
25+
SetQueryLocation(*result, root.location);
26+
return std::move(result);
2527
}
2628
}
2729
// transform the expression node

0 commit comments

Comments
 (0)