Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,12 @@ struct BaseModeFunction {
}

template <class STATE, class OP>
static void Combine(const STATE &source, STATE &target, AggregateInputData &) {
static void Combine(const STATE &source, STATE &target, AggregateInputData &aggr_input_data) {
if (!source.frequency_map) {
return;
}
if (!target.frequency_map) {
// Copy - don't destroy! Otherwise windowing will break.
target.frequency_map = new typename STATE::Counts(*source.frequency_map);
target.count = source.count;
return;
target.frequency_map = TYPE_OP::CreateEmpty(aggr_input_data.allocator);
}
for (auto &val : *source.frequency_map) {
auto &i = (*target.frequency_map)[val.first];
Expand Down
4 changes: 2 additions & 2 deletions src/duckdb/src/function/table/arrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ static bool CanPushdown(const ArrowType &type) {
case LogicalTypeId::UBIGINT:
case LogicalTypeId::FLOAT:
case LogicalTypeId::DOUBLE:
case LogicalTypeId::VARCHAR:
return true;
case LogicalTypeId::VARCHAR:
case LogicalTypeId::BLOB:
// PyArrow doesn't support binary view filters yet
// PyArrow doesn't support binary and string view filters yet
return type.GetTypeInfo<ArrowStringInfo>().GetSizeType() != ArrowVariableSizeType::VIEW;
case LogicalTypeId::DECIMAL: {
switch (duck_type.InternalType()) {
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "4-dev17"
#define DUCKDB_PATCH_VERSION "4-dev34"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 4
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.4.4-dev17"
#define DUCKDB_VERSION "v1.4.4-dev34"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "1c03ec0812"
#define DUCKDB_SOURCE_ID "6e4e3391db"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
10 changes: 7 additions & 3 deletions src/duckdb/src/function/window/window_value_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,11 @@ void WindowFirstValueExecutor::EvaluateInternal(ExecutionContext &context, DataC
if (frame_width) {
const auto first_idx = gvstate.value_tree->SelectNth(frames, 0);
D_ASSERT(first_idx.second == 0);
cursor.CopyCell(0, first_idx.first, result, i);
if (first_idx.first < cursor.Count()) {
cursor.CopyCell(0, first_idx.first, result, i);
} else {
FlatVector::SetNull(result, i, true);
}
} else {
FlatVector::SetNull(result, i, true);
}
Expand Down Expand Up @@ -522,7 +526,7 @@ void WindowLastValueExecutor::EvaluateInternal(ExecutionContext &context, DataCh
n -= last_idx.second;
last_idx = gvstate.value_tree->SelectNth(frames, n);
}
if (last_idx.second) {
if (last_idx.second || last_idx.first >= cursor.Count()) {
// No last value - give up.
FlatVector::SetNull(result, i, true);
} else {
Expand Down Expand Up @@ -592,7 +596,7 @@ void WindowNthValueExecutor::EvaluateInternal(ExecutionContext &context, DataChu

if (n < frame_width) {
const auto nth_index = gvstate.value_tree->SelectNth(frames, n - 1);
if (nth_index.second) {
if (nth_index.second || nth_index.first >= cursor.Count()) {
// Past end of frame
FlatVector::SetNull(result, i, true);
} else {
Expand Down
5 changes: 5 additions & 0 deletions src/duckdb/src/include/duckdb/execution/merge_sort_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ struct MergeSortTree {
using RunElements = array<RunElement, F>;
using Games = array<RunElement, F - 1>;

static constexpr ElementType INVALID = std::numeric_limits<ElementType>::max();

struct CompareElements {
explicit CompareElements(const CMP &cmp) : cmp(cmp) {
}
Expand Down Expand Up @@ -122,6 +124,9 @@ struct MergeSortTree {
pair<idx_t, idx_t> SelectNth(const SubFrames &frames, idx_t n) const;

inline ElementType NthElement(idx_t i) const {
if (tree.empty() || tree.front().first.empty()) {
return INVALID;
}
return tree.front().first[i];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class WindowCursor {
WindowCursor(const WindowCollection &paged, column_t col_idx);
WindowCursor(const WindowCollection &paged, vector<column_t> column_ids);

//! The row count of the paged collection
idx_t Count() const {
return paged.size();
}
//! Is the scan in range?
inline bool RowIsVisible(idx_t row_idx) const {
return (row_idx < state.next_row_index && state.current_row_index <= row_idx);
Expand Down