duckdb 0.7.2-dev586.0 → 0.7.2-dev614.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/extension/icu/icu-table-range.cpp +7 -7
- package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -1
- package/src/duckdb/src/common/types/blob.cpp +1 -1
- package/src/duckdb/src/common/types/chunk_collection.cpp +2 -2
- package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
- package/src/duckdb/src/common/types/value.cpp +8 -8
- package/src/duckdb/src/common/types.cpp +11 -11
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +12 -3
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +6 -11
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +2 -2
- package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +1 -1
- package/src/duckdb/src/function/aggregate/nested/list.cpp +8 -8
- package/src/duckdb/src/function/cast/struct_cast.cpp +1 -1
- package/src/duckdb/src/function/scalar/date/date_part.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +5 -4
- package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_value.cpp +1 -1
- package/src/duckdb/src/function/scalar/map/map_entries.cpp +1 -1
- package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +1 -1
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +1 -1
- package/src/duckdb/src/function/table/arrow.cpp +2 -2
- package/src/duckdb/src/function/table/system/test_all_types.cpp +2 -2
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types.hpp +3 -3
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -1
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +3 -4
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +5 -3
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +2 -2
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +2 -0
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +3 -2
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +4 -3
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +2 -1
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +1 -0
- package/src/duckdb/src/planner/binder/tableref/plan_cteref.cpp +1 -0
- package/src/duckdb/src/planner/expression_binder.cpp +1 -1
- package/src/duckdb/src/storage/statistics/list_stats.cpp +6 -2
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +3 -1
- package/src/duckdb/src/storage/table/update_segment.cpp +11 -7
package/package.json
CHANGED
@@ -13,13 +13,13 @@ struct ICUTableRange {
|
|
13
13
|
using CalendarPtr = unique_ptr<icu::Calendar>;
|
14
14
|
|
15
15
|
struct BindData : public TableFunctionData {
|
16
|
-
|
17
|
-
:
|
18
|
-
start(other.start), end(other.end), increment(other.increment),
|
19
|
-
greater_than_check(other.greater_than_check) {
|
16
|
+
BindData(const BindData &other)
|
17
|
+
: TableFunctionData(other), tz_setting(other.tz_setting), cal_setting(other.cal_setting),
|
18
|
+
calendar(other.calendar->clone()), start(other.start), end(other.end), increment(other.increment),
|
19
|
+
inclusive_bound(other.inclusive_bound), greater_than_check(other.greater_than_check) {
|
20
20
|
}
|
21
21
|
|
22
|
-
BindData(ClientContext &context) {
|
22
|
+
explicit BindData(ClientContext &context) {
|
23
23
|
Value tz_value;
|
24
24
|
if (context.TryGetCurrentSetting("TimeZone", tz_value)) {
|
25
25
|
tz_setting = tz_value.ToString();
|
@@ -54,14 +54,14 @@ struct ICUTableRange {
|
|
54
54
|
bool inclusive_bound;
|
55
55
|
bool greater_than_check;
|
56
56
|
|
57
|
-
bool Equals(const FunctionData &other_p) const {
|
57
|
+
bool Equals(const FunctionData &other_p) const override {
|
58
58
|
auto &other = (const BindData &)other_p;
|
59
59
|
return other.start == start && other.end == end && other.increment == increment &&
|
60
60
|
other.inclusive_bound == inclusive_bound && other.greater_than_check == greater_than_check &&
|
61
61
|
*calendar == *other.calendar;
|
62
62
|
}
|
63
63
|
|
64
|
-
unique_ptr<FunctionData> Copy() const {
|
64
|
+
unique_ptr<FunctionData> Copy() const override {
|
65
65
|
return make_unique<BindData>(*this);
|
66
66
|
}
|
67
67
|
|
@@ -320,7 +320,7 @@ unique_ptr<ColumnReader> ParquetReader::CreateReaderRecursive(const FileMetaData
|
|
320
320
|
std::move(struct_reader));
|
321
321
|
}
|
322
322
|
if (child_types.size() > 1 || (!is_list && !is_map && !is_repeated)) {
|
323
|
-
result_type = LogicalType::STRUCT(
|
323
|
+
result_type = LogicalType::STRUCT(child_types);
|
324
324
|
result = make_unique<StructColumnReader>(*this, result_type, s_ele, this_idx, max_define, max_repeat,
|
325
325
|
std::move(child_readers));
|
326
326
|
} else {
|
@@ -20,7 +20,7 @@ const int Blob::HEX_MAP[256] = {
|
|
20
20
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
|
21
21
|
|
22
22
|
bool IsRegularCharacter(data_t c) {
|
23
|
-
return c >= 32 && c <=
|
23
|
+
return c >= 32 && c <= 126 && c != '\\' && c != '\'' && c != '"';
|
24
24
|
}
|
25
25
|
|
26
26
|
idx_t Blob::GetStringSize(string_t blob) {
|
@@ -143,7 +143,7 @@ void ChunkCollection::Fuse(ChunkCollection &other) {
|
|
143
143
|
auto &rhs = other.GetChunk(chunk_idx);
|
144
144
|
lhs->data.reserve(rhs.data.size());
|
145
145
|
for (auto &v : rhs.data) {
|
146
|
-
lhs->data.emplace_back(
|
146
|
+
lhs->data.emplace_back(v);
|
147
147
|
}
|
148
148
|
lhs->SetCardinality(rhs.size());
|
149
149
|
chunks.push_back(std::move(lhs));
|
@@ -156,7 +156,7 @@ void ChunkCollection::Fuse(ChunkCollection &other) {
|
|
156
156
|
auto &rhs = other.GetChunk(chunk_idx);
|
157
157
|
D_ASSERT(lhs.size() == rhs.size());
|
158
158
|
for (auto &v : rhs.data) {
|
159
|
-
lhs.data.emplace_back(
|
159
|
+
lhs.data.emplace_back(v);
|
160
160
|
}
|
161
161
|
}
|
162
162
|
}
|
@@ -62,7 +62,7 @@ void DataChunk::InitializeEmpty(vector<LogicalType>::const_iterator begin, vecto
|
|
62
62
|
D_ASSERT(data.empty()); // can only be initialized once
|
63
63
|
D_ASSERT(std::distance(begin, end) != 0); // empty chunk not allowed
|
64
64
|
for (; begin != end; begin++) {
|
65
|
-
data.emplace_back(
|
65
|
+
data.emplace_back(*begin, nullptr);
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
@@ -604,22 +604,22 @@ Value Value::STRUCT(child_list_t<Value> values) {
|
|
604
604
|
struct_values.push_back(std::move(child.second));
|
605
605
|
}
|
606
606
|
result.value_info_ = make_shared<NestedValueInfo>(std::move(struct_values));
|
607
|
-
result.type_ = LogicalType::STRUCT(
|
607
|
+
result.type_ = LogicalType::STRUCT(child_types);
|
608
608
|
result.is_null = false;
|
609
609
|
return result;
|
610
610
|
}
|
611
611
|
|
612
|
-
Value Value::MAP(LogicalType child_type, vector<Value> values) {
|
612
|
+
Value Value::MAP(const LogicalType &child_type, vector<Value> values) {
|
613
613
|
Value result;
|
614
614
|
|
615
|
-
result.type_ = LogicalType::MAP(
|
615
|
+
result.type_ = LogicalType::MAP(child_type);
|
616
616
|
result.is_null = false;
|
617
617
|
result.value_info_ = make_shared<NestedValueInfo>(std::move(values));
|
618
618
|
return result;
|
619
619
|
}
|
620
620
|
|
621
621
|
Value Value::UNION(child_list_t<LogicalType> members, uint8_t tag, Value value) {
|
622
|
-
D_ASSERT(members.
|
622
|
+
D_ASSERT(!members.empty());
|
623
623
|
D_ASSERT(members.size() <= UnionType::MAX_UNION_MEMBERS);
|
624
624
|
D_ASSERT(members.size() > tag);
|
625
625
|
|
@@ -660,9 +660,9 @@ Value Value::LIST(vector<Value> values) {
|
|
660
660
|
return result;
|
661
661
|
}
|
662
662
|
|
663
|
-
Value Value::LIST(LogicalType child_type, vector<Value> values) {
|
663
|
+
Value Value::LIST(const LogicalType &child_type, vector<Value> values) {
|
664
664
|
if (values.empty()) {
|
665
|
-
return Value::EMPTYLIST(
|
665
|
+
return Value::EMPTYLIST(child_type);
|
666
666
|
}
|
667
667
|
for (auto &val : values) {
|
668
668
|
val = val.DefaultCastAs(child_type);
|
@@ -670,9 +670,9 @@ Value Value::LIST(LogicalType child_type, vector<Value> values) {
|
|
670
670
|
return Value::LIST(std::move(values));
|
671
671
|
}
|
672
672
|
|
673
|
-
Value Value::EMPTYLIST(LogicalType child_type) {
|
673
|
+
Value Value::EMPTYLIST(const LogicalType &child_type) {
|
674
674
|
Value result;
|
675
|
-
result.type_ = LogicalType::LIST(
|
675
|
+
result.type_ = LogicalType::LIST(child_type);
|
676
676
|
result.value_info_ = make_shared<NestedValueInfo>();
|
677
677
|
result.is_null = false;
|
678
678
|
return result;
|
@@ -522,7 +522,7 @@ LogicalType GetUserTypeRecursive(const LogicalType &type, ClientContext &context
|
|
522
522
|
for (auto &child : StructType::GetChildTypes(type)) {
|
523
523
|
children.emplace_back(child.first, GetUserTypeRecursive(child.second, context));
|
524
524
|
}
|
525
|
-
return LogicalType::STRUCT(
|
525
|
+
return LogicalType::STRUCT(children);
|
526
526
|
}
|
527
527
|
if (type.id() == LogicalTypeId::LIST) {
|
528
528
|
return LogicalType::LIST(GetUserTypeRecursive(ListType::GetChildType(type), context));
|
@@ -773,12 +773,12 @@ LogicalType LogicalType::MaxLogicalType(const LogicalType &left, const LogicalTy
|
|
773
773
|
if (type_id == LogicalTypeId::LIST) {
|
774
774
|
// list: perform max recursively on child type
|
775
775
|
auto new_child = MaxLogicalType(ListType::GetChildType(left), ListType::GetChildType(right));
|
776
|
-
return LogicalType::LIST(
|
776
|
+
return LogicalType::LIST(new_child);
|
777
777
|
}
|
778
778
|
if (type_id == LogicalTypeId::MAP) {
|
779
779
|
// list: perform max recursively on child type
|
780
780
|
auto new_child = MaxLogicalType(ListType::GetChildType(left), ListType::GetChildType(right));
|
781
|
-
return LogicalType::MAP(
|
781
|
+
return LogicalType::MAP(new_child);
|
782
782
|
}
|
783
783
|
if (type_id == LogicalTypeId::STRUCT) {
|
784
784
|
// struct: perform recursively
|
@@ -795,7 +795,7 @@ LogicalType LogicalType::MaxLogicalType(const LogicalType &left, const LogicalTy
|
|
795
795
|
child_types.emplace_back(left_child_types[i].first, std::move(child_type));
|
796
796
|
}
|
797
797
|
|
798
|
-
return LogicalType::STRUCT(
|
798
|
+
return LogicalType::STRUCT(child_types);
|
799
799
|
}
|
800
800
|
if (type_id == LogicalTypeId::UNION) {
|
801
801
|
auto left_member_count = UnionType::GetMemberCount(left);
|
@@ -1076,8 +1076,8 @@ const LogicalType &ListType::GetChildType(const LogicalType &type) {
|
|
1076
1076
|
return ((ListTypeInfo &)*info).child_type;
|
1077
1077
|
}
|
1078
1078
|
|
1079
|
-
LogicalType LogicalType::LIST(LogicalType child) {
|
1080
|
-
auto info = make_shared<ListTypeInfo>(
|
1079
|
+
LogicalType LogicalType::LIST(const LogicalType &child) {
|
1080
|
+
auto info = make_shared<ListTypeInfo>(child);
|
1081
1081
|
return LogicalType(LogicalTypeId::LIST, std::move(info));
|
1082
1082
|
}
|
1083
1083
|
|
@@ -1207,8 +1207,8 @@ idx_t StructType::GetChildCount(const LogicalType &type) {
|
|
1207
1207
|
return StructType::GetChildTypes(type).size();
|
1208
1208
|
}
|
1209
1209
|
|
1210
|
-
LogicalType LogicalType::STRUCT(child_list_t<LogicalType> children) {
|
1211
|
-
auto info = make_shared<StructTypeInfo>(
|
1210
|
+
LogicalType LogicalType::STRUCT(const child_list_t<LogicalType> &children) {
|
1211
|
+
auto info = make_shared<StructTypeInfo>(children);
|
1212
1212
|
return LogicalType(LogicalTypeId::STRUCT, std::move(info));
|
1213
1213
|
}
|
1214
1214
|
|
@@ -1220,8 +1220,8 @@ LogicalType LogicalType::AGGREGATE_STATE(aggregate_state_t state_type) { // NOLI
|
|
1220
1220
|
//===--------------------------------------------------------------------===//
|
1221
1221
|
// Map Type
|
1222
1222
|
//===--------------------------------------------------------------------===//
|
1223
|
-
LogicalType LogicalType::MAP(LogicalType child) {
|
1224
|
-
auto info = make_shared<ListTypeInfo>(
|
1223
|
+
LogicalType LogicalType::MAP(const LogicalType &child) {
|
1224
|
+
auto info = make_shared<ListTypeInfo>(child);
|
1225
1225
|
return LogicalType(LogicalTypeId::MAP, std::move(info));
|
1226
1226
|
}
|
1227
1227
|
|
@@ -1229,7 +1229,7 @@ LogicalType LogicalType::MAP(LogicalType key, LogicalType value) {
|
|
1229
1229
|
child_list_t<LogicalType> child_types;
|
1230
1230
|
child_types.emplace_back("key", std::move(key));
|
1231
1231
|
child_types.emplace_back("value", std::move(value));
|
1232
|
-
return LogicalType::MAP(LogicalType::STRUCT(
|
1232
|
+
return LogicalType::MAP(LogicalType::STRUCT(child_types));
|
1233
1233
|
}
|
1234
1234
|
|
1235
1235
|
const LogicalType &MapType::KeyType(const LogicalType &type) {
|
@@ -1289,15 +1289,24 @@ void WindowExecutor::Evaluate(idx_t row_idx, DataChunk &input_chunk, Vector &res
|
|
1289
1289
|
break;
|
1290
1290
|
}
|
1291
1291
|
case ExpressionType::WINDOW_FIRST_VALUE: {
|
1292
|
+
// Same as NTH_VALUE(..., 1)
|
1292
1293
|
idx_t n = 1;
|
1293
1294
|
const auto first_idx = FindNextStart(ignore_nulls, bounds.window_start, bounds.window_end, n);
|
1294
|
-
|
1295
|
+
if (!n) {
|
1296
|
+
CopyCell(payload_collection, 0, first_idx, result, output_offset);
|
1297
|
+
} else {
|
1298
|
+
FlatVector::SetNull(result, output_offset, true);
|
1299
|
+
}
|
1295
1300
|
break;
|
1296
1301
|
}
|
1297
1302
|
case ExpressionType::WINDOW_LAST_VALUE: {
|
1298
1303
|
idx_t n = 1;
|
1299
|
-
|
1300
|
-
|
1304
|
+
const auto last_idx = FindPrevStart(ignore_nulls, bounds.window_start, bounds.window_end, n);
|
1305
|
+
if (!n) {
|
1306
|
+
CopyCell(payload_collection, 0, last_idx, result, output_offset);
|
1307
|
+
} else {
|
1308
|
+
FlatVector::SetNull(result, output_offset, true);
|
1309
|
+
}
|
1301
1310
|
break;
|
1302
1311
|
}
|
1303
1312
|
case ExpressionType::WINDOW_NTH_VALUE: {
|
@@ -386,7 +386,7 @@ IEJoinUnion::IEJoinUnion(ClientContext &context, const PhysicalIEJoin &op, Sorte
|
|
386
386
|
// Sort on the first expression
|
387
387
|
auto ref = make_unique<BoundReferenceExpression>(order1.expression->return_type, 0);
|
388
388
|
vector<BoundOrderByNode> orders;
|
389
|
-
orders.emplace_back(
|
389
|
+
orders.emplace_back(order1.type, order1.null_order, std::move(ref));
|
390
390
|
|
391
391
|
l1 = make_unique<SortedTable>(context, orders, payload_layout);
|
392
392
|
|
@@ -422,7 +422,7 @@ IEJoinUnion::IEJoinUnion(ClientContext &context, const PhysicalIEJoin &op, Sorte
|
|
422
422
|
// Sort on the first expression
|
423
423
|
orders.clear();
|
424
424
|
ref = make_unique<BoundReferenceExpression>(order2.expression->return_type, 0);
|
425
|
-
orders.emplace_back(
|
425
|
+
orders.emplace_back(order2.type, order2.null_order, std::move(ref));
|
426
426
|
|
427
427
|
ExpressionExecutor executor(context);
|
428
428
|
executor.AddExpression(*orders[0].expression);
|
@@ -30,25 +30,20 @@ PhysicalPiecewiseMergeJoin::PhysicalPiecewiseMergeJoin(LogicalOperator &op, uniq
|
|
30
30
|
switch (cond.comparison) {
|
31
31
|
case ExpressionType::COMPARE_LESSTHAN:
|
32
32
|
case ExpressionType::COMPARE_LESSTHANOREQUALTO:
|
33
|
-
lhs_orders.emplace_back(
|
34
|
-
|
35
|
-
rhs_orders.emplace_back(
|
36
|
-
BoundOrderByNode(OrderType::ASCENDING, OrderByNullType::NULLS_LAST, std::move(right)));
|
33
|
+
lhs_orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_LAST, std::move(left));
|
34
|
+
rhs_orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_LAST, std::move(right));
|
37
35
|
break;
|
38
36
|
case ExpressionType::COMPARE_GREATERTHAN:
|
39
37
|
case ExpressionType::COMPARE_GREATERTHANOREQUALTO:
|
40
|
-
lhs_orders.emplace_back(
|
41
|
-
|
42
|
-
rhs_orders.emplace_back(
|
43
|
-
BoundOrderByNode(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, std::move(right)));
|
38
|
+
lhs_orders.emplace_back(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, std::move(left));
|
39
|
+
rhs_orders.emplace_back(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, std::move(right));
|
44
40
|
break;
|
45
41
|
case ExpressionType::COMPARE_NOTEQUAL:
|
46
42
|
case ExpressionType::COMPARE_DISTINCT_FROM:
|
47
43
|
// Allowed in multi-predicate joins, but can't be first/sort.
|
48
44
|
D_ASSERT(!lhs_orders.empty());
|
49
|
-
lhs_orders.emplace_back(
|
50
|
-
rhs_orders.emplace_back(
|
51
|
-
BoundOrderByNode(OrderType::INVALID, OrderByNullType::NULLS_LAST, std::move(right)));
|
45
|
+
lhs_orders.emplace_back(OrderType::INVALID, OrderByNullType::NULLS_LAST, std::move(left));
|
46
|
+
rhs_orders.emplace_back(OrderType::INVALID, OrderByNullType::NULLS_LAST, std::move(right));
|
52
47
|
break;
|
53
48
|
|
54
49
|
default:
|
@@ -46,7 +46,7 @@ void PhysicalRangeJoin::LocalSortedTable::Sink(DataChunk &input, GlobalSortState
|
|
46
46
|
|
47
47
|
// Only sort the primary key
|
48
48
|
DataChunk join_head;
|
49
|
-
join_head.data.emplace_back(
|
49
|
+
join_head.data.emplace_back(keys.data[0]);
|
50
50
|
join_head.SetCardinality(keys.size());
|
51
51
|
|
52
52
|
// Sink the data into the local sort state
|
@@ -85,8 +85,8 @@ static string CreateDirRecursive(const vector<idx_t> &cols, const vector<string>
|
|
85
85
|
CreateDir(path, fs);
|
86
86
|
|
87
87
|
for (idx_t i = 0; i < cols.size(); i++) {
|
88
|
-
auto partition_col_name = names[cols[i]];
|
89
|
-
auto partition_value = values[i];
|
88
|
+
const auto &partition_col_name = names[cols[i]];
|
89
|
+
const auto &partition_value = values[i];
|
90
90
|
string p_dir = partition_col_name + "=" + partition_value.ToString();
|
91
91
|
path = fs.JoinPath(path, p_dir);
|
92
92
|
CreateDir(path, fs);
|
@@ -414,7 +414,7 @@ struct QuantileBindData : public FunctionData {
|
|
414
414
|
size_t pos = 0;
|
415
415
|
size_t neg = 0;
|
416
416
|
for (idx_t i = 0; i < quantiles_p.size(); ++i) {
|
417
|
-
const auto q = quantiles_p[i];
|
417
|
+
const auto &q = quantiles_p[i];
|
418
418
|
pos += (q > 0);
|
419
419
|
neg += (q < 0);
|
420
420
|
quantiles.emplace_back(QuantileAbs(q));
|
@@ -723,9 +723,9 @@ static void GetSegmentDataFunctions(WriteDataToSegment &write_data_to_segment,
|
|
723
723
|
read_data_from_segment.segment_function = ReadDataFromVarcharSegment;
|
724
724
|
copy_data_from_segment.segment_function = CopyDataFromListSegment;
|
725
725
|
|
726
|
-
write_data_to_segment.child_functions.emplace_back(
|
726
|
+
write_data_to_segment.child_functions.emplace_back();
|
727
727
|
write_data_to_segment.child_functions.back().create_segment = CreatePrimitiveSegment<char>;
|
728
|
-
copy_data_from_segment.child_functions.emplace_back(
|
728
|
+
copy_data_from_segment.child_functions.emplace_back();
|
729
729
|
copy_data_from_segment.child_functions.back().segment_function = CopyDataFromPrimitiveSegment<char>;
|
730
730
|
break;
|
731
731
|
}
|
@@ -736,9 +736,9 @@ static void GetSegmentDataFunctions(WriteDataToSegment &write_data_to_segment,
|
|
736
736
|
copy_data_from_segment.segment_function = CopyDataFromListSegment;
|
737
737
|
|
738
738
|
// recurse
|
739
|
-
write_data_to_segment.child_functions.emplace_back(
|
740
|
-
read_data_from_segment.child_functions.emplace_back(
|
741
|
-
copy_data_from_segment.child_functions.emplace_back(
|
739
|
+
write_data_to_segment.child_functions.emplace_back();
|
740
|
+
read_data_from_segment.child_functions.emplace_back();
|
741
|
+
copy_data_from_segment.child_functions.emplace_back();
|
742
742
|
GetSegmentDataFunctions(write_data_to_segment.child_functions.back(),
|
743
743
|
read_data_from_segment.child_functions.back(),
|
744
744
|
copy_data_from_segment.child_functions.back(), ListType::GetChildType(type));
|
@@ -753,9 +753,9 @@ static void GetSegmentDataFunctions(WriteDataToSegment &write_data_to_segment,
|
|
753
753
|
// recurse
|
754
754
|
auto child_types = StructType::GetChildTypes(type);
|
755
755
|
for (idx_t i = 0; i < child_types.size(); i++) {
|
756
|
-
write_data_to_segment.child_functions.emplace_back(
|
757
|
-
read_data_from_segment.child_functions.emplace_back(
|
758
|
-
copy_data_from_segment.child_functions.emplace_back(
|
756
|
+
write_data_to_segment.child_functions.emplace_back();
|
757
|
+
read_data_from_segment.child_functions.emplace_back();
|
758
|
+
copy_data_from_segment.child_functions.emplace_back();
|
759
759
|
GetSegmentDataFunctions(write_data_to_segment.child_functions.back(),
|
760
760
|
read_data_from_segment.child_functions.back(),
|
761
761
|
copy_data_from_segment.child_functions.back(), child_types[i].second);
|
@@ -129,7 +129,7 @@ BoundCastInfo DefaultCasts::StructCastSwitch(BindCastInput &input, const Logical
|
|
129
129
|
for (auto &child_entry : struct_children) {
|
130
130
|
varchar_children.push_back(make_pair(child_entry.first, LogicalType::VARCHAR));
|
131
131
|
}
|
132
|
-
auto varchar_type = LogicalType::STRUCT(
|
132
|
+
auto varchar_type = LogicalType::STRUCT(varchar_children);
|
133
133
|
return BoundCastInfo(StructToVarcharCast,
|
134
134
|
StructBoundCastData::BindStructToStructCast(input, source, varchar_type));
|
135
135
|
}
|
@@ -1332,7 +1332,7 @@ struct StructDatePart {
|
|
1332
1332
|
}
|
1333
1333
|
|
1334
1334
|
Function::EraseArgument(bound_function, arguments, 0);
|
1335
|
-
bound_function.return_type = LogicalType::STRUCT(
|
1335
|
+
bound_function.return_type = LogicalType::STRUCT(struct_children);
|
1336
1336
|
return make_unique<BindData>(bound_function.return_type, part_codes);
|
1337
1337
|
}
|
1338
1338
|
|
@@ -82,9 +82,10 @@ static unique_ptr<FunctionData> ListConcatBind(ClientContext &context, ScalarFun
|
|
82
82
|
throw ParameterNotResolvedException();
|
83
83
|
} else if (lhs.id() == LogicalTypeId::SQLNULL || rhs.id() == LogicalTypeId::SQLNULL) {
|
84
84
|
// we mimic postgres behaviour: list_concat(NULL, my_list) = my_list
|
85
|
-
|
86
|
-
bound_function.arguments[
|
87
|
-
bound_function.
|
85
|
+
auto return_type = rhs.id() == LogicalTypeId::SQLNULL ? lhs : rhs;
|
86
|
+
bound_function.arguments[0] = return_type;
|
87
|
+
bound_function.arguments[1] = return_type;
|
88
|
+
bound_function.return_type = return_type;
|
88
89
|
} else {
|
89
90
|
D_ASSERT(lhs.id() == LogicalTypeId::LIST);
|
90
91
|
D_ASSERT(rhs.id() == LogicalTypeId::LIST);
|
@@ -94,7 +95,7 @@ static unique_ptr<FunctionData> ListConcatBind(ClientContext &context, ScalarFun
|
|
94
95
|
for (const auto &argument : arguments) {
|
95
96
|
child_type = LogicalType::MaxLogicalType(child_type, ListType::GetChildType(argument->return_type));
|
96
97
|
}
|
97
|
-
auto list_type = LogicalType::LIST(
|
98
|
+
auto list_type = LogicalType::LIST(child_type);
|
98
99
|
|
99
100
|
bound_function.arguments[0] = list_type;
|
100
101
|
bound_function.arguments[1] = list_type;
|
@@ -124,7 +124,7 @@ static void ExecuteExpression(vector<LogicalType> &types, vector<LogicalType> &r
|
|
124
124
|
// set the other vectors
|
125
125
|
vector<Vector> slices;
|
126
126
|
for (idx_t col_idx = 0; col_idx < args.ColumnCount() - 1; col_idx++) {
|
127
|
-
slices.emplace_back(
|
127
|
+
slices.emplace_back(args.data[col_idx + 1], sel_vectors[col_idx], elem_cnt);
|
128
128
|
slices[col_idx].Flatten(elem_cnt);
|
129
129
|
input_chunk.data[col_idx + 2].Reference(slices[col_idx]);
|
130
130
|
}
|
@@ -195,10 +195,10 @@ static void ListLambdaFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
195
195
|
|
196
196
|
// skip the list column
|
197
197
|
for (idx_t i = 1; i < args.ColumnCount(); i++) {
|
198
|
-
columns.emplace_back(
|
198
|
+
columns.emplace_back();
|
199
199
|
args.data[i].ToUnifiedFormat(count, columns[i - 1]);
|
200
200
|
indexes.push_back(0);
|
201
|
-
sel_vectors.emplace_back(
|
201
|
+
sel_vectors.emplace_back(STANDARD_VECTOR_SIZE);
|
202
202
|
types.push_back(args.data[i].GetType());
|
203
203
|
}
|
204
204
|
|
@@ -42,7 +42,7 @@ static unique_ptr<FunctionData> ListValueBind(ClientContext &context, ScalarFunc
|
|
42
42
|
|
43
43
|
// this is more for completeness reasons
|
44
44
|
bound_function.varargs = child_type;
|
45
|
-
bound_function.return_type = LogicalType::LIST(
|
45
|
+
bound_function.return_type = LogicalType::LIST(child_type);
|
46
46
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
47
47
|
}
|
48
48
|
|
@@ -44,7 +44,7 @@ static unique_ptr<FunctionData> MapEntriesBind(ClientContext &context, ScalarFun
|
|
44
44
|
child_types.push_back(make_pair("k", key_type));
|
45
45
|
child_types.push_back(make_pair("v", value_type));
|
46
46
|
|
47
|
-
auto row_type = LogicalType::STRUCT(
|
47
|
+
auto row_type = LogicalType::STRUCT(child_types);
|
48
48
|
|
49
49
|
bound_function.return_type = LogicalType::LIST(row_type);
|
50
50
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
@@ -74,7 +74,7 @@ static unique_ptr<FunctionData> StructInsertBind(ClientContext &context, ScalarF
|
|
74
74
|
}
|
75
75
|
|
76
76
|
// this is more for completeness reasons
|
77
|
-
bound_function.return_type = LogicalType::STRUCT(
|
77
|
+
bound_function.return_type = LogicalType::STRUCT(new_struct_children);
|
78
78
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
79
79
|
}
|
80
80
|
|
@@ -54,7 +54,7 @@ static unique_ptr<FunctionData> StructPackBind(ClientContext &context, ScalarFun
|
|
54
54
|
}
|
55
55
|
|
56
56
|
// this is more for completeness reasons
|
57
|
-
bound_function.return_type = LogicalType::STRUCT(
|
57
|
+
bound_function.return_type = LogicalType::STRUCT(struct_children);
|
58
58
|
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
59
59
|
}
|
60
60
|
|
@@ -117,14 +117,14 @@ LogicalType ArrowTableFunction::GetArrowLogicalType(
|
|
117
117
|
idx_t fixed_size = std::stoi(parameters);
|
118
118
|
arrow_convert_data[col_idx]->variable_sz_type.emplace_back(ArrowVariableSizeType::FIXED_SIZE, fixed_size);
|
119
119
|
auto child_type = GetArrowLogicalType(*schema.children[0], arrow_convert_data, col_idx);
|
120
|
-
return LogicalType::LIST(
|
120
|
+
return LogicalType::LIST(child_type);
|
121
121
|
} else if (format == "+s") {
|
122
122
|
child_list_t<LogicalType> child_types;
|
123
123
|
for (idx_t type_idx = 0; type_idx < (idx_t)schema.n_children; type_idx++) {
|
124
124
|
auto child_type = GetArrowLogicalType(*schema.children[type_idx], arrow_convert_data, col_idx);
|
125
125
|
child_types.push_back({schema.children[type_idx]->name, child_type});
|
126
126
|
}
|
127
|
-
return LogicalType::STRUCT(
|
127
|
+
return LogicalType::STRUCT(child_types);
|
128
128
|
|
129
129
|
} else if (format == "+m") {
|
130
130
|
arrow_convert_data[col_idx]->variable_sz_type.emplace_back(ArrowVariableSizeType::NORMAL, 0);
|
@@ -138,7 +138,7 @@ vector<TestType> TestAllTypesFun::GetTestTypes() {
|
|
138
138
|
child_list_t<LogicalType> struct_type_list;
|
139
139
|
struct_type_list.push_back(make_pair("a", LogicalType::INTEGER));
|
140
140
|
struct_type_list.push_back(make_pair("b", LogicalType::VARCHAR));
|
141
|
-
auto struct_type = LogicalType::STRUCT(
|
141
|
+
auto struct_type = LogicalType::STRUCT(struct_type_list);
|
142
142
|
|
143
143
|
child_list_t<Value> min_struct_list;
|
144
144
|
min_struct_list.push_back(make_pair("a", Value(LogicalType::INTEGER)));
|
@@ -156,7 +156,7 @@ vector<TestType> TestAllTypesFun::GetTestTypes() {
|
|
156
156
|
child_list_t<LogicalType> struct_list_type_list;
|
157
157
|
struct_list_type_list.push_back(make_pair("a", int_list_type));
|
158
158
|
struct_list_type_list.push_back(make_pair("b", varchar_list_type));
|
159
|
-
auto struct_list_type = LogicalType::STRUCT(
|
159
|
+
auto struct_list_type = LogicalType::STRUCT(struct_list_type_list);
|
160
160
|
|
161
161
|
child_list_t<Value> min_struct_vl_list;
|
162
162
|
min_struct_vl_list.push_back(make_pair("a", Value(int_list_type)));
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.7.2-
|
2
|
+
#define DUCKDB_VERSION "0.7.2-dev614"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "40e91c8873"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -151,11 +151,11 @@ public:
|
|
151
151
|
//! Cannot be called with an empty list, use either EMPTYLIST or LIST with a type instead
|
152
152
|
DUCKDB_API static Value LIST(vector<Value> values);
|
153
153
|
//! Create a list value with the given entries
|
154
|
-
DUCKDB_API static Value LIST(LogicalType child_type, vector<Value> values);
|
154
|
+
DUCKDB_API static Value LIST(const LogicalType &child_type, vector<Value> values);
|
155
155
|
//! Create an empty list with the specified child-type
|
156
|
-
DUCKDB_API static Value EMPTYLIST(LogicalType child_type);
|
156
|
+
DUCKDB_API static Value EMPTYLIST(const LogicalType &child_type);
|
157
157
|
//! Create a map value with the given entries
|
158
|
-
DUCKDB_API static Value MAP(LogicalType child_type, vector<Value> values);
|
158
|
+
DUCKDB_API static Value MAP(const LogicalType &child_type, vector<Value> values);
|
159
159
|
//! Create a union value from a selected value and a tag from a set of alternatives.
|
160
160
|
DUCKDB_API static Value UNION(child_list_t<LogicalType> members, uint8_t tag, Value value);
|
161
161
|
|
@@ -427,10 +427,10 @@ public:
|
|
427
427
|
// explicitly allowing these functions to be capitalized to be in-line with the remaining functions
|
428
428
|
DUCKDB_API static LogicalType DECIMAL(int width, int scale); // NOLINT
|
429
429
|
DUCKDB_API static LogicalType VARCHAR_COLLATION(string collation); // NOLINT
|
430
|
-
DUCKDB_API static LogicalType LIST( LogicalType child); // NOLINT
|
431
|
-
DUCKDB_API static LogicalType STRUCT( child_list_t<LogicalType> children); // NOLINT
|
430
|
+
DUCKDB_API static LogicalType LIST(const LogicalType &child); // NOLINT
|
431
|
+
DUCKDB_API static LogicalType STRUCT(const child_list_t<LogicalType> &children); // NOLINT
|
432
432
|
DUCKDB_API static LogicalType AGGREGATE_STATE(aggregate_state_t state_type); // NOLINT
|
433
|
-
DUCKDB_API static LogicalType MAP(LogicalType child); // NOLINT
|
433
|
+
DUCKDB_API static LogicalType MAP(const LogicalType &child); // NOLINT
|
434
434
|
DUCKDB_API static LogicalType MAP( child_list_t<LogicalType> children); // NOLINT
|
435
435
|
DUCKDB_API static LogicalType MAP(LogicalType key, LogicalType value); // NOLINT
|
436
436
|
DUCKDB_API static LogicalType UNION( child_list_t<LogicalType> members); // NOLINT
|
@@ -34,7 +34,6 @@ public:
|
|
34
34
|
bool HasUncommittedUpdates(idx_t vector_index);
|
35
35
|
bool HasUpdates(idx_t vector_index) const;
|
36
36
|
bool HasUpdates(idx_t start_row_idx, idx_t end_row_idx);
|
37
|
-
void ClearUpdates();
|
38
37
|
|
39
38
|
void FetchUpdates(TransactionData transaction, idx_t vector_index, Vector &result);
|
40
39
|
void FetchCommitted(idx_t vector_index, Vector &result);
|
@@ -270,6 +270,7 @@ idx_t CGroupBandwidthQuota(idx_t physical_cores, FileSystem &fs) {
|
|
270
270
|
}
|
271
271
|
|
272
272
|
idx_t GetSystemMaxThreadsInternal(FileSystem &fs) {
|
273
|
+
#ifndef DUCKDB_NO_THREADS
|
273
274
|
idx_t physical_cores = std::thread::hardware_concurrency();
|
274
275
|
#ifdef __linux__
|
275
276
|
auto cores_available_per_period = CGroupBandwidthQuota(physical_cores, fs);
|
@@ -277,6 +278,9 @@ idx_t GetSystemMaxThreadsInternal(FileSystem &fs) {
|
|
277
278
|
#else
|
278
279
|
return physical_cores;
|
279
280
|
#endif
|
281
|
+
#else
|
282
|
+
return 1;
|
283
|
+
#endif
|
280
284
|
}
|
281
285
|
|
282
286
|
void DBConfig::SetDefaultMaxThreads() {
|
@@ -39,8 +39,7 @@ void CardinalityEstimator::AddRelationTdom(FilterInfo *filter_info) {
|
|
39
39
|
}
|
40
40
|
}
|
41
41
|
auto key = ColumnBinding(filter_info->left_binding.table_index, filter_info->left_binding.column_index);
|
42
|
-
column_binding_set_t
|
43
|
-
relations_to_tdoms.emplace_back(RelationsToTDom(tmp));
|
42
|
+
relations_to_tdoms.emplace_back(column_binding_set_t({key}));
|
44
43
|
}
|
45
44
|
|
46
45
|
bool CardinalityEstimator::SingleColumnFilter(FilterInfo *filter_info) {
|
@@ -93,7 +92,7 @@ void CardinalityEstimator::AddToEquivalenceSets(FilterInfo *filter_info, vector<
|
|
93
92
|
column_binding_set_t tmp;
|
94
93
|
tmp.insert(filter_info->left_binding);
|
95
94
|
tmp.insert(filter_info->right_binding);
|
96
|
-
relations_to_tdoms.emplace_back(
|
95
|
+
relations_to_tdoms.emplace_back(tmp);
|
97
96
|
relations_to_tdoms.back().filters.push_back(filter_info);
|
98
97
|
}
|
99
98
|
}
|
@@ -259,7 +258,7 @@ double CardinalityEstimator::EstimateCardinalityWithSet(JoinRelationSet *new_set
|
|
259
258
|
// connection to any subgraph in subgraphs. Add a new subgraph, and maybe later there will be
|
260
259
|
// a connection.
|
261
260
|
if (!found_match) {
|
262
|
-
subgraphs.emplace_back(
|
261
|
+
subgraphs.emplace_back();
|
263
262
|
auto subgraph = &subgraphs.back();
|
264
263
|
subgraph->relations.insert(filter->left_binding.table_index);
|
265
264
|
subgraph->relations.insert(filter->right_binding.table_index);
|
@@ -156,7 +156,7 @@ bool JoinOrderOptimizer::ExtractJoinRelations(LogicalOperator &input_op, vector<
|
|
156
156
|
vector<column_binding_map_t<ColumnBinding>> child_binding_maps;
|
157
157
|
idx_t child_bindings_it = 0;
|
158
158
|
for (auto &child : op->children) {
|
159
|
-
child_binding_maps.emplace_back(
|
159
|
+
child_binding_maps.emplace_back();
|
160
160
|
JoinOrderOptimizer optimizer(context);
|
161
161
|
child = optimizer.Optimize(std::move(child));
|
162
162
|
// save the relation bindings from the optimized child. These later all get added to the
|
@@ -230,7 +230,7 @@ bool JoinOrderOptimizer::ExtractJoinRelations(LogicalOperator &input_op, vector<
|
|
230
230
|
auto relation_id = relations.size();
|
231
231
|
// push one child column binding map back.
|
232
232
|
vector<column_binding_map_t<ColumnBinding>> child_binding_maps;
|
233
|
-
child_binding_maps.emplace_back(
|
233
|
+
child_binding_maps.emplace_back();
|
234
234
|
optimizer.cardinality_estimator.CopyRelationMap(child_binding_maps.at(0));
|
235
235
|
// This logical projection may sit on top of a logical comparison join that has been pushed down
|
236
236
|
// we want to copy the binding info of both tables
|
@@ -882,9 +882,11 @@ unique_ptr<LogicalOperator> JoinOrderOptimizer::RewritePlan(unique_ptr<LogicalOp
|
|
882
882
|
|
883
883
|
// first we will extract all relations from the main plan
|
884
884
|
vector<unique_ptr<LogicalOperator>> extracted_relations;
|
885
|
+
extracted_relations.reserve(relations.size());
|
885
886
|
for (auto &relation : relations) {
|
886
887
|
extracted_relations.push_back(ExtractJoinRelation(*relation));
|
887
888
|
}
|
889
|
+
|
888
890
|
// now we generate the actual joins
|
889
891
|
auto join_tree = GenerateJoins(extracted_relations, node);
|
890
892
|
// perform the final pushdown of remaining filters
|
@@ -1012,7 +1014,7 @@ unique_ptr<LogicalOperator> JoinOrderOptimizer::Optimize(unique_ptr<LogicalOpera
|
|
1012
1014
|
for (idx_t i = 0; i < relations.size(); i++) {
|
1013
1015
|
auto &rel = *relations[i];
|
1014
1016
|
auto node = set_manager.GetJoinRelation(i);
|
1015
|
-
nodes_ops.emplace_back(
|
1017
|
+
nodes_ops.emplace_back(make_unique<JoinNode>(node, 0), rel.op);
|
1016
1018
|
}
|
1017
1019
|
|
1018
1020
|
cardinality_estimator.InitCardinalityEstimatorProps(&nodes_ops, &filter_infos);
|
@@ -261,7 +261,7 @@ void UnnestRewriter::UpdateBoundUnnestBindings(UnnestRewriterPlanUpdater &update
|
|
261
261
|
for (idx_t child_col_idx = 0; child_col_idx < unnest_child_cols.size(); child_col_idx++) {
|
262
262
|
if (delim_columns[delim_col_idx].table_index == unnest_child_cols[child_col_idx].table_index) {
|
263
263
|
ColumnBinding old_binding(overwritten_tbl_idx, DConstants::INVALID_INDEX);
|
264
|
-
updater.replace_bindings.emplace_back(
|
264
|
+
updater.replace_bindings.emplace_back(old_binding, delim_columns[delim_col_idx]);
|
265
265
|
break;
|
266
266
|
}
|
267
267
|
}
|
@@ -301,7 +301,7 @@ void UnnestRewriter::GetLHSExpressions(LogicalOperator &op) {
|
|
301
301
|
}
|
302
302
|
|
303
303
|
for (idx_t i = 0; i < op.types.size(); i++) {
|
304
|
-
lhs_bindings.emplace_back(
|
304
|
+
lhs_bindings.emplace_back(col_bindings[i], op.types[i]);
|
305
305
|
if (set_alias) {
|
306
306
|
auto &proj = (LogicalProjection &)op;
|
307
307
|
lhs_bindings.back().alias = proj.expressions[i]->alias;
|
@@ -45,9 +45,11 @@ bool ConjunctionExpression::Equal(const ConjunctionExpression *a, const Conjunct
|
|
45
45
|
|
46
46
|
unique_ptr<ParsedExpression> ConjunctionExpression::Copy() const {
|
47
47
|
vector<unique_ptr<ParsedExpression>> copy_children;
|
48
|
+
copy_children.reserve(children.size());
|
48
49
|
for (auto &expr : children) {
|
49
50
|
copy_children.push_back(expr->Copy());
|
50
51
|
}
|
52
|
+
|
51
53
|
auto copy = make_unique<ConjunctionExpression>(type, std::move(copy_children));
|
52
54
|
copy->CopyProperties(*this);
|
53
55
|
return std::move(copy);
|
@@ -24,7 +24,7 @@ static ExpressionType WindowToExpressionType(string &fun_name) {
|
|
24
24
|
return ExpressionType::WINDOW_FIRST_VALUE;
|
25
25
|
} else if (fun_name == "last_value" || fun_name == "last") {
|
26
26
|
return ExpressionType::WINDOW_LAST_VALUE;
|
27
|
-
} else if (fun_name == "nth_value"
|
27
|
+
} else if (fun_name == "nth_value") {
|
28
28
|
return ExpressionType::WINDOW_NTH_VALUE;
|
29
29
|
} else if (fun_name == "cume_dist") {
|
30
30
|
return ExpressionType::WINDOW_CUME_DIST;
|
@@ -52,7 +52,8 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName *type_n
|
|
52
52
|
children.push_back(make_pair(entry_name, entry_type));
|
53
53
|
}
|
54
54
|
D_ASSERT(!children.empty());
|
55
|
-
result_type = LogicalType::STRUCT(
|
55
|
+
result_type = LogicalType::STRUCT(children);
|
56
|
+
|
56
57
|
} else if (base_type == LogicalTypeId::MAP) {
|
57
58
|
|
58
59
|
if (!type_name->typmods || type_name->typmods->length != 2) {
|
@@ -207,7 +208,7 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName *type_n
|
|
207
208
|
// array bounds: turn the type into a list
|
208
209
|
idx_t extra_stack = 0;
|
209
210
|
for (auto cell = type_name->arrayBounds->head; cell != nullptr; cell = cell->next) {
|
210
|
-
result_type = LogicalType::LIST(
|
211
|
+
result_type = LogicalType::LIST(result_type);
|
211
212
|
StackCheck(extra_stack++);
|
212
213
|
}
|
213
214
|
}
|
@@ -219,7 +219,7 @@ BindResult SelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFuncti
|
|
219
219
|
const auto null_order = (order.null_order == OrderByNullType::ORDER_DEFAULT)
|
220
220
|
? config.options.default_null_order
|
221
221
|
: order.null_order;
|
222
|
-
order_bys->orders.emplace_back(
|
222
|
+
order_bys->orders.emplace_back(sense, null_order, std::move(order_expr.expr));
|
223
223
|
}
|
224
224
|
}
|
225
225
|
|
@@ -175,11 +175,12 @@ unique_ptr<ParsedExpression> ExpressionBinder::CreateStructPack(ColumnRefExpress
|
|
175
175
|
}
|
176
176
|
}
|
177
177
|
// We found the table, now create the struct_pack expression
|
178
|
-
vector<unique_ptr<ParsedExpression>>
|
178
|
+
vector<unique_ptr<ParsedExpression>> child_expressions;
|
179
|
+
child_expressions.reserve(binding->names.size());
|
179
180
|
for (const auto &column_name : binding->names) {
|
180
|
-
|
181
|
+
child_expressions.push_back(make_unique<ColumnRefExpression>(column_name, table_name));
|
181
182
|
}
|
182
|
-
return make_unique<FunctionExpression>("struct_pack", std::move(
|
183
|
+
return make_unique<FunctionExpression>("struct_pack", std::move(child_expressions));
|
183
184
|
}
|
184
185
|
|
185
186
|
unique_ptr<ParsedExpression> ExpressionBinder::QualifyColumnName(ColumnRefExpression &colref, string &error_message) {
|
@@ -441,8 +441,9 @@ unique_ptr<LogicalOperator> DuckCatalog::BindCreateIndex(Binder &binder, CreateS
|
|
441
441
|
|
442
442
|
auto &get = (LogicalGet &)*plan;
|
443
443
|
// bind the index expressions
|
444
|
-
vector<unique_ptr<Expression>> expressions;
|
445
444
|
IndexBinder index_binder(binder, binder.context);
|
445
|
+
vector<unique_ptr<Expression>> expressions;
|
446
|
+
expressions.reserve(base.expressions.size());
|
446
447
|
for (auto &expr : base.expressions) {
|
447
448
|
expressions.push_back(index_binder.Bind(expr));
|
448
449
|
}
|
@@ -303,9 +303,10 @@ unique_ptr<BoundCreateTableInfo> Binder::BindCreateTableInfo(unique_ptr<CreateIn
|
|
303
303
|
}
|
304
304
|
|
305
305
|
vector<unique_ptr<Expression>> Binder::BindCreateIndexExpressions(TableCatalogEntry *table, CreateIndexInfo *info) {
|
306
|
-
vector<unique_ptr<Expression>> expressions;
|
307
306
|
|
308
307
|
auto index_binder = IndexBinder(*this, this->context, table, info);
|
308
|
+
vector<unique_ptr<Expression>> expressions;
|
309
|
+
expressions.reserve(info->expressions.size());
|
309
310
|
for (auto &expr : info->expressions) {
|
310
311
|
expressions.push_back(index_binder.Bind(expr));
|
311
312
|
}
|
@@ -271,6 +271,7 @@ unique_ptr<SelectNode> Binder::BindUnpivot(Binder &child_binder, PivotRef &ref,
|
|
271
271
|
vector<vector<unique_ptr<ParsedExpression>>> unpivot_expressions;
|
272
272
|
for (idx_t v_idx = 0; v_idx < unpivot.entries[0].values.size(); v_idx++) {
|
273
273
|
vector<unique_ptr<ParsedExpression>> expressions;
|
274
|
+
expressions.reserve(unpivot.entries.size());
|
274
275
|
for (auto &entry : unpivot.entries) {
|
275
276
|
expressions.push_back(make_unique<ColumnRefExpression>(entry.values[v_idx].ToString()));
|
276
277
|
}
|
@@ -157,7 +157,7 @@ LogicalType ExpressionBinder::ExchangeType(const LogicalType &type, LogicalTypeI
|
|
157
157
|
for (auto &child_type : child_types) {
|
158
158
|
child_type.second = ExchangeType(child_type.second, target, new_type);
|
159
159
|
}
|
160
|
-
return LogicalType::STRUCT(
|
160
|
+
return LogicalType::STRUCT(child_types);
|
161
161
|
}
|
162
162
|
case LogicalTypeId::UNION: {
|
163
163
|
auto member_types = UnionType::CopyMemberTypes(type);
|
@@ -34,12 +34,16 @@ void ListStats::Copy(BaseStatistics &stats, const BaseStatistics &other) {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
const BaseStatistics &ListStats::GetChildStats(const BaseStatistics &stats) {
|
37
|
-
|
37
|
+
if (stats.GetStatsType() != StatisticsType::LIST_STATS) {
|
38
|
+
throw InternalException("ListStats::GetChildStats called on stats that is not a list");
|
39
|
+
}
|
38
40
|
D_ASSERT(stats.child_stats);
|
39
41
|
return stats.child_stats[0];
|
40
42
|
}
|
41
43
|
BaseStatistics &ListStats::GetChildStats(BaseStatistics &stats) {
|
42
|
-
|
44
|
+
if (stats.GetStatsType() != StatisticsType::LIST_STATS) {
|
45
|
+
throw InternalException("ListStats::GetChildStats called on stats that is not a list");
|
46
|
+
}
|
43
47
|
D_ASSERT(stats.child_stats);
|
44
48
|
return stats.child_stats[0];
|
45
49
|
}
|
@@ -34,7 +34,9 @@ BaseStatistics StructStats::CreateEmpty(LogicalType type) {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
const BaseStatistics *StructStats::GetChildStats(const BaseStatistics &stats) {
|
37
|
-
|
37
|
+
if (stats.GetStatsType() != StatisticsType::STRUCT_STATS) {
|
38
|
+
throw InternalException("Calling StructStats::GetChildStats on stats that is not a struct");
|
39
|
+
}
|
38
40
|
return stats.child_stats.get();
|
39
41
|
}
|
40
42
|
|
@@ -38,7 +38,17 @@ UpdateSegment::UpdateSegment(UpdateSegment &other, ColumnData &owner)
|
|
38
38
|
: column_data(owner), root(std::move(other.root)), stats(std::move(other.stats)), type_size(other.type_size) {
|
39
39
|
|
40
40
|
this->heap.Move(other.heap);
|
41
|
-
|
41
|
+
// update the segment links
|
42
|
+
if (root) {
|
43
|
+
for (idx_t i = 0; i < RowGroup::ROW_GROUP_VECTOR_COUNT; i++) {
|
44
|
+
if (!root->info[i]) {
|
45
|
+
continue;
|
46
|
+
}
|
47
|
+
for (auto info = root->info[i]->info.get(); info; info = info->next) {
|
48
|
+
info->segment = this;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
42
52
|
initialize_update_function = other.initialize_update_function;
|
43
53
|
merge_update_function = other.merge_update_function;
|
44
54
|
fetch_update_function = other.fetch_update_function;
|
@@ -52,12 +62,6 @@ UpdateSegment::UpdateSegment(UpdateSegment &other, ColumnData &owner)
|
|
52
62
|
UpdateSegment::~UpdateSegment() {
|
53
63
|
}
|
54
64
|
|
55
|
-
void UpdateSegment::ClearUpdates() {
|
56
|
-
stats.statistics.Copy(BaseStatistics::CreateEmpty(stats.statistics.GetType()));
|
57
|
-
root.reset();
|
58
|
-
heap.Destroy();
|
59
|
-
}
|
60
|
-
|
61
65
|
//===--------------------------------------------------------------------===//
|
62
66
|
// Update Info Helpers
|
63
67
|
//===--------------------------------------------------------------------===//
|