duckdb 0.8.2-dev1182.0 → 0.8.2-dev1212.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.
Files changed (28) hide show
  1. package/binding.gyp +7 -7
  2. package/package.json +1 -1
  3. package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -1
  4. package/src/duckdb/src/common/arrow/arrow_appender.cpp +0 -1
  5. package/src/duckdb/src/common/exception.cpp +2 -2
  6. package/src/duckdb/src/common/local_file_system.cpp +1 -1
  7. package/src/duckdb/src/common/re2_regex.cpp +1 -1
  8. package/src/duckdb/src/common/types/uuid.cpp +2 -2
  9. package/src/duckdb/src/core_functions/aggregate/holistic/reservoir_quantile.cpp +2 -0
  10. package/src/duckdb/src/execution/expression_executor.cpp +1 -1
  11. package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +3 -3
  12. package/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +1 -1
  13. package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +2 -2
  14. package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +1 -1
  15. package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +1 -1
  16. package/src/duckdb/src/execution/window_segment_tree.cpp +1 -1
  17. package/src/duckdb/src/function/function.cpp +1 -1
  18. package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
  19. package/src/duckdb/src/include/duckdb/execution/operator/persistent/base_csv_reader.hpp +1 -1
  20. package/src/duckdb/src/include/duckdb/main/connection.hpp +1 -2
  21. package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +1 -1
  22. package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +3 -3
  23. package/src/duckdb/src/main/capi/duckdb_value-c.cpp +1 -1
  24. package/src/duckdb/src/main/database.cpp +1 -1
  25. package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +1 -1
  26. package/src/duckdb/src/storage/compression/rle.cpp +0 -1
  27. package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +6 -6
  28. package/src/statement.cpp +2 -1
package/binding.gyp CHANGED
@@ -239,18 +239,18 @@
239
239
  "src/duckdb/third_party/zstd/compress/zstd_lazy.cpp",
240
240
  "src/duckdb/third_party/zstd/compress/zstd_ldm.cpp",
241
241
  "src/duckdb/third_party/zstd/compress/zstd_opt.cpp",
242
- "src/duckdb/extension/icu/./icu-datepart.cpp",
243
- "src/duckdb/extension/icu/./icu-timezone.cpp",
244
- "src/duckdb/extension/icu/./icu-makedate.cpp",
245
- "src/duckdb/extension/icu/./icu-table-range.cpp",
246
- "src/duckdb/extension/icu/./icu-datefunc.cpp",
247
242
  "src/duckdb/extension/icu/./icu-list-range.cpp",
248
- "src/duckdb/extension/icu/./icu-dateadd.cpp",
243
+ "src/duckdb/extension/icu/./icu-table-range.cpp",
249
244
  "src/duckdb/extension/icu/./icu-datesub.cpp",
245
+ "src/duckdb/extension/icu/./icu-dateadd.cpp",
250
246
  "src/duckdb/extension/icu/./icu-timebucket.cpp",
251
- "src/duckdb/extension/icu/./icu-strptime.cpp",
247
+ "src/duckdb/extension/icu/./icu-makedate.cpp",
248
+ "src/duckdb/extension/icu/./icu-timezone.cpp",
249
+ "src/duckdb/extension/icu/./icu-datefunc.cpp",
250
+ "src/duckdb/extension/icu/./icu-datepart.cpp",
252
251
  "src/duckdb/extension/icu/./icu_extension.cpp",
253
252
  "src/duckdb/extension/icu/./icu-datetrunc.cpp",
253
+ "src/duckdb/extension/icu/./icu-strptime.cpp",
254
254
  "src/duckdb/ub_extension_icu_third_party_icu_common.cpp",
255
255
  "src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp",
256
256
  "src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp",
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.2-dev1182.0",
5
+ "version": "0.8.2-dev1212.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -76,7 +76,7 @@ static shared_ptr<ParquetFileMetadataCache> LoadMetadata(Allocator &allocator, F
76
76
  }
77
77
  // read four-byte footer length from just before the end magic bytes
78
78
  auto footer_len = *reinterpret_cast<uint32_t *>(buf.ptr);
79
- if (footer_len <= 0 || file_size < 12 + footer_len) {
79
+ if (footer_len == 0 || file_size < 12 + footer_len) {
80
80
  throw InvalidInputException("Footer length error in file '%s'", file_handle.path);
81
81
  }
82
82
  auto metadata_pos = file_size - (footer_len + 8);
@@ -786,7 +786,6 @@ ArrowArray ArrowAppender::Finalize() {
786
786
 
787
787
  // Configure root array
788
788
  result.length = row_count;
789
- result.n_children = types.size();
790
789
  result.n_buffers = 1;
791
790
  result.buffers = root_holder->buffers.data(); // there is no actual buffer there since we don't have NULLs
792
791
  result.offset = 0;
@@ -62,11 +62,11 @@ string Exception::ConstructMessageRecursive(const string &msg, std::vector<Excep
62
62
  #ifdef DEBUG
63
63
  // Verify that we have the required amount of values for the message
64
64
  idx_t parameter_count = 0;
65
- for (idx_t i = 0; i < msg.size(); i++) {
65
+ for (idx_t i = 0; i + 1 < msg.size(); i++) {
66
66
  if (msg[i] != '%') {
67
67
  continue;
68
68
  }
69
- if (i < msg.size() && msg[i + 1] == '%') {
69
+ if (msg[i + 1] == '%') {
70
70
  i++;
71
71
  continue;
72
72
  }
@@ -375,7 +375,7 @@ int RemoveDirectoryRecursive(const char *path) {
375
375
  continue;
376
376
  }
377
377
  len = path_len + (idx_t)strlen(p->d_name) + 2;
378
- buf = new char[len];
378
+ buf = new (std::nothrow) char[len];
379
379
  if (buf) {
380
380
  struct stat statbuf;
381
381
  snprintf(buf, len, "%s/%s", path, p->d_name);
@@ -54,7 +54,7 @@ duckdb::vector<Match> RegexFindAll(const std::string &input, const Regex &regex)
54
54
  Match match;
55
55
  while (RegexSearchInternal(input.c_str(), match, regex, RE2::UNANCHORED, position, input.size())) {
56
56
  position += match.position(0) + match.length(0);
57
- matches.emplace_back(std::move(match));
57
+ matches.emplace_back(match);
58
58
  }
59
59
  return matches;
60
60
  }
@@ -49,7 +49,7 @@ bool UUID::FromString(string str, hugeint_t &result) {
49
49
  count++;
50
50
  }
51
51
  // Flip the first bit to make `order by uuid` same as `order by uuid::varchar`
52
- result.upper ^= (int64_t(1) << 63);
52
+ result.upper ^= (uint64_t(1) << 63);
53
53
  return count == 32;
54
54
  }
55
55
 
@@ -61,7 +61,7 @@ void UUID::ToString(hugeint_t input, char *buf) {
61
61
  };
62
62
 
63
63
  // Flip back before convert to string
64
- int64_t upper = input.upper ^ (int64_t(1) << 63);
64
+ int64_t upper = input.upper ^ (uint64_t(1) << 63);
65
65
  idx_t pos = 0;
66
66
  byte_to_hex(upper >> 56 & 0xFF, buf, pos);
67
67
  byte_to_hex(upper >> 48 & 0xFF, buf, pos);
@@ -21,8 +21,10 @@ struct ReservoirQuantileState {
21
21
  if (new_len <= len) {
22
22
  return;
23
23
  }
24
+ T *old_v = v;
24
25
  v = (T *)realloc(v, new_len * sizeof(T));
25
26
  if (!v) {
27
+ free(old_v);
26
28
  throw InternalException("Memory allocation failure");
27
29
  }
28
30
  len = new_len;
@@ -126,7 +126,7 @@ bool ExpressionExecutor::TryEvaluateScalar(ClientContext &context, const Express
126
126
  result = EvaluateScalar(context, expr);
127
127
  return true;
128
128
  } catch (InternalException &ex) {
129
- throw ex;
129
+ throw;
130
130
  } catch (...) {
131
131
  return false;
132
132
  }
@@ -395,15 +395,15 @@ struct WindowColumnIterator {
395
395
  return coll->GetCell<T>(pos + m);
396
396
  }
397
397
 
398
- friend inline iterator &operator+(const iterator &a, difference_type n) {
398
+ friend inline iterator operator+(const iterator &a, difference_type n) {
399
399
  return iterator(a.coll, a.pos + n);
400
400
  }
401
401
 
402
- friend inline iterator &operator-(const iterator &a, difference_type n) {
402
+ friend inline iterator operator-(const iterator &a, difference_type n) {
403
403
  return iterator(a.coll, a.pos - n);
404
404
  }
405
405
 
406
- friend inline iterator &operator+(difference_type n, const iterator &a) {
406
+ friend inline iterator operator+(difference_type n, const iterator &a) {
407
407
  return a + n;
408
408
  }
409
409
  friend inline difference_type operator-(const iterator &a, const iterator &b) {
@@ -669,7 +669,7 @@ public:
669
669
  //! The read cursor
670
670
  unique_ptr<PayloadScanner> scanner;
671
671
  //! Pointer to the matches
672
- const bool *found_match;
672
+ const bool *found_match = {};
673
673
  };
674
674
 
675
675
  AsOfLocalSourceState::AsOfLocalSourceState(AsOfGlobalSourceState &gsource, const PhysicalAsOfJoin &op)
@@ -167,8 +167,8 @@ PhysicalRangeJoin::PhysicalRangeJoin(LogicalOperator &op, PhysicalOperatorType t
167
167
  // TODO: use stats to improve the choice?
168
168
  // TODO: Prefer fixed length types?
169
169
  if (conditions.size() > 1) {
170
- auto conditions_p = std::move(conditions);
171
- conditions.resize(conditions_p.size());
170
+ vector<JoinCondition> conditions_p(conditions.size());
171
+ std::swap(conditions_p, conditions);
172
172
  idx_t range_position = 0;
173
173
  idx_t other_position = conditions_p.size();
174
174
  for (idx_t i = 0; i < conditions_p.size(); ++i) {
@@ -13,7 +13,7 @@ CSVFileHandle::CSVFileHandle(FileSystem &fs, Allocator &allocator, unique_ptr<Fi
13
13
 
14
14
  unique_ptr<FileHandle> CSVFileHandle::OpenFileHandle(FileSystem &fs, Allocator &allocator, const string &path,
15
15
  FileCompressionType compression) {
16
- auto file_handle = fs.OpenFile(path.c_str(), FileFlags::FILE_FLAGS_READ, FileLockType::NO_LOCK, compression);
16
+ auto file_handle = fs.OpenFile(path, FileFlags::FILE_FLAGS_READ, FileLockType::NO_LOCK, compression);
17
17
  if (file_handle->CanSeek()) {
18
18
  file_handle->Reset();
19
19
  }
@@ -41,7 +41,7 @@ PhysicalInsert::PhysicalInsert(vector<LogicalType> types_p, TableCatalogEntry &t
41
41
  return;
42
42
  }
43
43
 
44
- D_ASSERT(set_expressions.size() == set_columns.size());
44
+ D_ASSERT(this->set_expressions.size() == this->set_columns.size());
45
45
 
46
46
  // One or more columns are referenced from the existing table,
47
47
  // we use the 'insert_types' to figure out which types these columns have
@@ -14,7 +14,7 @@ namespace duckdb {
14
14
  WindowAggregateState::WindowAggregateState(AggregateObject aggr, const LogicalType &result_type_p,
15
15
  idx_t partition_count_p)
16
16
  : aggr(std::move(aggr)), result_type(result_type_p), partition_count(partition_count_p),
17
- state_size(aggr.function.state_size()), state(state_size),
17
+ state_size(this->aggr.function.state_size()), state(state_size),
18
18
  statef(Value::POINTER(CastPointerToValue(state.data()))), filter_pos(0),
19
19
  allocator(Allocator::DefaultAllocator()) {
20
20
  statef.SetVectorType(VectorType::FLAT_VECTOR); // Prevent conversion of results to constants
@@ -113,7 +113,7 @@ void BuiltinFunctions::Initialize() {
113
113
  hash_t BaseScalarFunction::Hash() const {
114
114
  hash_t hash = return_type.Hash();
115
115
  for (auto &arg : arguments) {
116
- duckdb::CombineHash(hash, arg.Hash());
116
+ hash = duckdb::CombineHash(hash, arg.Hash());
117
117
  }
118
118
  return hash;
119
119
  }
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.8.2-dev1182"
2
+ #define DUCKDB_VERSION "0.8.2-dev1212"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "c4b64ad14e"
5
+ #define DUCKDB_SOURCE_ID "dd12e0875d"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -37,7 +37,7 @@ class BaseCSVReader {
37
37
  public:
38
38
  BaseCSVReader(ClientContext &context, BufferedCSVReaderOptions options,
39
39
  const vector<LogicalType> &requested_types = vector<LogicalType>());
40
- ~BaseCSVReader();
40
+ virtual ~BaseCSVReader();
41
41
 
42
42
  ClientContext &context;
43
43
  FileSystem &fs;
@@ -169,8 +169,7 @@ public:
169
169
  template <typename TR, typename... Args>
170
170
  void CreateScalarFunction(const string &name, vector<LogicalType> args, LogicalType ret_type,
171
171
  TR (*udf_func)(Args...)) {
172
- scalar_function_t function =
173
- UDFWrapper::CreateScalarFunction<TR, Args...>(name, args, std::move(ret_type), udf_func);
172
+ scalar_function_t function = UDFWrapper::CreateScalarFunction<TR, Args...>(name, args, ret_type, udf_func);
174
173
  UDFWrapper::RegisterFunction(name, args, ret_type, function, *context);
175
174
  }
176
175
 
@@ -34,7 +34,7 @@ struct RelationsToTDom {
34
34
  bool has_tdom_hll;
35
35
  vector<FilterInfo *> filters;
36
36
 
37
- RelationsToTDom(column_binding_set_t column_binding_set)
37
+ RelationsToTDom(const column_binding_set_t &column_binding_set)
38
38
  : equivalent_relations(column_binding_set), tdom_hll(0), tdom_no_hll(NumericLimits<idx_t>::Maximum()),
39
39
  has_tdom_hll(false) {};
40
40
  };
@@ -23,9 +23,9 @@ public:
23
23
  : BoundConstraint(ConstraintType::UNIQUE), keys(std::move(keys)), key_set(std::move(key_set)),
24
24
  is_primary_key(is_primary_key) {
25
25
  #ifdef DEBUG
26
- D_ASSERT(keys.size() == key_set.size());
27
- for (auto &key : keys) {
28
- D_ASSERT(key_set.find(key) != key_set.end());
26
+ D_ASSERT(this->keys.size() == this->key_set.size());
27
+ for (auto &key : this->keys) {
28
+ D_ASSERT(this->key_set.find(key) != this->key_set.end());
29
29
  }
30
30
  #endif
31
31
  }
@@ -26,7 +26,7 @@ char *duckdb_get_varchar(duckdb_value value) {
26
26
  auto str_val = val->DefaultCastAs(duckdb::LogicalType::VARCHAR);
27
27
  auto &str = duckdb::StringValue::Get(str_val);
28
28
 
29
- auto result = reinterpret_cast<char *>(malloc(sizeof(char *) * (str.size() + 1)));
29
+ auto result = reinterpret_cast<char *>(malloc(sizeof(char) * (str.size() + 1)));
30
30
  memcpy(result, str.c_str(), str.size());
31
31
  result[str.size()] = '\0';
32
32
  return result;
@@ -178,7 +178,7 @@ void DatabaseInstance::CreateMainDatabase() {
178
178
  void ThrowExtensionSetUnrecognizedOptions(const unordered_map<string, Value> &unrecognized_options) {
179
179
  auto unrecognized_options_iter = unrecognized_options.begin();
180
180
  string unrecognized_option_keys = unrecognized_options_iter->first;
181
- for (; unrecognized_options_iter == unrecognized_options.end(); ++unrecognized_options_iter) {
181
+ while (++unrecognized_options_iter != unrecognized_options.end()) {
182
182
  unrecognized_option_keys = "," + unrecognized_options_iter->first;
183
183
  }
184
184
  throw InvalidInputException("Unrecognized configuration property \"%s\"", unrecognized_option_keys);
@@ -15,7 +15,7 @@ BoundAggregateExpression::BoundAggregateExpression(AggregateFunction function, v
15
15
  : Expression(ExpressionType::BOUND_AGGREGATE, ExpressionClass::BOUND_AGGREGATE, function.return_type),
16
16
  function(std::move(function)), children(std::move(children)), bind_info(std::move(bind_info)),
17
17
  aggr_type(aggr_type), filter(std::move(filter)) {
18
- D_ASSERT(!function.name.empty());
18
+ D_ASSERT(!this->function.name.empty());
19
19
  }
20
20
 
21
21
  string BoundAggregateExpression::ToString() const {
@@ -272,7 +272,6 @@ struct RLEScanState : public SegmentScanState {
272
272
  }
273
273
 
274
274
  BufferHandle handle;
275
- uint32_t rle_offset;
276
275
  idx_t entry_pos;
277
276
  idx_t position_in_entry;
278
277
  uint32_t rle_count_offset;
@@ -348,17 +348,17 @@
348
348
 
349
349
  #include "extension/icu/third_party/icu/i18n/wintzimpl.cpp"
350
350
 
351
- #include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"
352
-
353
- #include "extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp"
354
-
355
- #include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"
351
+ #include "extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp"
356
352
 
357
353
  #include "extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp"
358
354
 
355
+ #include "extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp"
356
+
359
357
  #include "extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp"
360
358
 
359
+ #include "extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp"
360
+
361
361
  #include "extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp"
362
362
 
363
- #include "extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp"
363
+ #include "extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp"
364
364
 
package/src/statement.cpp CHANGED
@@ -173,7 +173,8 @@ static Napi::Value convert_col_val(Napi::Env &env, duckdb::Value dval, duckdb::L
173
173
  if (negative) {
174
174
  duckdb::Hugeint::NegateInPlace(val); // remove signing bit
175
175
  }
176
- const uint64_t words[] = {val.lower, val.upper};
176
+ D_ASSERT(val.upper >= 0);
177
+ const uint64_t words[] = {val.lower, (uint64_t)val.upper};
177
178
  value = Napi::BigInt::New(env, negative, 2, words);
178
179
  } break;
179
180
  case duckdb::LogicalTypeId::DECIMAL: {