From 97d9063a6ea4265ab7957b6e7ace01890b59e51b Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Mon, 27 Jan 2025 00:34:25 +0000 Subject: [PATCH] Update vendored DuckDB sources to c415a332 --- .../src/common/compressed_file_system.cpp | 6 +++- src/duckdb/src/common/multi_file_reader.cpp | 2 +- .../execution/index/fixed_size_allocator.cpp | 3 +- src/duckdb/src/function/table/read_csv.cpp | 3 +- .../function/table/version/pragma_version.cpp | 6 ++-- .../expression/transform_function.cpp | 28 +++++++++++++++++-- 6 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/duckdb/src/common/compressed_file_system.cpp b/src/duckdb/src/common/compressed_file_system.cpp index 7d2e2cfd..b8f032a6 100644 --- a/src/duckdb/src/common/compressed_file_system.cpp +++ b/src/duckdb/src/common/compressed_file_system.cpp @@ -11,7 +11,11 @@ CompressedFile::CompressedFile(CompressedFileSystem &fs, unique_ptr } CompressedFile::~CompressedFile() { - CompressedFile::Close(); + try { + // stream_wrapper->Close() might throw + CompressedFile::Close(); + } catch (...) { // NOLINT - cannot throw in exception + } } void CompressedFile::Initialize(bool write) { diff --git a/src/duckdb/src/common/multi_file_reader.cpp b/src/duckdb/src/common/multi_file_reader.cpp index 813d13f7..e03f667f 100644 --- a/src/duckdb/src/common/multi_file_reader.cpp +++ b/src/duckdb/src/common/multi_file_reader.cpp @@ -125,7 +125,7 @@ bool MultiFileReader::ParseOption(const string &key, const Value &val, MultiFile "'hive_types' only accepts a STRUCT('name':VARCHAR, ...), but '%s' was provided", val.type().ToString()); } - // verify that that all the children of the struct value are VARCHAR + // verify that all the children of the struct value are VARCHAR auto &children = StructValue::GetChildren(val); for (idx_t i = 0; i < children.size(); i++) { const Value &child = children[i]; diff --git a/src/duckdb/src/execution/index/fixed_size_allocator.cpp b/src/duckdb/src/execution/index/fixed_size_allocator.cpp index f026ddd9..860e45d4 100644 --- a/src/duckdb/src/execution/index/fixed_size_allocator.cpp +++ b/src/duckdb/src/execution/index/fixed_size_allocator.cpp @@ -227,8 +227,7 @@ void FixedSizeAllocator::FinalizeVacuum() { for (auto &buffer_id : vacuum_buffers) { D_ASSERT(buffers.find(buffer_id) != buffers.end()); - auto &buffer = buffers.find(buffer_id)->second; - D_ASSERT(buffer->InMemory()); + D_ASSERT(buffers.find(buffer_id)->second->InMemory()); buffers.erase(buffer_id); } vacuum_buffers.clear(); diff --git a/src/duckdb/src/function/table/read_csv.cpp b/src/duckdb/src/function/table/read_csv.cpp index db9bf4d8..e5bce226 100644 --- a/src/duckdb/src/function/table/read_csv.cpp +++ b/src/duckdb/src/function/table/read_csv.cpp @@ -374,7 +374,8 @@ void CSVComplexFilterPushdown(ClientContext &context, LogicalGet &get, FunctionD MultiFileReader().ComplexFilterPushdown(context, file_list, data.options.file_options, info, filters); if (filtered_list) { data.files = filtered_list->GetAllFiles(); - MultiFileReader::PruneReaders(data, file_list); + SimpleMultiFileList simple_filtered_list(data.files); + MultiFileReader::PruneReaders(data, simple_filtered_list); } else { data.files = file_list.GetAllFiles(); } diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index cc12550c..0edf48f5 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "4-dev4987" +#define DUCKDB_PATCH_VERSION "4-dev5006" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 1 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.1.4-dev4987" +#define DUCKDB_VERSION "v1.1.4-dev5006" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "dc4b8892e2" +#define DUCKDB_SOURCE_ID "e70015aeac" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" diff --git a/src/duckdb/src/parser/transform/expression/transform_function.cpp b/src/duckdb/src/parser/transform/expression/transform_function.cpp index d33bf00d..6684d489 100644 --- a/src/duckdb/src/parser/transform/expression/transform_function.cpp +++ b/src/duckdb/src/parser/transform/expression/transform_function.cpp @@ -1,8 +1,6 @@ #include "duckdb/common/enum_util.hpp" #include "duckdb/common/string_util.hpp" -#include "duckdb/common/to_string.hpp" #include "duckdb/parser/expression/case_expression.hpp" -#include "duckdb/parser/expression/cast_expression.hpp" #include "duckdb/parser/expression/constant_expression.hpp" #include "duckdb/parser/expression/function_expression.hpp" @@ -47,6 +45,27 @@ static inline WindowBoundary TransformFrameOption(const int frameOptions, const } } +static bool IsExcludableWindowFunction(ExpressionType type) { + switch (type) { + case ExpressionType::WINDOW_FIRST_VALUE: + case ExpressionType::WINDOW_LAST_VALUE: + case ExpressionType::WINDOW_NTH_VALUE: + case ExpressionType::WINDOW_AGGREGATE: + return true; + case ExpressionType::WINDOW_RANK_DENSE: + case ExpressionType::WINDOW_RANK: + case ExpressionType::WINDOW_PERCENT_RANK: + case ExpressionType::WINDOW_ROW_NUMBER: + case ExpressionType::WINDOW_NTILE: + case ExpressionType::WINDOW_CUME_DIST: + case ExpressionType::WINDOW_LEAD: + case ExpressionType::WINDOW_LAG: + return false; + default: + throw InternalException("Unknown excludable window type %s", ExpressionTypeToString(type).c_str()); + } +} + void Transformer::TransformWindowFrame(duckdb_libpgquery::PGWindowDef &window_spec, WindowExpression &expr) { // finally: specifics of bounds expr.start_expr = TransformExpression(window_spec.startOffset); @@ -101,6 +120,11 @@ void Transformer::TransformWindowFrame(duckdb_libpgquery::PGWindowDef &window_sp } else { expr.exclude_clause = WindowExcludeMode::NO_OTHER; } + + if (expr.exclude_clause != WindowExcludeMode::NO_OTHER && !expr.arg_orders.empty() && + !IsExcludableWindowFunction(expr.type)) { + throw ParserException("EXCLUDE is not supported for the window function \"%s\"", expr.function_name.c_str()); + } } bool Transformer::ExpressionIsEmptyStar(ParsedExpression &expr) {