duckdb 0.4.1-dev2403.0 → 0.4.1-dev2407.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.4.1-dev2403.0",
4
+ "version": "0.4.1-dev2407.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -50323,7 +50323,7 @@ vector<idx_t> ListVector::Search(Vector &list, const Value &key, idx_t row) {
50323
50323
  vector<idx_t> offsets;
50324
50324
 
50325
50325
  auto &list_vector = ListVector::GetEntry(list);
50326
- auto &entry = ((list_entry_t *)list.GetData())[row];
50326
+ auto &entry = ListVector::GetData(list)[row];
50327
50327
 
50328
50328
  switch (list_vector.GetType().InternalType()) {
50329
50329
  case PhysicalType::BOOL:
@@ -105196,7 +105196,7 @@ void FillResult(Value &values, Vector &result, idx_t row) {
105196
105196
  }
105197
105197
 
105198
105198
  //! now set the pointer
105199
- auto &entry = ((list_entry_t *)result.GetData())[row];
105199
+ auto &entry = ListVector::GetData(result)[row];
105200
105200
  entry.length = list_values.size();
105201
105201
  entry.offset = current_offset;
105202
105202
  }
@@ -105206,19 +105206,29 @@ static void MapExtractFunction(DataChunk &args, ExpressionState &state, Vector &
105206
105206
  D_ASSERT(args.data[0].GetType().id() == LogicalTypeId::MAP);
105207
105207
  result.SetVectorType(VectorType::FLAT_VECTOR);
105208
105208
 
105209
+ if (args.data[1].GetType().id() == LogicalTypeId::SQLNULL) {
105210
+ //! We don't need to look through the map if the 'key' to look for is NULL
105211
+ //! Because maps can't have NULL as key
105212
+ ListVector::SetListSize(result, 0);
105213
+ result.SetVectorType(VectorType::CONSTANT_VECTOR);
105214
+ auto list_data = ConstantVector::GetData<list_entry_t>(result);
105215
+ list_data->offset = 0;
105216
+ list_data->length = 0;
105217
+ result.Verify(args.size());
105218
+ return;
105219
+ }
105220
+
105209
105221
  auto &map = args.data[0];
105210
105222
  auto &key = args.data[1];
105211
105223
 
105212
- auto key_value = key.GetValue(0);
105213
105224
  UnifiedVectorFormat offset_data;
105214
105225
 
105215
105226
  auto &children = StructVector::GetEntries(map);
105227
+
105216
105228
  children[0]->ToUnifiedFormat(args.size(), offset_data);
105217
- auto &key_type = ListType::GetChildType(children[0]->GetType());
105218
- if (key_type != LogicalTypeId::SQLNULL) {
105219
- key_value = key_value.CastAs(key_type);
105220
- }
105221
105229
  for (idx_t row = 0; row < args.size(); row++) {
105230
+ idx_t row_index = offset_data.sel->get_index(row);
105231
+ auto key_value = key.GetValue(row_index);
105222
105232
  auto offsets = ListVector::Search(*children[0], key_value, offset_data.sel->get_index(row));
105223
105233
  auto values = ListVector::GetValuesFromOffsets(*children[1], offsets);
105224
105234
  FillResult(values, result, row);
@@ -105239,11 +105249,14 @@ static unique_ptr<FunctionData> MapExtractBind(ClientContext &context, ScalarFun
105239
105249
  if (arguments[0]->return_type.id() != LogicalTypeId::MAP) {
105240
105250
  throw BinderException("MAP_EXTRACT can only operate on MAPs");
105241
105251
  }
105242
- auto &child_types = StructType::GetChildTypes(arguments[0]->return_type);
105243
- auto &value_type = ListType::GetChildType(child_types[1].second);
105252
+ auto &value_type = MapType::ValueType(arguments[0]->return_type);
105244
105253
 
105245
105254
  //! Here we have to construct the List Type that will be returned
105246
105255
  bound_function.return_type = LogicalType::LIST(value_type);
105256
+ auto key_type = MapType::KeyType(arguments[0]->return_type);
105257
+ if (key_type.id() != LogicalTypeId::SQLNULL && arguments[1]->return_type.id() != LogicalTypeId::SQLNULL) {
105258
+ bound_function.arguments[1] = MapType::KeyType(arguments[0]->return_type);
105259
+ }
105247
105260
  return make_unique<VariableReturnBindData>(value_type);
105248
105261
  }
105249
105262
 
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 "784e66880"
15
- #define DUCKDB_VERSION "v0.4.1-dev2403"
14
+ #define DUCKDB_SOURCE_ID "109f932c4"
15
+ #define DUCKDB_VERSION "v0.4.1-dev2407"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //