duckdb 0.6.2-dev939.0 → 0.6.2-dev960.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb/src/common/types/column_data_allocator.cpp +14 -0
- package/src/duckdb/src/common/types/column_data_collection.cpp +3 -0
- package/src/duckdb/src/execution/window_segment_tree.cpp +0 -17
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +22 -0
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +1 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/column_data_allocator.hpp +1 -0
- package/src/duckdb/third_party/httplib/httplib.hpp +3 -1
package/package.json
CHANGED
|
@@ -28,6 +28,20 @@ ColumnDataAllocator::ColumnDataAllocator(ClientContext &context, ColumnDataAlloc
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
ColumnDataAllocator::ColumnDataAllocator(ColumnDataAllocator &other) {
|
|
32
|
+
type = other.GetType();
|
|
33
|
+
switch (type) {
|
|
34
|
+
case ColumnDataAllocatorType::BUFFER_MANAGER_ALLOCATOR:
|
|
35
|
+
alloc.allocator = other.alloc.allocator;
|
|
36
|
+
break;
|
|
37
|
+
case ColumnDataAllocatorType::IN_MEMORY_ALLOCATOR:
|
|
38
|
+
alloc.buffer_manager = other.alloc.buffer_manager;
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
throw InternalException("Unrecognized column data allocator type");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
31
45
|
BufferHandle ColumnDataAllocator::Pin(uint32_t block_id) {
|
|
32
46
|
D_ASSERT(type == ColumnDataAllocatorType::BUFFER_MANAGER_ALLOCATOR);
|
|
33
47
|
shared_ptr<BlockHandle> handle;
|
|
@@ -915,6 +915,9 @@ void ColumnDataCollection::Print() const {
|
|
|
915
915
|
void ColumnDataCollection::Reset() {
|
|
916
916
|
count = 0;
|
|
917
917
|
segments.clear();
|
|
918
|
+
|
|
919
|
+
// Refreshes the ColumnDataAllocator to prevent holding on to allocated data unnecessarily
|
|
920
|
+
allocator = make_shared<ColumnDataAllocator>(*allocator);
|
|
918
921
|
}
|
|
919
922
|
|
|
920
923
|
bool ColumnDataCollection::ResultEquals(const ColumnDataCollection &left, const ColumnDataCollection &right,
|
|
@@ -167,23 +167,6 @@ void WindowSegmentTree::ConstructTree() {
|
|
|
167
167
|
void WindowSegmentTree::Compute(Vector &result, idx_t rid, idx_t begin, idx_t end) {
|
|
168
168
|
D_ASSERT(input_ref);
|
|
169
169
|
|
|
170
|
-
// No arguments, so just count
|
|
171
|
-
if (inputs.ColumnCount() == 0) {
|
|
172
|
-
D_ASSERT(GetTypeIdSize(result_type.InternalType()) == sizeof(idx_t));
|
|
173
|
-
auto data = FlatVector::GetData<idx_t>(result);
|
|
174
|
-
// Slice to any filtered rows
|
|
175
|
-
if (!filter_mask.AllValid()) {
|
|
176
|
-
idx_t filtered = 0;
|
|
177
|
-
for (idx_t i = begin; i < end; ++i) {
|
|
178
|
-
filtered += filter_mask.RowIsValid(i);
|
|
179
|
-
}
|
|
180
|
-
data[rid] = filtered;
|
|
181
|
-
} else {
|
|
182
|
-
data[rid] = end - begin;
|
|
183
|
-
}
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
170
|
// If we have a window function, use that
|
|
188
171
|
if (aggregate.window && UseWindowAPI()) {
|
|
189
172
|
// Frame boundaries
|
|
@@ -33,6 +33,26 @@ struct CountStarFunction : public BaseCountFunction {
|
|
|
33
33
|
static void ConstantOperation(STATE *state, AggregateInputData &, idx_t count) {
|
|
34
34
|
*state += count;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
template <typename RESULT_TYPE>
|
|
38
|
+
static void Window(Vector inputs[], const ValidityMask &filter_mask, AggregateInputData &aggr_input_data,
|
|
39
|
+
idx_t input_count, data_ptr_t state, const FrameBounds &frame, const FrameBounds &prev,
|
|
40
|
+
Vector &result, idx_t rid, idx_t bias) {
|
|
41
|
+
D_ASSERT(input_count == 0);
|
|
42
|
+
auto data = FlatVector::GetData<RESULT_TYPE>(result);
|
|
43
|
+
const auto begin = frame.first;
|
|
44
|
+
const auto end = frame.second;
|
|
45
|
+
// Slice to any filtered rows
|
|
46
|
+
if (!filter_mask.AllValid()) {
|
|
47
|
+
RESULT_TYPE filtered = 0;
|
|
48
|
+
for (auto i = begin; i < end; ++i) {
|
|
49
|
+
filtered += filter_mask.RowIsValid(i);
|
|
50
|
+
}
|
|
51
|
+
data[rid] = filtered;
|
|
52
|
+
} else {
|
|
53
|
+
data[rid] = end - begin;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
36
56
|
};
|
|
37
57
|
|
|
38
58
|
struct CountFunction : public BaseCountFunction {
|
|
@@ -72,6 +92,7 @@ AggregateFunction CountStarFun::GetFunction() {
|
|
|
72
92
|
auto fun = AggregateFunction::NullaryAggregate<int64_t, int64_t, CountStarFunction>(LogicalType::BIGINT);
|
|
73
93
|
fun.name = "count_star";
|
|
74
94
|
fun.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
|
95
|
+
fun.window = CountStarFunction::Window<int64_t>;
|
|
75
96
|
// TODO is there a better way to set those?
|
|
76
97
|
fun.serialize = CountStarSerialize;
|
|
77
98
|
fun.deserialize = CountStarDeserialize;
|
|
@@ -98,6 +119,7 @@ void CountFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
98
119
|
// the count function can also be called without arguments
|
|
99
120
|
count_function.arguments.clear();
|
|
100
121
|
count_function.statistics = nullptr;
|
|
122
|
+
count_function.window = CountStarFunction::Window<int64_t>;
|
|
101
123
|
count.AddFunction(count_function);
|
|
102
124
|
set.AddFunction(count);
|
|
103
125
|
}
|
|
@@ -219,6 +219,7 @@ static unique_ptr<FunctionData> BindAggregateState(ClientContext &context, Scala
|
|
|
219
219
|
// FIXME: this is really hacky
|
|
220
220
|
// but the aggregate state export needs a rework around how it handles more complex aggregates anyway
|
|
221
221
|
vector<unique_ptr<Expression>> args;
|
|
222
|
+
args.reserve(state_type.bound_argument_types.size());
|
|
222
223
|
for (auto &arg_type : state_type.bound_argument_types) {
|
|
223
224
|
args.push_back(make_unique<BoundConstantExpression>(Value(arg_type)));
|
|
224
225
|
}
|
|
@@ -302,7 +303,6 @@ ExportAggregateFunction::Bind(unique_ptr<BoundAggregateExpression> child_aggrega
|
|
|
302
303
|
// this should be required
|
|
303
304
|
D_ASSERT(bound_function.state_size);
|
|
304
305
|
D_ASSERT(bound_function.finalize);
|
|
305
|
-
D_ASSERT(!bound_function.window);
|
|
306
306
|
|
|
307
307
|
D_ASSERT(child_aggregate->function.return_type.id() != LogicalTypeId::INVALID);
|
|
308
308
|
#ifdef DEBUG
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
|
2
|
-
#define DUCKDB_VERSION "0.6.2-
|
|
2
|
+
#define DUCKDB_VERSION "0.6.2-dev960"
|
|
3
3
|
#endif
|
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
|
5
|
+
#define DUCKDB_SOURCE_ID "84b9e770f3"
|
|
6
6
|
#endif
|
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
|
8
8
|
#include "duckdb/main/database.hpp"
|
|
@@ -31,6 +31,7 @@ public:
|
|
|
31
31
|
ColumnDataAllocator(Allocator &allocator);
|
|
32
32
|
ColumnDataAllocator(BufferManager &buffer_manager);
|
|
33
33
|
ColumnDataAllocator(ClientContext &context, ColumnDataAllocatorType allocator_type);
|
|
34
|
+
ColumnDataAllocator(ColumnDataAllocator &allocator);
|
|
34
35
|
|
|
35
36
|
//! Returns an allocator object to allocate with. This returns the allocator in IN_MEMORY_ALLOCATOR, and a buffer
|
|
36
37
|
//! allocator in case of BUFFER_MANAGER_ALLOCATOR.
|
|
@@ -104,8 +104,10 @@
|
|
|
104
104
|
#define CPPHTTPLIB_RECV_FLAGS 0
|
|
105
105
|
#endif
|
|
106
106
|
|
|
107
|
-
#ifndef
|
|
107
|
+
#ifndef MSG_NOSIGNAL
|
|
108
108
|
#define CPPHTTPLIB_SEND_FLAGS 0
|
|
109
|
+
#else
|
|
110
|
+
#define CPPHTTPLIB_SEND_FLAGS MSG_NOSIGNAL
|
|
109
111
|
#endif
|
|
110
112
|
|
|
111
113
|
#ifndef CPPHTTPLIB_LISTEN_BACKLOG
|