duckdb 0.5.1-dev5.0 → 0.5.1-dev56.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.cpp +74 -37
- package/src/duckdb.hpp +6 -5
- package/src/parquet-amalgamation.cpp +37477 -37477
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -33336,6 +33336,9 @@ void RowOperations::UnswizzleHeapPointer(const RowLayout &layout, const data_ptr
|
|
|
33336
33336
|
|
|
33337
33337
|
static inline void VerifyUnswizzledString(const RowLayout &layout, const idx_t &col_idx, const data_ptr_t &row_ptr) {
|
|
33338
33338
|
#ifdef DEBUG
|
|
33339
|
+
if (layout.GetTypes()[col_idx] == LogicalTypeId::BLOB) {
|
|
33340
|
+
return;
|
|
33341
|
+
}
|
|
33339
33342
|
idx_t entry_idx;
|
|
33340
33343
|
idx_t idx_in_entry;
|
|
33341
33344
|
ValidityBytes::GetEntryIndex(col_idx, entry_idx, idx_in_entry);
|
|
@@ -96859,7 +96862,8 @@ struct DateDiff {
|
|
|
96859
96862
|
struct WeekOperator {
|
|
96860
96863
|
template <class TA, class TB, class TR>
|
|
96861
96864
|
static inline TR Operation(TA startdate, TB enddate) {
|
|
96862
|
-
return Date::Epoch(enddate) / Interval::SECS_PER_WEEK -
|
|
96865
|
+
return Date::Epoch(Date::GetMondayOfCurrentWeek(enddate)) / Interval::SECS_PER_WEEK -
|
|
96866
|
+
Date::Epoch(Date::GetMondayOfCurrentWeek(startdate)) / Interval::SECS_PER_WEEK;
|
|
96863
96867
|
}
|
|
96864
96868
|
};
|
|
96865
96869
|
|
|
@@ -104318,18 +104322,12 @@ void SinkDataChunk(Vector *child_vector, SelectionVector &sel, idx_t offset_list
|
|
|
104318
104322
|
static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
104319
104323
|
D_ASSERT(args.ColumnCount() >= 1 && args.ColumnCount() <= 3);
|
|
104320
104324
|
auto count = args.size();
|
|
104321
|
-
Vector &
|
|
104325
|
+
Vector &input_lists = args.data[0];
|
|
104322
104326
|
|
|
104323
104327
|
result.SetVectorType(VectorType::FLAT_VECTOR);
|
|
104324
104328
|
auto &result_validity = FlatVector::Validity(result);
|
|
104325
104329
|
|
|
104326
|
-
|
|
104327
|
-
if (v.GetVectorType() != VectorType::FLAT_VECTOR && v.GetVectorType() != VectorType::CONSTANT_VECTOR) {
|
|
104328
|
-
v.Flatten(count);
|
|
104329
|
-
}
|
|
104330
|
-
}
|
|
104331
|
-
|
|
104332
|
-
if (lists.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
104330
|
+
if (input_lists.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
104333
104331
|
result_validity.SetInvalid(0);
|
|
104334
104332
|
return;
|
|
104335
104333
|
}
|
|
@@ -104344,15 +104342,18 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
|
104344
104342
|
LocalSortState local_sort_state;
|
|
104345
104343
|
local_sort_state.Initialize(global_sort_state, buffer_manager);
|
|
104346
104344
|
|
|
104345
|
+
// this ensures that we do not change the order of the entries in the input chunk
|
|
104346
|
+
VectorOperations::Copy(input_lists, result, count, 0, 0);
|
|
104347
|
+
|
|
104347
104348
|
// get the child vector
|
|
104348
|
-
auto lists_size = ListVector::GetListSize(
|
|
104349
|
-
auto &child_vector = ListVector::GetEntry(
|
|
104349
|
+
auto lists_size = ListVector::GetListSize(result);
|
|
104350
|
+
auto &child_vector = ListVector::GetEntry(result);
|
|
104350
104351
|
UnifiedVectorFormat child_data;
|
|
104351
104352
|
child_vector.ToUnifiedFormat(lists_size, child_data);
|
|
104352
104353
|
|
|
104353
104354
|
// get the lists data
|
|
104354
104355
|
UnifiedVectorFormat lists_data;
|
|
104355
|
-
|
|
104356
|
+
result.ToUnifiedFormat(count, lists_data);
|
|
104356
104357
|
auto list_entries = (list_entry_t *)lists_data.data;
|
|
104357
104358
|
|
|
104358
104359
|
// create the lists_indices vector, this contains an element for each list's entry,
|
|
@@ -104449,8 +104450,6 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
|
104449
104450
|
child_vector.Flatten(sel_sorted_idx);
|
|
104450
104451
|
}
|
|
104451
104452
|
|
|
104452
|
-
result.Reference(lists);
|
|
104453
|
-
|
|
104454
104453
|
if (args.AllConstant()) {
|
|
104455
104454
|
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
104456
104455
|
}
|
|
@@ -141402,7 +141401,7 @@ Value ForceCompressionSetting::GetSetting(ClientContext &context) {
|
|
|
141402
141401
|
//===--------------------------------------------------------------------===//
|
|
141403
141402
|
void HomeDirectorySetting::SetLocal(ClientContext &context, const Value &input) {
|
|
141404
141403
|
auto &config = ClientConfig::GetConfig(context);
|
|
141405
|
-
config.home_directory = input.IsNull() ?
|
|
141404
|
+
config.home_directory = input.IsNull() ? string() : input.ToString();
|
|
141406
141405
|
}
|
|
141407
141406
|
|
|
141408
141407
|
Value HomeDirectorySetting::GetSetting(ClientContext &context) {
|
|
@@ -151925,6 +151924,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalGet
|
|
|
151925
151924
|
|
|
151926
151925
|
|
|
151927
151926
|
|
|
151927
|
+
|
|
151928
151928
|
namespace duckdb {
|
|
151929
151929
|
|
|
151930
151930
|
void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, unique_ptr<LogicalOperator> *node_ptr) {
|
|
@@ -151954,10 +151954,15 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq
|
|
|
151954
151954
|
// semi or inner join on false; entire node can be pruned
|
|
151955
151955
|
ReplaceWithEmptyResult(*node_ptr);
|
|
151956
151956
|
return;
|
|
151957
|
-
case JoinType::ANTI:
|
|
151958
|
-
//
|
|
151959
|
-
|
|
151957
|
+
case JoinType::ANTI: {
|
|
151958
|
+
// when the right child has data, return the left child
|
|
151959
|
+
// when the right child has no data, return an empty set
|
|
151960
|
+
auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
|
|
151961
|
+
limit->AddChild(move(join.children[1]));
|
|
151962
|
+
auto cross_product = LogicalCrossProduct::Create(move(join.children[0]), move(limit));
|
|
151963
|
+
*node_ptr = move(cross_product);
|
|
151960
151964
|
return;
|
|
151965
|
+
}
|
|
151961
151966
|
case JoinType::LEFT:
|
|
151962
151967
|
// anti/left outer join: replace right side with empty node
|
|
151963
151968
|
ReplaceWithEmptyResult(join.children[1]);
|
|
@@ -151985,10 +151990,15 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq
|
|
|
151985
151990
|
} else {
|
|
151986
151991
|
// this is the only condition and it is always true: all conditions are true
|
|
151987
151992
|
switch (join.join_type) {
|
|
151988
|
-
case JoinType::SEMI:
|
|
151989
|
-
//
|
|
151990
|
-
|
|
151993
|
+
case JoinType::SEMI: {
|
|
151994
|
+
// when the right child has data, return the left child
|
|
151995
|
+
// when the right child has no data, return an empty set
|
|
151996
|
+
auto limit = make_unique<LogicalLimit>(1, 0, nullptr, nullptr);
|
|
151997
|
+
limit->AddChild(move(join.children[1]));
|
|
151998
|
+
auto cross_product = LogicalCrossProduct::Create(move(join.children[0]), move(limit));
|
|
151999
|
+
*node_ptr = move(cross_product);
|
|
151991
152000
|
return;
|
|
152001
|
+
}
|
|
151992
152002
|
case JoinType::INNER:
|
|
151993
152003
|
case JoinType::LEFT:
|
|
151994
152004
|
case JoinType::RIGHT:
|
|
@@ -152105,6 +152115,7 @@ unique_ptr<NodeStatistics> StatisticsPropagator::PropagateStatistics(LogicalJoin
|
|
|
152105
152115
|
// then propagate into the join conditions
|
|
152106
152116
|
switch (join.type) {
|
|
152107
152117
|
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN:
|
|
152118
|
+
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
|
152108
152119
|
PropagateStatistics((LogicalComparisonJoin &)join, node_ptr);
|
|
152109
152120
|
break;
|
|
152110
152121
|
case LogicalOperatorType::LOGICAL_ANY_JOIN:
|
|
@@ -171765,7 +171776,7 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName *type_n
|
|
|
171765
171776
|
|
|
171766
171777
|
result_type = LogicalType::MAP(move(children));
|
|
171767
171778
|
} else {
|
|
171768
|
-
|
|
171779
|
+
int64_t width, scale;
|
|
171769
171780
|
if (base_type == LogicalTypeId::DECIMAL) {
|
|
171770
171781
|
// default decimal width/scale
|
|
171771
171782
|
width = 18;
|
|
@@ -180863,6 +180874,9 @@ BoundStatement Binder::BindSummarize(ShowStatement &stmt) {
|
|
|
180863
180874
|
|
|
180864
180875
|
|
|
180865
180876
|
|
|
180877
|
+
|
|
180878
|
+
|
|
180879
|
+
|
|
180866
180880
|
//===----------------------------------------------------------------------===//
|
|
180867
180881
|
// DuckDB
|
|
180868
180882
|
//
|
|
@@ -180897,10 +180911,6 @@ protected:
|
|
|
180897
180911
|
|
|
180898
180912
|
|
|
180899
180913
|
|
|
180900
|
-
|
|
180901
|
-
|
|
180902
|
-
|
|
180903
|
-
|
|
180904
180914
|
//===----------------------------------------------------------------------===//
|
|
180905
180915
|
// DuckDB
|
|
180906
180916
|
//
|
|
@@ -180933,6 +180943,8 @@ public:
|
|
|
180933
180943
|
};
|
|
180934
180944
|
} // namespace duckdb
|
|
180935
180945
|
|
|
180946
|
+
|
|
180947
|
+
|
|
180936
180948
|
#include <algorithm>
|
|
180937
180949
|
|
|
180938
180950
|
namespace duckdb {
|
|
@@ -181103,10 +181115,10 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) {
|
|
|
181103
181115
|
if (column.Generated()) {
|
|
181104
181116
|
throw BinderException("Cant update column \"%s\" because it is a generated column!", column.Name());
|
|
181105
181117
|
}
|
|
181106
|
-
if (std::find(update->columns.begin(), update->columns.end(), column.
|
|
181118
|
+
if (std::find(update->columns.begin(), update->columns.end(), column.StorageOid()) != update->columns.end()) {
|
|
181107
181119
|
throw BinderException("Multiple assignments to same column \"%s\"", colname);
|
|
181108
181120
|
}
|
|
181109
|
-
update->columns.push_back(column.
|
|
181121
|
+
update->columns.push_back(column.StorageOid());
|
|
181110
181122
|
|
|
181111
181123
|
if (expr->type == ExpressionType::VALUE_DEFAULT) {
|
|
181112
181124
|
update->expressions.push_back(make_unique<BoundDefaultExpression>(column.Type()));
|
|
@@ -181188,7 +181200,20 @@ BoundStatement Binder::Bind(VacuumStatement &stmt) {
|
|
|
181188
181200
|
auto &get = (LogicalGet &)*ref->get;
|
|
181189
181201
|
columns.insert(columns.end(), get.names.begin(), get.names.end());
|
|
181190
181202
|
}
|
|
181203
|
+
|
|
181204
|
+
case_insensitive_set_t column_name_set;
|
|
181205
|
+
vector<string> non_generated_column_names;
|
|
181191
181206
|
for (auto &col_name : columns) {
|
|
181207
|
+
if (column_name_set.count(col_name) > 0) {
|
|
181208
|
+
throw BinderException("Vacuum the same column twice(same name in column name list)");
|
|
181209
|
+
}
|
|
181210
|
+
column_name_set.insert(col_name);
|
|
181211
|
+
auto &col = ref->table->GetColumn(col_name);
|
|
181212
|
+
// ignore generated column
|
|
181213
|
+
if (col.Generated()) {
|
|
181214
|
+
continue;
|
|
181215
|
+
}
|
|
181216
|
+
non_generated_column_names.push_back(col_name);
|
|
181192
181217
|
ColumnRefExpression colref(col_name, ref->table->name);
|
|
181193
181218
|
auto result = bind_context.BindColumn(colref, 0);
|
|
181194
181219
|
if (result.HasError()) {
|
|
@@ -181196,17 +181221,29 @@ BoundStatement Binder::Bind(VacuumStatement &stmt) {
|
|
|
181196
181221
|
}
|
|
181197
181222
|
select_list.push_back(move(result.expression));
|
|
181198
181223
|
}
|
|
181199
|
-
|
|
181200
|
-
|
|
181201
|
-
|
|
181202
|
-
|
|
181203
|
-
stmt.info->column_id_map[i] = get.column_ids[i];
|
|
181204
|
-
}
|
|
181224
|
+
stmt.info->columns = move(non_generated_column_names);
|
|
181225
|
+
if (!select_list.empty()) {
|
|
181226
|
+
auto table_scan = CreatePlan(*ref);
|
|
181227
|
+
D_ASSERT(table_scan->type == LogicalOperatorType::LOGICAL_GET);
|
|
181205
181228
|
|
|
181206
|
-
|
|
181207
|
-
projection->children.push_back(move(table_scan));
|
|
181229
|
+
auto &get = (LogicalGet &)*table_scan;
|
|
181208
181230
|
|
|
181209
|
-
|
|
181231
|
+
D_ASSERT(select_list.size() == get.column_ids.size());
|
|
181232
|
+
D_ASSERT(stmt.info->columns.size() == get.column_ids.size());
|
|
181233
|
+
for (idx_t i = 0; i < get.column_ids.size(); i++) {
|
|
181234
|
+
stmt.info->column_id_map[i] = ref->table->columns[get.column_ids[i]].StorageOid();
|
|
181235
|
+
}
|
|
181236
|
+
|
|
181237
|
+
auto projection = make_unique<LogicalProjection>(GenerateTableIndex(), move(select_list));
|
|
181238
|
+
projection->children.push_back(move(table_scan));
|
|
181239
|
+
|
|
181240
|
+
root = move(projection);
|
|
181241
|
+
} else {
|
|
181242
|
+
// eg. CREATE TABLE test (x AS (1));
|
|
181243
|
+
// ANALYZE test;
|
|
181244
|
+
// Make it not a SINK so it doesn't have to do anything
|
|
181245
|
+
stmt.info->has_table = false;
|
|
181246
|
+
}
|
|
181210
181247
|
}
|
|
181211
181248
|
auto vacuum = make_unique<LogicalSimple>(LogicalOperatorType::LOGICAL_VACUUM, move(stmt.info));
|
|
181212
181249
|
if (root) {
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.5.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "c96d09d7b"
|
|
15
|
+
#define DUCKDB_VERSION "v0.5.1-dev56"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -3372,8 +3372,8 @@ public:
|
|
|
3372
3372
|
DUCKDB_API AllocatedData(Allocator &allocator, data_ptr_t pointer, idx_t allocated_size);
|
|
3373
3373
|
DUCKDB_API ~AllocatedData();
|
|
3374
3374
|
// disable copy constructors
|
|
3375
|
-
|
|
3376
|
-
|
|
3375
|
+
AllocatedData(const AllocatedData &other) = delete;
|
|
3376
|
+
AllocatedData &operator=(const AllocatedData &) = delete;
|
|
3377
3377
|
//! enable move constructors
|
|
3378
3378
|
DUCKDB_API AllocatedData(AllocatedData &&other) noexcept;
|
|
3379
3379
|
DUCKDB_API AllocatedData &operator=(AllocatedData &&) noexcept;
|
|
@@ -27469,7 +27469,8 @@ public:
|
|
|
27469
27469
|
public:
|
|
27470
27470
|
template <class T, class BASE>
|
|
27471
27471
|
static string ToString(const T &entry) {
|
|
27472
|
-
return entry.left->ToString()
|
|
27472
|
+
return StringUtil::Format("(%s) %s (%s)", entry.left->ToString(), ExpressionTypeToOperator(entry.type),
|
|
27473
|
+
entry.right->ToString());
|
|
27473
27474
|
}
|
|
27474
27475
|
};
|
|
27475
27476
|
} // namespace duckdb
|