duckdb 0.8.1-dev0.0 → 0.8.1-dev23.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
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.8.1-dev0.0",
5
+ "version": "0.8.1-dev23.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -532,10 +532,6 @@ CatalogEntryLookup Catalog::LookupEntry(ClientContext &context, CatalogType type
532
532
  reference_set_t<SchemaCatalogEntry> schemas;
533
533
  if (IsInvalidSchema(schema)) {
534
534
  // try all schemas for this catalog
535
- auto catalog_name = GetName();
536
- if (catalog_name == DatabaseManager::GetDefaultDatabase(context)) {
537
- catalog_name = INVALID_CATALOG;
538
- }
539
535
  auto entries = GetCatalogEntries(context, GetName(), INVALID_SCHEMA);
540
536
  for (auto &entry : entries) {
541
537
  auto &candidate_schema = entry.schema;
@@ -100,6 +100,9 @@ void Vector::Reference(const Value &value) {
100
100
  }
101
101
 
102
102
  void Vector::Reference(Vector &other) {
103
+ if (other.GetType().id() != GetType().id()) {
104
+ throw InternalException("Vector::Reference used on vector of different type");
105
+ }
103
106
  D_ASSERT(other.GetType() == GetType());
104
107
  Reinterpret(other);
105
108
  }
@@ -180,6 +180,11 @@ void ExpressionExecutor::Execute(const Expression &expr, ExpressionState *state,
180
180
  if (count == 0) {
181
181
  return;
182
182
  }
183
+ if (result.GetType().id() != expr.return_type.id()) {
184
+ throw InternalException(
185
+ "ExpressionExecutor::Execute called with a result vector of type %s that does not match expression type %s",
186
+ result.GetType(), expr.return_type);
187
+ }
183
188
  switch (expr.expression_class) {
184
189
  case ExpressionClass::BOUND_BETWEEN:
185
190
  Execute((const BoundBetweenExpression &)expr, state, sel, count, result);
@@ -177,6 +177,8 @@ void BufferedCSVReaderOptions::SetReadOption(const string &loption, const Value
177
177
  null_padding = ParseBoolean(value, loption);
178
178
  } else if (loption == "allow_quoted_nulls") {
179
179
  allow_quoted_nulls = ParseBoolean(value, loption);
180
+ } else if (loption == "parallel") {
181
+ parallel_mode = ParseBoolean(value, loption) ? ParallelMode::PARALLEL : ParallelMode::SINGLE_THREADED;
180
182
  } else {
181
183
  throw BinderException("Unrecognized option for CSV reader \"%s\"", loption);
182
184
  }
@@ -176,9 +176,6 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, TableFunctio
176
176
  options.all_varchar = BooleanValue::Get(kv.second);
177
177
  } else if (loption == "normalize_names") {
178
178
  options.normalize_names = BooleanValue::Get(kv.second);
179
- } else if (loption == "parallel") {
180
- options.parallel_mode =
181
- BooleanValue::Get(kv.second) ? ParallelMode::PARALLEL : ParallelMode::SINGLE_THREADED;
182
179
  } else {
183
180
  options.SetReadOption(loption, kv.second, names);
184
181
  }
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.8.0"
2
+ #define DUCKDB_VERSION "0.8.1-dev23"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "e8e4cea5ec"
5
+ #define DUCKDB_SOURCE_ID "950d3d9532"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -24,13 +24,10 @@ namespace duckdb {
24
24
 
25
25
  //! Returns true if A and B are disjoint, false otherwise
26
26
  template <class T>
27
- static bool Disjoint(unordered_set<T> &a, unordered_set<T> &b) {
28
- for (auto &entry : a) {
29
- if (b.find(entry) != b.end()) {
30
- return false;
31
- }
32
- }
33
- return true;
27
+ static bool Disjoint(const unordered_set<T> &a, const unordered_set<T> &b) {
28
+ return std::all_of(a.begin(), a.end(), [&b](typename std::unordered_set<T>::const_reference entry) {
29
+ return b.find(entry) == b.end();
30
+ });
34
31
  }
35
32
 
36
33
  //! Extract the set of relations referred to inside an expression
@@ -243,18 +243,26 @@ void Binder::BindLogicalType(ClientContext &context, LogicalType &type, optional
243
243
  type = LogicalType::UNION(member_types);
244
244
  type.SetAlias(alias);
245
245
  } else if (type.id() == LogicalTypeId::USER) {
246
- auto &user_type_name = UserType::GetTypeName(type);
246
+ auto user_type_name = UserType::GetTypeName(type);
247
247
  if (catalog) {
248
+ // The search order is:
249
+ // 1) In the same schema as the table
250
+ // 2) In the same catalog
251
+ // 3) System catalog
248
252
  type = catalog->GetType(context, schema, user_type_name, OnEntryNotFound::RETURN_NULL);
253
+
249
254
  if (type.id() == LogicalTypeId::INVALID) {
250
- // look in the system catalog if the type was not found
251
- type = Catalog::GetType(context, SYSTEM_CATALOG, schema, user_type_name);
255
+ type = catalog->GetType(context, INVALID_SCHEMA, user_type_name, OnEntryNotFound::RETURN_NULL);
256
+ }
257
+
258
+ if (type.id() == LogicalTypeId::INVALID) {
259
+ type = Catalog::GetType(context, INVALID_CATALOG, schema, user_type_name);
252
260
  }
253
261
  } else {
254
262
  type = Catalog::GetType(context, INVALID_CATALOG, schema, user_type_name);
255
263
  }
256
264
  } else if (type.id() == LogicalTypeId::ENUM) {
257
- auto &enum_type_name = EnumType::GetTypeName(type);
265
+ auto enum_type_name = EnumType::GetTypeName(type);
258
266
  optional_ptr<TypeCatalogEntry> enum_type_catalog;
259
267
  if (catalog) {
260
268
  enum_type_catalog =
@@ -62,11 +62,11 @@ void ListColumnData::InitializeScanWithOffset(ColumnScanState &state, idx_t row_
62
62
 
63
63
  // we need to read the list at position row_idx to get the correct row offset of the child
64
64
  auto child_offset = row_idx == start ? 0 : FetchListOffset(row_idx - 1);
65
-
66
65
  D_ASSERT(child_offset <= child_column->GetMaxEntry());
67
66
  if (child_offset < child_column->GetMaxEntry()) {
68
67
  child_column->InitializeScanWithOffset(state.child_states[1], start + child_offset);
69
68
  }
69
+ state.last_offset = child_offset;
70
70
  }
71
71
 
72
72
  idx_t ListColumnData::Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result) {
@@ -108,9 +108,10 @@ idx_t ListColumnData::ScanCount(ColumnScanState &state, Vector &result, idx_t co
108
108
 
109
109
  if (child_scan_count > 0) {
110
110
  auto &child_entry = ListVector::GetEntry(result);
111
- D_ASSERT(child_entry.GetType().InternalType() == PhysicalType::STRUCT ||
112
- state.child_states[1].row_index + child_scan_count <=
113
- child_column->start + child_column->GetMaxEntry());
111
+ if (child_entry.GetType().InternalType() != PhysicalType::STRUCT &&
112
+ state.child_states[1].row_index + child_scan_count > child_column->start + child_column->GetMaxEntry()) {
113
+ throw InternalException("ListColumnData::ScanCount - internal list scan offset is out of range");
114
+ }
114
115
  child_column->ScanCount(state.child_states[1], child_entry, child_scan_count);
115
116
  }
116
117
  state.last_offset = last_entry;