duckdb 0.3.3-dev1393.0 → 0.3.3-dev1399.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-dev1393.0",
4
+ "version": "0.3.3-dev1399.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -74887,9 +74887,9 @@ struct VectorMinMaxBase {
74887
74887
  const auto sidx = sdata.sel->get_index(i);
74888
74888
  auto state = states[sidx];
74889
74889
  if (!state->value) {
74890
- Assign(state, input, idx);
74890
+ Assign(state, input, i);
74891
74891
  } else {
74892
- OP::template Execute(state, input, idx, count);
74892
+ OP::template Execute(state, input, i, count);
74893
74893
  }
74894
74894
  }
74895
74895
  }
@@ -74908,10 +74908,19 @@ struct VectorMinMaxBase {
74908
74908
  template <class T, class STATE>
74909
74909
  static void Finalize(Vector &result, FunctionData *, STATE *state, T *target, ValidityMask &mask, idx_t idx) {
74910
74910
  if (!state->value) {
74911
- // we need to use FlatVector::SetNull here
74911
+ // we need to use SetNull here
74912
74912
  // since for STRUCT columns only setting the validity mask of the struct is incorrect
74913
74913
  // as for a struct column, we need to also set ALL child columns to NULL
74914
- FlatVector::SetNull(result, idx, true);
74914
+ switch (result.GetVectorType()) {
74915
+ case VectorType::FLAT_VECTOR:
74916
+ FlatVector::SetNull(result, idx, true);
74917
+ break;
74918
+ case VectorType::CONSTANT_VECTOR:
74919
+ ConstantVector::SetNull(result, true);
74920
+ break;
74921
+ default:
74922
+ throw InternalException("Invalid result vector type for nested min/max");
74923
+ }
74915
74924
  } else {
74916
74925
  VectorOperations::Copy(*state->value, result, 1, 0, idx);
74917
74926
  }
@@ -84390,7 +84399,7 @@ char *StrfTimeFormat::Write2(char *target, uint8_t value) {
84390
84399
  }
84391
84400
 
84392
84401
  // write a value in the range of 0..99 padded to 2 digits
84393
- char *StrfTimeFormat::WritePadded2(char *target, int32_t value) {
84402
+ char *StrfTimeFormat::WritePadded2(char *target, uint32_t value) {
84394
84403
  D_ASSERT(value < 100);
84395
84404
  auto index = static_cast<unsigned>(value * 2);
84396
84405
  *target++ = duckdb_fmt::internal::data::digits[index];
@@ -84413,9 +84422,9 @@ char *StrfTimeFormat::WritePadded3(char *target, uint32_t value) {
84413
84422
  }
84414
84423
 
84415
84424
  // write a value in the range of 0..999999 padded to 6 digits
84416
- char *StrfTimeFormat::WritePadded(char *target, int32_t value, int32_t padding) {
84425
+ char *StrfTimeFormat::WritePadded(char *target, uint32_t value, size_t padding) {
84417
84426
  D_ASSERT(padding % 2 == 0);
84418
- for (int i = 0; i < padding / 2; i++) {
84427
+ for (size_t i = 0; i < padding / 2; i++) {
84419
84428
  int decimals = value % 100;
84420
84429
  WritePadded2(target + padding - 2 * (i + 1), decimals);
84421
84430
  value /= 100;
@@ -84590,6 +84599,7 @@ char *StrfTimeFormat::WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t
84590
84599
  }
84591
84600
 
84592
84601
  void StrfTimeFormat::FormatString(date_t date, int32_t data[7], char *target) {
84602
+ D_ASSERT(specifiers.size() + 1 == literals.size());
84593
84603
  idx_t i;
84594
84604
  for (i = 0; i < specifiers.size(); i++) {
84595
84605
  // first copy the current literal
@@ -84810,12 +84820,12 @@ struct StrfTimeBindData : public FunctionData {
84810
84820
  template <bool REVERSED>
84811
84821
  static unique_ptr<FunctionData> StrfTimeBindFunction(ClientContext &context, ScalarFunction &bound_function,
84812
84822
  vector<unique_ptr<Expression>> &arguments) {
84813
- if (!arguments[1]->IsFoldable()) {
84823
+ if (!arguments[REVERSED ? 0 : 1]->IsFoldable()) {
84814
84824
  throw InvalidInputException("strftime format must be a constant");
84815
84825
  }
84816
84826
  Value options_str = ExpressionExecutor::EvaluateScalar(*arguments[REVERSED ? 0 : 1]);
84817
84827
  StrfTimeFormat format;
84818
- if (!options_str.IsNull() && options_str.type().id() == LogicalTypeId::VARCHAR) {
84828
+ if (!options_str.IsNull()) {
84819
84829
  auto format_string = options_str.GetValue<string>();
84820
84830
  string error = StrTimeFormat::ParseFormatSpecifier(format_string, format);
84821
84831
  if (!error.empty()) {
@@ -104638,8 +104648,12 @@ void duckdb_destroy_value(duckdb_value *value) {
104638
104648
  }
104639
104649
  }
104640
104650
 
104651
+ duckdb_value duckdb_create_varchar_length(const char *text, idx_t length) {
104652
+ return (duckdb_value) new duckdb::Value(std::string(text, length));
104653
+ }
104654
+
104641
104655
  duckdb_value duckdb_create_varchar(const char *text) {
104642
- return (duckdb_value) new duckdb::Value(text);
104656
+ return duckdb_create_varchar_length(text, strlen(text));
104643
104657
  }
104644
104658
 
104645
104659
  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 "dece0efa7"
15
- #define DUCKDB_VERSION "v0.3.3-dev1393"
14
+ #define DUCKDB_SOURCE_ID "7c5ba6c0e"
15
+ #define DUCKDB_VERSION "v0.3.3-dev1399"
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);