duckdb 0.3.3-dev811.0 → 0.3.3-dev835.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-dev811.0",
4
+ "version": "0.3.3-dev835.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -4216,7 +4216,7 @@ static DefaultMacro internal_macros[] = {
4216
4216
  {DEFAULT_SCHEMA, "list_prepend", {"e", "l", nullptr}, "list_concat(list_value(e), l)"},
4217
4217
  {DEFAULT_SCHEMA, "array_prepend", {"el", "arr", nullptr}, "list_prepend(el, arr)"},
4218
4218
  {DEFAULT_SCHEMA, "array_pop_back", {"arr", nullptr}, "arr[:LEN(arr)-1]"},
4219
- {DEFAULT_SCHEMA, "array_pop_front", {"arr", nullptr}, "arr[1:]"},
4219
+ {DEFAULT_SCHEMA, "array_pop_front", {"arr", nullptr}, "arr[2:]"},
4220
4220
  {DEFAULT_SCHEMA, "array_push_back", {"arr", "e", nullptr}, "list_concat(arr, list_value(e))"},
4221
4221
  {DEFAULT_SCHEMA, "array_push_front", {"arr", "e", nullptr}, "list_concat(list_value(e), arr)"},
4222
4222
  {DEFAULT_SCHEMA, "generate_subscripts", {"arr", "dim", nullptr}, "unnest(generate_series(1, array_length(arr, dim)))"},
@@ -15930,7 +15930,7 @@ bool LocalFileSystem::FileExists(const string &filename) {
15930
15930
  const wchar_t *wpath = unicode_path.c_str();
15931
15931
  if (_waccess(wpath, 0) == 0) {
15932
15932
  struct _stat64i32 status;
15933
- _wstat(wpath, &status);
15933
+ _wstat64i32(wpath, &status);
15934
15934
  if (status.st_size > 0) {
15935
15935
  return true;
15936
15936
  }
@@ -15942,7 +15942,7 @@ bool LocalFileSystem::IsPipe(const string &filename) {
15942
15942
  const wchar_t *wpath = unicode_path.c_str();
15943
15943
  if (_waccess(wpath, 0) == 0) {
15944
15944
  struct _stat64i32 status;
15945
- _wstat(wpath, &status);
15945
+ _wstat64i32(wpath, &status);
15946
15946
  if (status.st_size == 0) {
15947
15947
  return true;
15948
15948
  }
@@ -83851,7 +83851,7 @@ static void ExecuteSlice(Vector &result, Vector &s, Vector &b, Vector &e, const
83851
83851
  auto edata = ConstantVector::GetData<INDEX_TYPE>(e);
83852
83852
 
83853
83853
  auto sliced = sdata[0];
83854
- auto begin = bdata[0];
83854
+ auto begin = (bdata[0] > 0) ? bdata[0] - 1 : bdata[0];
83855
83855
  auto end = edata[0];
83856
83856
 
83857
83857
  auto svalid = !ConstantVector::IsNull(s);
@@ -83883,6 +83883,8 @@ static void ExecuteSlice(Vector &result, Vector &s, Vector &b, Vector &e, const
83883
83883
  auto begin = ((INDEX_TYPE *)bdata.data)[bidx];
83884
83884
  auto end = ((INDEX_TYPE *)edata.data)[eidx];
83885
83885
 
83886
+ begin = (begin > 0) ? begin - 1 : begin;
83887
+
83886
83888
  auto svalid = sdata.validity.RowIsValid(sidx);
83887
83889
  auto bvalid = bdata.validity.RowIsValid(bidx);
83888
83890
  auto evalid = edata.validity.RowIsValid(eidx);
@@ -84535,6 +84537,14 @@ void ListExtractTemplate(idx_t count, VectorData &list_data, VectorData &offsets
84535
84537
  if (list_data.validity.RowIsValid(list_index) && offsets_data.validity.RowIsValid(offsets_index)) {
84536
84538
  auto list_entry = ((list_entry_t *)list_data.data)[list_index];
84537
84539
  auto offsets_entry = ((int64_t *)offsets_data.data)[offsets_index];
84540
+
84541
+ // 1-based indexing
84542
+ if (offsets_entry == 0) {
84543
+ result_mask.SetInvalid(i);
84544
+ continue;
84545
+ }
84546
+ offsets_entry = (offsets_entry > 0) ? offsets_entry - 1 : offsets_entry;
84547
+
84538
84548
  idx_t child_offset;
84539
84549
  if (offsets_entry < 0) {
84540
84550
  if ((idx_t)-offsets_entry > list_entry.length) {
@@ -84649,7 +84659,7 @@ static void ExecuteListExtract(Vector &result, Vector &list, Vector &offsets, co
84649
84659
  static void ExecuteStringExtract(Vector &result, Vector &input_vector, Vector &subscript_vector, const idx_t count) {
84650
84660
  BinaryExecutor::Execute<string_t, int32_t, string_t>(
84651
84661
  input_vector, subscript_vector, result, count, [&](string_t input_string, int32_t subscript) {
84652
- return SubstringFun::SubstringScalarFunction(result, input_string, subscript + int32_t(subscript >= 0), 1);
84662
+ return SubstringFun::SubstringScalarFunction(result, input_string, subscript, 1);
84653
84663
  });
84654
84664
  }
84655
84665