duckdb 0.3.3-dev1395.0 → 0.3.3-dev1401.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.3.3-dev1395.0",
4
+ "version": "0.3.3-dev1401.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -71601,17 +71601,21 @@ void RadixPartitionedHashTable::GetData(ExecutionContext &context, DataChunk &ch
71601
71601
  // special case hack to sort out aggregating from empty intermediates
71602
71602
  // for aggregations without groups
71603
71603
  if (gstate.is_empty && grouping_set.empty()) {
71604
- D_ASSERT(chunk.ColumnCount() == op.aggregates.size());
71604
+ D_ASSERT(chunk.ColumnCount() == null_groups.size() + op.aggregates.size());
71605
71605
  // for each column in the aggregates, set to initial state
71606
71606
  chunk.SetCardinality(1);
71607
- for (idx_t i = 0; i < chunk.ColumnCount(); i++) {
71607
+ for (auto null_group : null_groups) {
71608
+ chunk.data[null_group].SetVectorType(VectorType::CONSTANT_VECTOR);
71609
+ ConstantVector::SetNull(chunk.data[null_group], true);
71610
+ }
71611
+ for (idx_t i = 0; i < op.aggregates.size(); i++) {
71608
71612
  D_ASSERT(op.aggregates[i]->GetExpressionClass() == ExpressionClass::BOUND_AGGREGATE);
71609
71613
  auto &aggr = (BoundAggregateExpression &)*op.aggregates[i];
71610
71614
  auto aggr_state = unique_ptr<data_t[]>(new data_t[aggr.function.state_size()]);
71611
71615
  aggr.function.initialize(aggr_state.get());
71612
71616
 
71613
71617
  Vector state_vector(Value::POINTER((uintptr_t)aggr_state.get()));
71614
- aggr.function.finalize(state_vector, aggr.bind_info.get(), chunk.data[i], 1, 0);
71618
+ aggr.function.finalize(state_vector, aggr.bind_info.get(), chunk.data[null_groups.size() + i], 1, 0);
71615
71619
  if (aggr.function.destructor) {
71616
71620
  aggr.function.destructor(state_vector, 1);
71617
71621
  }
@@ -84399,7 +84403,7 @@ char *StrfTimeFormat::Write2(char *target, uint8_t value) {
84399
84403
  }
84400
84404
 
84401
84405
  // write a value in the range of 0..99 padded to 2 digits
84402
- char *StrfTimeFormat::WritePadded2(char *target, int32_t value) {
84406
+ char *StrfTimeFormat::WritePadded2(char *target, uint32_t value) {
84403
84407
  D_ASSERT(value < 100);
84404
84408
  auto index = static_cast<unsigned>(value * 2);
84405
84409
  *target++ = duckdb_fmt::internal::data::digits[index];
@@ -84422,9 +84426,9 @@ char *StrfTimeFormat::WritePadded3(char *target, uint32_t value) {
84422
84426
  }
84423
84427
 
84424
84428
  // write a value in the range of 0..999999 padded to 6 digits
84425
- char *StrfTimeFormat::WritePadded(char *target, int32_t value, int32_t padding) {
84429
+ char *StrfTimeFormat::WritePadded(char *target, uint32_t value, size_t padding) {
84426
84430
  D_ASSERT(padding % 2 == 0);
84427
- for (int i = 0; i < padding / 2; i++) {
84431
+ for (size_t i = 0; i < padding / 2; i++) {
84428
84432
  int decimals = value % 100;
84429
84433
  WritePadded2(target + padding - 2 * (i + 1), decimals);
84430
84434
  value /= 100;
@@ -84599,6 +84603,7 @@ char *StrfTimeFormat::WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t
84599
84603
  }
84600
84604
 
84601
84605
  void StrfTimeFormat::FormatString(date_t date, int32_t data[7], char *target) {
84606
+ D_ASSERT(specifiers.size() + 1 == literals.size());
84602
84607
  idx_t i;
84603
84608
  for (i = 0; i < specifiers.size(); i++) {
84604
84609
  // first copy the current literal
@@ -84819,12 +84824,12 @@ struct StrfTimeBindData : public FunctionData {
84819
84824
  template <bool REVERSED>
84820
84825
  static unique_ptr<FunctionData> StrfTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
84821
84826
  vector<unique_ptr<Expression>> &arguments) {
84822
- if (!arguments[1]->IsFoldable()) {
84827
+ if (!arguments[REVERSED ? 0 : 1]->IsFoldable()) {
84823
84828
  throw InvalidInputException("strftime format must be a constant");
84824
84829
  }
84825
84830
  Value options_str = ExpressionExecutor::EvaluateScalar(*arguments[REVERSED ? 0 : 1]);
84826
84831
  StrfTimeFormat format;
84827
- if (!options_str.IsNull() && options_str.type().id() == LogicalTypeId::VARCHAR) {
84832
+ if (!options_str.IsNull()) {
84828
84833
  auto format_string = options_str.GetValue<string>();
84829
84834
  string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
84830
84835
  if (!error.empty()) {
@@ -104647,8 +104652,12 @@ void duckdb_destroy_value(duckdb_value *value) {
104647
104652
  }
104648
104653
  }
104649
104654
 
104655
+ duckdb_value duckdb_create_varchar_length(const char *text, idx_t length) {
104656
+ return (duckdb_value) new duckdb::Value(std::string(text, length));
104657
+ }
104658
+
104650
104659
  duckdb_value duckdb_create_varchar(const char *text) {
104651
- return (duckdb_value) new duckdb::Value(text);
104660
+ return duckdb_create_varchar_length(text, strlen(text));
104652
104661
  }
104653
104662
 
104654
104663
  duckdb_value duckdb_create_int64(int64_t input) {
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 "80ae1e12d"
15
- #define DUCKDB_VERSION "v0.3.3-dev1395"
14
+ #define DUCKDB_SOURCE_ID "29c1379da"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1401"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -15896,13 +15896,22 @@ Destroys the value and de-allocates all memory allocated for that type.
15896
15896
  DUCKDB_API void duckdb_destroy_value(duckdb_value *value);
15897
15897
 
15898
15898
  /*!
15899
- Creates a value from a varchar
15899
+ Creates a value from a null-terminated string
15900
15900
 
15901
- * value: The varchar value
15901
+ * value: The null-terminated string
15902
15902
  * returns: The value. This must be destroyed with `duckdb_destroy_value`.
15903
15903
  */
15904
15904
  DUCKDB_API duckdb_value duckdb_create_varchar(const char *text);
15905
15905
 
15906
+ /*!
15907
+ Creates a value from a string
15908
+
15909
+ * value: The text
15910
+ * length: The length of the text
15911
+ * returns: The value. This must be destroyed with `duckdb_destroy_value`.
15912
+ */
15913
+ DUCKDB_API duckdb_value duckdb_create_varchar_length(const char *text, idx_t length);
15914
+
15906
15915
  /*!
15907
15916
  Creates a value from an int64
15908
15917
 
@@ -21896,9 +21905,9 @@ protected:
21896
21905
  static idx_t GetSpecifierLength(StrTimeSpecifier specifier, date_t date, dtime_t time);
21897
21906
  char *WriteString(char *target, const string_t &str);
21898
21907
  char *Write2(char *target, uint8_t value);
21899
- char *WritePadded2(char *target, int32_t value);
21908
+ char *WritePadded2(char *target, uint32_t value);
21900
21909
  char *WritePadded3(char *target, uint32_t value);
21901
- char *WritePadded(char *target, int32_t value, int32_t padding);
21910
+ char *WritePadded(char *target, uint32_t value, size_t padding);
21902
21911
  bool IsDateSpecifier(StrTimeSpecifier specifier);
21903
21912
  char *WriteDateSpecifier(StrTimeSpecifier specifier, date_t date, char *target);
21904
21913
  char *WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t data[], char *target);