duckdb 0.3.5-dev162.0 → 0.3.5-dev169.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 +66 -12
- package/src/duckdb.hpp +498 -498
- package/src/parquet-amalgamation.cpp +32975 -32975
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -51502,7 +51502,7 @@ void ART::VerifyExistence(DataChunk &chunk, VerifyExistenceType verify_type, str
|
|
|
51502
51502
|
case VerifyExistenceType::APPEND_FK: {
|
|
51503
51503
|
// found node no exists in tree
|
|
51504
51504
|
exception_msg =
|
|
51505
|
-
"violates foreign key constraint because key \"" + key_name + "\"
|
|
51505
|
+
"violates foreign key constraint because key \"" + key_name + "\" does not exist in referenced table";
|
|
51506
51506
|
break;
|
|
51507
51507
|
}
|
|
51508
51508
|
case VerifyExistenceType::DELETE_FK: {
|
|
@@ -88836,8 +88836,8 @@ void ListExtractFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
88836
88836
|
namespace duckdb {
|
|
88837
88837
|
|
|
88838
88838
|
struct ListSortBindData : public FunctionData {
|
|
88839
|
-
ListSortBindData(OrderType order_type_p, OrderByNullType null_order_p, LogicalType &return_type_p,
|
|
88840
|
-
LogicalType &child_type_p, ClientContext &context_p);
|
|
88839
|
+
ListSortBindData(OrderType order_type_p, OrderByNullType null_order_p, const LogicalType &return_type_p,
|
|
88840
|
+
const LogicalType &child_type_p, ClientContext &context_p);
|
|
88841
88841
|
~ListSortBindData() override;
|
|
88842
88842
|
|
|
88843
88843
|
OrderType order_type;
|
|
@@ -88853,11 +88853,14 @@ struct ListSortBindData : public FunctionData {
|
|
|
88853
88853
|
RowLayout payload_layout;
|
|
88854
88854
|
vector<BoundOrderByNode> orders;
|
|
88855
88855
|
|
|
88856
|
-
|
|
88856
|
+
public:
|
|
88857
|
+
bool Equals(const FunctionData &other_p) const override;
|
|
88858
|
+
unique_ptr<FunctionData> Copy() const override;
|
|
88857
88859
|
};
|
|
88858
88860
|
|
|
88859
|
-
ListSortBindData::ListSortBindData(OrderType order_type_p, OrderByNullType null_order_p,
|
|
88860
|
-
LogicalType &
|
|
88861
|
+
ListSortBindData::ListSortBindData(OrderType order_type_p, OrderByNullType null_order_p,
|
|
88862
|
+
const LogicalType &return_type_p, const LogicalType &child_type_p,
|
|
88863
|
+
ClientContext &context_p)
|
|
88861
88864
|
: order_type(order_type_p), null_order(null_order_p), return_type(return_type_p), child_type(child_type_p),
|
|
88862
88865
|
context(context_p) {
|
|
88863
88866
|
|
|
@@ -88880,10 +88883,15 @@ ListSortBindData::ListSortBindData(OrderType order_type_p, OrderByNullType null_
|
|
|
88880
88883
|
orders.emplace_back(order_type, null_order, move(lists_col_expr));
|
|
88881
88884
|
}
|
|
88882
88885
|
|
|
88883
|
-
unique_ptr<FunctionData> ListSortBindData::Copy() {
|
|
88886
|
+
unique_ptr<FunctionData> ListSortBindData::Copy() const {
|
|
88884
88887
|
return make_unique<ListSortBindData>(order_type, null_order, return_type, child_type, context);
|
|
88885
88888
|
}
|
|
88886
88889
|
|
|
88890
|
+
bool ListSortBindData::Equals(const FunctionData &other_p) const {
|
|
88891
|
+
auto &other = (ListSortBindData &)other_p;
|
|
88892
|
+
return order_type == other.order_type && null_order == other.null_order;
|
|
88893
|
+
}
|
|
88894
|
+
|
|
88887
88895
|
ListSortBindData::~ListSortBindData() {
|
|
88888
88896
|
}
|
|
88889
88897
|
|
|
@@ -148066,10 +148074,12 @@ unique_ptr<Constraint> Transformer::TransformConstraint(duckdb_libpgquery::PGLis
|
|
|
148066
148074
|
for (auto kc = constraint->fk_attrs->head; kc; kc = kc->next) {
|
|
148067
148075
|
fk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
|
148068
148076
|
}
|
|
148069
|
-
|
|
148070
|
-
|
|
148077
|
+
if (constraint->pk_attrs) {
|
|
148078
|
+
for (auto kc = constraint->pk_attrs->head; kc; kc = kc->next) {
|
|
148079
|
+
pk_columns.emplace_back(reinterpret_cast<duckdb_libpgquery::PGValue *>(kc->data.ptr_value)->val.str);
|
|
148080
|
+
}
|
|
148071
148081
|
}
|
|
148072
|
-
if (pk_columns.size() != fk_columns.size()) {
|
|
148082
|
+
if (!pk_columns.empty() && pk_columns.size() != fk_columns.size()) {
|
|
148073
148083
|
throw ParserException("The number of referencing and referenced columns for foreign keys must be the same");
|
|
148074
148084
|
}
|
|
148075
148085
|
if (fk_columns.empty()) {
|
|
@@ -157079,6 +157089,7 @@ public:
|
|
|
157079
157089
|
|
|
157080
157090
|
|
|
157081
157091
|
|
|
157092
|
+
|
|
157082
157093
|
namespace duckdb {
|
|
157083
157094
|
|
|
157084
157095
|
SchemaCatalogEntry *Binder::BindSchema(CreateInfo &info) {
|
|
@@ -157203,6 +157214,35 @@ void Binder::BindLogicalType(ClientContext &context, LogicalType &type, const st
|
|
|
157203
157214
|
}
|
|
157204
157215
|
}
|
|
157205
157216
|
|
|
157217
|
+
static void FindMatchingPrimaryKeyColumns(vector<unique_ptr<Constraint>> &constraints, ForeignKeyConstraint &fk) {
|
|
157218
|
+
if (!fk.pk_columns.empty()) {
|
|
157219
|
+
return;
|
|
157220
|
+
}
|
|
157221
|
+
// find the matching primary key constraint
|
|
157222
|
+
for (auto &constr : constraints) {
|
|
157223
|
+
if (constr->type != ConstraintType::UNIQUE) {
|
|
157224
|
+
continue;
|
|
157225
|
+
}
|
|
157226
|
+
auto &unique = (UniqueConstraint &)*constr;
|
|
157227
|
+
if (!unique.is_primary_key) {
|
|
157228
|
+
continue;
|
|
157229
|
+
}
|
|
157230
|
+
idx_t column_count;
|
|
157231
|
+
if (unique.index != DConstants::INVALID_INDEX) {
|
|
157232
|
+
fk.info.pk_keys.push_back(unique.index);
|
|
157233
|
+
column_count = 1;
|
|
157234
|
+
} else {
|
|
157235
|
+
fk.pk_columns = unique.columns;
|
|
157236
|
+
column_count = unique.columns.size();
|
|
157237
|
+
}
|
|
157238
|
+
if (column_count != fk.fk_columns.size()) {
|
|
157239
|
+
throw BinderException("The number of referencing and referenced columns for foreign keys must be the same");
|
|
157240
|
+
}
|
|
157241
|
+
return;
|
|
157242
|
+
}
|
|
157243
|
+
throw BinderException("there is no primary key for referenced table \"%s\"", fk.info.table);
|
|
157244
|
+
}
|
|
157245
|
+
|
|
157206
157246
|
BoundStatement Binder::Bind(CreateStatement &stmt) {
|
|
157207
157247
|
BoundStatement result;
|
|
157208
157248
|
result.names = {"Count"};
|
|
@@ -157283,13 +157323,15 @@ BoundStatement Binder::Bind(CreateStatement &stmt) {
|
|
|
157283
157323
|
if (fk.info.type != ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) {
|
|
157284
157324
|
continue;
|
|
157285
157325
|
}
|
|
157286
|
-
D_ASSERT(fk.info.pk_keys.empty()
|
|
157326
|
+
D_ASSERT(fk.info.pk_keys.empty());
|
|
157287
157327
|
if (create_info.table == fk.info.table) {
|
|
157288
157328
|
fk.info.type = ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE;
|
|
157329
|
+
FindMatchingPrimaryKeyColumns(create_info.constraints, fk);
|
|
157289
157330
|
} else {
|
|
157290
157331
|
// have to resolve referenced table
|
|
157291
157332
|
auto pk_table_entry_ptr = catalog.GetEntry<TableCatalogEntry>(context, fk.info.schema, fk.info.table);
|
|
157292
|
-
D_ASSERT(
|
|
157333
|
+
D_ASSERT(fk.info.pk_keys.empty());
|
|
157334
|
+
FindMatchingPrimaryKeyColumns(pk_table_entry_ptr->constraints, fk);
|
|
157293
157335
|
for (auto &keyname : fk.pk_columns) {
|
|
157294
157336
|
auto entry = pk_table_entry_ptr->name_map.find(keyname);
|
|
157295
157337
|
if (entry == pk_table_entry_ptr->name_map.end()) {
|
|
@@ -172948,15 +172990,27 @@ static void UpdateChunk(Vector &data, Vector &updates, Vector &row_ids, idx_t co
|
|
|
172948
172990
|
case PhysicalType::INT8:
|
|
172949
172991
|
TemplatedUpdateLoop<int8_t>(data, updates, row_ids, count, base_index);
|
|
172950
172992
|
break;
|
|
172993
|
+
case PhysicalType::UINT8:
|
|
172994
|
+
TemplatedUpdateLoop<uint8_t>(data, updates, row_ids, count, base_index);
|
|
172995
|
+
break;
|
|
172951
172996
|
case PhysicalType::INT16:
|
|
172952
172997
|
TemplatedUpdateLoop<int16_t>(data, updates, row_ids, count, base_index);
|
|
172953
172998
|
break;
|
|
172999
|
+
case PhysicalType::UINT16:
|
|
173000
|
+
TemplatedUpdateLoop<uint16_t>(data, updates, row_ids, count, base_index);
|
|
173001
|
+
break;
|
|
172954
173002
|
case PhysicalType::INT32:
|
|
172955
173003
|
TemplatedUpdateLoop<int32_t>(data, updates, row_ids, count, base_index);
|
|
172956
173004
|
break;
|
|
173005
|
+
case PhysicalType::UINT32:
|
|
173006
|
+
TemplatedUpdateLoop<uint32_t>(data, updates, row_ids, count, base_index);
|
|
173007
|
+
break;
|
|
172957
173008
|
case PhysicalType::INT64:
|
|
172958
173009
|
TemplatedUpdateLoop<int64_t>(data, updates, row_ids, count, base_index);
|
|
172959
173010
|
break;
|
|
173011
|
+
case PhysicalType::UINT64:
|
|
173012
|
+
TemplatedUpdateLoop<uint64_t>(data, updates, row_ids, count, base_index);
|
|
173013
|
+
break;
|
|
172960
173014
|
case PhysicalType::FLOAT:
|
|
172961
173015
|
TemplatedUpdateLoop<float>(data, updates, row_ids, count, base_index);
|
|
172962
173016
|
break;
|