duckdb 0.4.1-dev1564.0 → 0.4.1-dev1574.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.4.1-dev1564.0",
4
+ "version": "0.4.1-dev1574.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -100440,6 +100440,9 @@ void SinkDataChunk(Vector *child_vector, SelectionVector &sel, idx_t offset_list
100440
100440
  payload_chunk.data[0].Reference(payload_vector);
100441
100441
  payload_chunk.SetCardinality(offset_lists_indices);
100442
100442
 
100443
+ key_chunk.Verify();
100444
+ payload_chunk.Verify();
100445
+
100443
100446
  // sink
100444
100447
  local_sort_state.SinkChunk(key_chunk, payload_chunk);
100445
100448
  data_to_sort = true;
@@ -100453,6 +100456,7 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
100453
100456
  result.SetVectorType(VectorType::FLAT_VECTOR);
100454
100457
  auto &result_validity = FlatVector::Validity(result);
100455
100458
 
100459
+ args.Flatten();
100456
100460
  if (lists.GetType().id() == LogicalTypeId::SQLNULL) {
100457
100461
  result_validity.SetInvalid(0);
100458
100462
  return;
@@ -100500,7 +100504,6 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
100500
100504
  bool data_to_sort = false;
100501
100505
 
100502
100506
  for (idx_t i = 0; i < count; i++) {
100503
-
100504
100507
  auto lists_index = lists_data.sel->get_index(i);
100505
100508
  const auto &list_entry = list_entries[lists_index];
100506
100509
 
@@ -100516,7 +100519,6 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
100516
100519
  }
100517
100520
 
100518
100521
  for (idx_t child_idx = 0; child_idx < list_entry.length; child_idx++) {
100519
-
100520
100522
  // lists_indices vector is full, sink
100521
100523
  if (offset_lists_indices == STANDARD_VECTOR_SIZE) {
100522
100524
  SinkDataChunk(&child_vector, sel, offset_lists_indices, info.types, info.payload_types, payload_vector,
@@ -100524,10 +100526,10 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
100524
100526
  offset_lists_indices = 0;
100525
100527
  }
100526
100528
 
100527
- auto source_idx = child_data.sel->get_index(list_entry.offset + child_idx);
100529
+ auto source_idx = list_entry.offset + child_idx;
100528
100530
  sel.set_index(offset_lists_indices, source_idx);
100529
100531
  lists_indices_data[offset_lists_indices] = (uint32_t)i;
100530
- payload_vector_data[offset_lists_indices] = incr_payload_count;
100532
+ payload_vector_data[offset_lists_indices] = source_idx;
100531
100533
  offset_lists_indices++;
100532
100534
  incr_payload_count++;
100533
100535
  }
@@ -100539,7 +100541,6 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
100539
100541
  }
100540
100542
 
100541
100543
  if (data_to_sort) {
100542
-
100543
100544
  // add local state to global state, which sorts the data
100544
100545
  global_sort_state.AddLocalState(local_sort_state);
100545
100546
  global_sort_state.PrepareMergePhase();
@@ -100566,6 +100567,7 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
100566
100567
 
100567
100568
  for (idx_t i = 0; i < row_count; i++) {
100568
100569
  sel_sorted.set_index(sel_sorted_idx, result_data[i]);
100570
+ D_ASSERT(result_data[i] < lists_size);
100569
100571
  sel_sorted_idx++;
100570
100572
  }
100571
100573
  }
@@ -174186,6 +174188,7 @@ static void BindConstraints(Binder &binder, BoundCreateTableInfo &info) {
174186
174188
  auto &base = (CreateTableInfo &)*info.base;
174187
174189
 
174188
174190
  bool has_primary_key = false;
174191
+ unordered_set<idx_t> not_null_columns;
174189
174192
  vector<idx_t> primary_keys;
174190
174193
  for (idx_t i = 0; i < base.constraints.size(); i++) {
174191
174194
  auto &cond = base.constraints[i];
@@ -174198,6 +174201,7 @@ static void BindConstraints(Binder &binder, BoundCreateTableInfo &info) {
174198
174201
  auto &not_null = (NotNullConstraint &)*cond;
174199
174202
  auto &col = base.columns[not_null.index];
174200
174203
  info.bound_constraints.push_back(make_unique<BoundNotNullConstraint>(col.StorageOid()));
174204
+ not_null_columns.insert(not_null.index);
174201
174205
  break;
174202
174206
  }
174203
174207
  case ConstraintType::UNIQUE: {
@@ -174285,6 +174289,10 @@ static void BindConstraints(Binder &binder, BoundCreateTableInfo &info) {
174285
174289
  if (has_primary_key) {
174286
174290
  // if there is a primary key index, also create a NOT NULL constraint for each of the columns
174287
174291
  for (auto &column_index : primary_keys) {
174292
+ if (not_null_columns.count(column_index)) {
174293
+ //! No need to create a NotNullConstraint, it's already present
174294
+ continue;
174295
+ }
174288
174296
  auto &column = base.columns[column_index];
174289
174297
  base.constraints.push_back(make_unique<NotNullConstraint>(column_index));
174290
174298
  info.bound_constraints.push_back(make_unique<BoundNotNullConstraint>(column.StorageOid()));
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 "ebe45abbb"
15
- #define DUCKDB_VERSION "v0.4.1-dev1564"
14
+ #define DUCKDB_SOURCE_ID "314b7e383"
15
+ #define DUCKDB_VERSION "v0.4.1-dev1574"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //