duckdb 0.6.2-dev939.0 → 0.6.2-dev942.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/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/package.json
CHANGED
|
@@ -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-dev942"
|
|
3
3
|
#endif
|
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
|
5
|
+
#define DUCKDB_SOURCE_ID "2dcdc24556"
|
|
6
6
|
#endif
|
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
|
8
8
|
#include "duckdb/main/database.hpp"
|