duckdb 0.4.1-dev2193.0 → 0.4.1-dev2195.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-dev2193.0",
4
+ "version": "0.4.1-dev2195.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -28552,8 +28552,11 @@ struct RowOperations {
28552
28552
  static void Scatter(DataChunk &columns, UnifiedVectorFormat col_data[], const RowLayout &layout, Vector &rows,
28553
28553
  RowDataCollection &string_heap, const SelectionVector &sel, idx_t count);
28554
28554
  //! Gather a single column.
28555
+ //! If heap_ptr is not null, then the data is assumed to contain swizzled pointers,
28556
+ //! which will be unswizzled in memory.
28555
28557
  static void Gather(Vector &rows, const SelectionVector &row_sel, Vector &col, const SelectionVector &col_sel,
28556
- const idx_t count, const idx_t col_offset, const idx_t col_no, const idx_t build_size = 0);
28558
+ const idx_t count, const RowLayout &layout, const idx_t col_no, const idx_t build_size = 0,
28559
+ data_ptr_t heap_ptr = nullptr);
28557
28560
  //! Full Scan an entire columns
28558
28561
  static void FullScanColumn(const RowLayout &layout, Vector &rows, Vector &col, idx_t count, idx_t col_idx);
28559
28562
 
@@ -33373,9 +33376,11 @@ using ValidityBytes = RowLayout::ValidityBytes;
33373
33376
 
33374
33377
  template <class T>
33375
33378
  static void TemplatedGatherLoop(Vector &rows, const SelectionVector &row_sel, Vector &col,
33376
- const SelectionVector &col_sel, idx_t count, idx_t col_offset, idx_t col_no,
33379
+ const SelectionVector &col_sel, idx_t count, const RowLayout &layout, idx_t col_no,
33377
33380
  idx_t build_size) {
33378
33381
  // Precompute mask indexes
33382
+ const auto &offsets = layout.GetOffsets();
33383
+ const auto col_offset = offsets[col_no];
33379
33384
  idx_t entry_idx;
33380
33385
  idx_t idx_in_entry;
33381
33386
  ValidityBytes::GetEntryIndex(col_no, entry_idx, idx_in_entry);
@@ -33400,8 +33405,53 @@ static void TemplatedGatherLoop(Vector &rows, const SelectionVector &row_sel, Ve
33400
33405
  }
33401
33406
  }
33402
33407
 
33408
+ static void GatherVarchar(Vector &rows, const SelectionVector &row_sel, Vector &col, const SelectionVector &col_sel,
33409
+ idx_t count, const RowLayout &layout, idx_t col_no, idx_t build_size,
33410
+ data_ptr_t base_heap_ptr) {
33411
+ // Precompute mask indexes
33412
+ const auto &offsets = layout.GetOffsets();
33413
+ const auto col_offset = offsets[col_no];
33414
+ const auto heap_offset = layout.GetHeapOffset();
33415
+ idx_t entry_idx;
33416
+ idx_t idx_in_entry;
33417
+ ValidityBytes::GetEntryIndex(col_no, entry_idx, idx_in_entry);
33418
+
33419
+ auto ptrs = FlatVector::GetData<data_ptr_t>(rows);
33420
+ auto data = FlatVector::GetData<string_t>(col);
33421
+ auto &col_mask = FlatVector::Validity(col);
33422
+
33423
+ for (idx_t i = 0; i < count; i++) {
33424
+ auto row_idx = row_sel.get_index(i);
33425
+ auto row = ptrs[row_idx];
33426
+ auto col_idx = col_sel.get_index(i);
33427
+ auto col_ptr = row + col_offset;
33428
+ data[col_idx] = Load<string_t>(col_ptr);
33429
+ ValidityBytes row_mask(row);
33430
+ if (!row_mask.RowIsValid(row_mask.GetValidityEntry(entry_idx), idx_in_entry)) {
33431
+ if (build_size > STANDARD_VECTOR_SIZE && col_mask.AllValid()) {
33432
+ //! We need to initialize the mask with the vector size.
33433
+ col_mask.Initialize(build_size);
33434
+ }
33435
+ col_mask.SetInvalid(col_idx);
33436
+ } else if (base_heap_ptr && Load<uint32_t>(col_ptr) > string_t::INLINE_LENGTH) {
33437
+ // Not inline, so unswizzle the copied pointer the pointer
33438
+ auto heap_ptr_ptr = row + heap_offset;
33439
+ auto heap_row_ptr = base_heap_ptr + Load<idx_t>(heap_ptr_ptr);
33440
+ auto string_ptr = data_ptr_t(data + col_idx) + sizeof(uint32_t) + string_t::PREFIX_LENGTH;
33441
+ Store<data_ptr_t>(heap_row_ptr + Load<idx_t>(string_ptr), string_ptr);
33442
+ #ifdef DEBUG
33443
+ data[col_idx].Verify();
33444
+ #endif
33445
+ }
33446
+ }
33447
+ }
33448
+
33403
33449
  static void GatherNestedVector(Vector &rows, const SelectionVector &row_sel, Vector &col,
33404
- const SelectionVector &col_sel, idx_t count, idx_t col_offset, idx_t col_no) {
33450
+ const SelectionVector &col_sel, idx_t count, const RowLayout &layout, idx_t col_no,
33451
+ data_ptr_t base_heap_ptr) {
33452
+ const auto &offsets = layout.GetOffsets();
33453
+ const auto col_offset = offsets[col_no];
33454
+ const auto heap_offset = layout.GetHeapOffset();
33405
33455
  auto ptrs = FlatVector::GetData<data_ptr_t>(rows);
33406
33456
 
33407
33457
  // Build the gather locations
@@ -33409,8 +33459,16 @@ static void GatherNestedVector(Vector &rows, const SelectionVector &row_sel, Vec
33409
33459
  auto mask_locations = unique_ptr<data_ptr_t[]>(new data_ptr_t[count]);
33410
33460
  for (idx_t i = 0; i < count; i++) {
33411
33461
  auto row_idx = row_sel.get_index(i);
33412
- mask_locations[i] = ptrs[row_idx];
33413
- data_locations[i] = Load<data_ptr_t>(ptrs[row_idx] + col_offset);
33462
+ auto row = ptrs[row_idx];
33463
+ mask_locations[i] = row;
33464
+ auto col_ptr = ptrs[row_idx] + col_offset;
33465
+ if (base_heap_ptr) {
33466
+ auto heap_ptr_ptr = row + heap_offset;
33467
+ auto heap_row_ptr = base_heap_ptr + Load<idx_t>(heap_ptr_ptr);
33468
+ data_locations[i] = heap_row_ptr + Load<idx_t>(col_ptr);
33469
+ } else {
33470
+ data_locations[i] = Load<data_ptr_t>(col_ptr);
33471
+ }
33414
33472
  }
33415
33473
 
33416
33474
  // Deserialise into the selected locations
@@ -33418,56 +33476,57 @@ static void GatherNestedVector(Vector &rows, const SelectionVector &row_sel, Vec
33418
33476
  }
33419
33477
 
33420
33478
  void RowOperations::Gather(Vector &rows, const SelectionVector &row_sel, Vector &col, const SelectionVector &col_sel,
33421
- const idx_t count, const idx_t col_offset, const idx_t col_no, const idx_t build_size) {
33479
+ const idx_t count, const RowLayout &layout, const idx_t col_no, const idx_t build_size,
33480
+ data_ptr_t heap_ptr) {
33422
33481
  D_ASSERT(rows.GetVectorType() == VectorType::FLAT_VECTOR);
33423
33482
  D_ASSERT(rows.GetType().id() == LogicalTypeId::POINTER); // "Cannot gather from non-pointer type!"
33424
33483
 
33425
33484
  col.SetVectorType(VectorType::FLAT_VECTOR);
33426
33485
  switch (col.GetType().InternalType()) {
33427
33486
  case PhysicalType::UINT8:
33428
- TemplatedGatherLoop<uint8_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33487
+ TemplatedGatherLoop<uint8_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33429
33488
  break;
33430
33489
  case PhysicalType::UINT16:
33431
- TemplatedGatherLoop<uint16_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33490
+ TemplatedGatherLoop<uint16_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33432
33491
  break;
33433
33492
  case PhysicalType::UINT32:
33434
- TemplatedGatherLoop<uint32_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33493
+ TemplatedGatherLoop<uint32_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33435
33494
  break;
33436
33495
  case PhysicalType::UINT64:
33437
- TemplatedGatherLoop<uint64_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33496
+ TemplatedGatherLoop<uint64_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33438
33497
  break;
33439
33498
  case PhysicalType::BOOL:
33440
33499
  case PhysicalType::INT8:
33441
- TemplatedGatherLoop<int8_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33500
+ TemplatedGatherLoop<int8_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33442
33501
  break;
33443
33502
  case PhysicalType::INT16:
33444
- TemplatedGatherLoop<int16_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33503
+ TemplatedGatherLoop<int16_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33445
33504
  break;
33446
33505
  case PhysicalType::INT32:
33447
- TemplatedGatherLoop<int32_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33506
+ TemplatedGatherLoop<int32_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33448
33507
  break;
33449
33508
  case PhysicalType::INT64:
33450
- TemplatedGatherLoop<int64_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33509
+ TemplatedGatherLoop<int64_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33451
33510
  break;
33452
33511
  case PhysicalType::INT128:
33453
- TemplatedGatherLoop<hugeint_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33512
+ TemplatedGatherLoop<hugeint_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33454
33513
  break;
33455
33514
  case PhysicalType::FLOAT:
33456
- TemplatedGatherLoop<float>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33515
+ TemplatedGatherLoop<float>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33457
33516
  break;
33458
33517
  case PhysicalType::DOUBLE:
33459
- TemplatedGatherLoop<double>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33518
+ TemplatedGatherLoop<double>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33460
33519
  break;
33461
33520
  case PhysicalType::INTERVAL:
33462
- TemplatedGatherLoop<interval_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33521
+ TemplatedGatherLoop<interval_t>(rows, row_sel, col, col_sel, count, layout, col_no, build_size);
33463
33522
  break;
33464
33523
  case PhysicalType::VARCHAR:
33465
- TemplatedGatherLoop<string_t>(rows, row_sel, col, col_sel, count, col_offset, col_no, build_size);
33524
+ GatherVarchar(rows, row_sel, col, col_sel, count, layout, col_no, build_size, heap_ptr);
33466
33525
  break;
33467
33526
  case PhysicalType::LIST:
33468
33527
  case PhysicalType::MAP:
33469
33528
  case PhysicalType::STRUCT:
33470
- GatherNestedVector(rows, row_sel, col, col_sel, count, col_offset, col_no);
33529
+ GatherNestedVector(rows, row_sel, col, col_sel, count, layout, col_no, heap_ptr);
33471
33530
  break;
33472
33531
  default:
33473
33532
  throw InternalException("Unimplemented type for RowOperations::Gather");
@@ -34266,11 +34325,11 @@ static void TemplatedMatchType(UnifiedVectorFormat &col, Vector &rows, Selection
34266
34325
  }
34267
34326
 
34268
34327
  template <class OP, bool NO_MATCH_SEL>
34269
- static void TemplatedMatchNested(Vector &col, Vector &rows, SelectionVector &sel, idx_t &count, const idx_t col_offset,
34328
+ static void TemplatedMatchNested(Vector &col, Vector &rows, SelectionVector &sel, idx_t &count, const RowLayout &layout,
34270
34329
  const idx_t col_no, SelectionVector *no_match, idx_t &no_match_count) {
34271
34330
  // Gather a dense Vector containing the column values being matched
34272
34331
  Vector key(col.GetType());
34273
- RowOperations::Gather(rows, sel, key, *FlatVector::IncrementalSelectionVector(), count, col_offset, col_no);
34332
+ RowOperations::Gather(rows, sel, key, *FlatVector::IncrementalSelectionVector(), count, layout, col_no);
34274
34333
 
34275
34334
  // Densify the input column
34276
34335
  Vector sliced(col, sel, count);
@@ -34350,7 +34409,7 @@ static void TemplatedMatchOp(Vector &vec, UnifiedVectorFormat &col, const RowLay
34350
34409
  case PhysicalType::LIST:
34351
34410
  case PhysicalType::MAP:
34352
34411
  case PhysicalType::STRUCT:
34353
- TemplatedMatchNested<OP, NO_MATCH_SEL>(vec, rows, sel, count, col_offset, col_no, no_match, no_match_count);
34412
+ TemplatedMatchNested<OP, NO_MATCH_SEL>(vec, rows, sel, count, layout, col_no, no_match, no_match_count);
34354
34413
  break;
34355
34414
  default:
34356
34415
  throw InternalException("Unsupported column type for RowOperations::Match");
@@ -37854,10 +37913,9 @@ void PayloadScanner::Scan(DataChunk &chunk) {
37854
37913
  }
37855
37914
  D_ASSERT(scanned == count);
37856
37915
  // Deserialize the payload data
37857
- for (idx_t col_idx = 0; col_idx < sorted_data.layout.ColumnCount(); col_idx++) {
37858
- const auto col_offset = sorted_data.layout.GetOffsets()[col_idx];
37859
- RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), chunk.data[col_idx],
37860
- *FlatVector::IncrementalSelectionVector(), count, col_offset, col_idx);
37916
+ for (idx_t col_no = 0; col_no < sorted_data.layout.ColumnCount(); col_no++) {
37917
+ RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), chunk.data[col_no],
37918
+ *FlatVector::IncrementalSelectionVector(), count, sorted_data.layout, col_no);
37861
37919
  }
37862
37920
  chunk.SetCardinality(count);
37863
37921
  chunk.Verify();
@@ -45757,10 +45815,9 @@ void RowDataCollectionScanner::Scan(DataChunk &chunk) {
45757
45815
  }
45758
45816
  D_ASSERT(scanned == count);
45759
45817
  // Deserialize the payload data
45760
- for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) {
45761
- const auto col_offset = layout.GetOffsets()[col_idx];
45762
- RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), chunk.data[col_idx],
45763
- *FlatVector::IncrementalSelectionVector(), count, col_offset, col_idx);
45818
+ for (idx_t col_no = 0; col_no < layout.ColumnCount(); col_no++) {
45819
+ RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), chunk.data[col_no],
45820
+ *FlatVector::IncrementalSelectionVector(), count, layout, col_no);
45764
45821
  }
45765
45822
  chunk.SetCardinality(count);
45766
45823
  chunk.Verify();
@@ -56961,11 +57018,10 @@ void GroupedAggregateHashTable::FlushMove(FlushMoveState &state, Vector &source_
56961
57018
 
56962
57019
  state.groups.Reset();
56963
57020
  state.groups.SetCardinality(count);
56964
- for (idx_t i = 0; i < state.groups.ColumnCount(); i++) {
56965
- auto &column = state.groups.data[i];
56966
- const auto col_offset = layout.GetOffsets()[i];
57021
+ for (idx_t col_no = 0; col_no < state.groups.ColumnCount(); col_no++) {
57022
+ auto &column = state.groups.data[col_no];
56967
57023
  RowOperations::Gather(source_addresses, *FlatVector::IncrementalSelectionVector(), column,
56968
- *FlatVector::IncrementalSelectionVector(), count, col_offset, i);
57024
+ *FlatVector::IncrementalSelectionVector(), count, layout, col_no);
56969
57025
  }
56970
57026
 
56971
57027
  FindOrCreateGroups(state.groups, source_hashes, state.group_addresses, state.new_groups_sel);
@@ -57086,11 +57142,10 @@ idx_t GroupedAggregateHashTable::Scan(idx_t &scan_position, DataChunk &result) {
57086
57142
  result.SetCardinality(this_n);
57087
57143
  // fetch the group columns (ignoring the final hash column
57088
57144
  const auto group_cols = layout.ColumnCount() - 1;
57089
- for (idx_t i = 0; i < group_cols; i++) {
57090
- auto &column = result.data[i];
57091
- const auto col_offset = layout.GetOffsets()[i];
57145
+ for (idx_t col_no = 0; col_no < group_cols; col_no++) {
57146
+ auto &column = result.data[col_no];
57092
57147
  RowOperations::Gather(addresses, *FlatVector::IncrementalSelectionVector(), column,
57093
- *FlatVector::IncrementalSelectionVector(), result.size(), col_offset, i);
57148
+ *FlatVector::IncrementalSelectionVector(), result.size(), layout, col_no);
57094
57149
  }
57095
57150
 
57096
57151
  RowOperations::FinalizeStates(layout, addresses, result, group_cols);
@@ -61748,8 +61803,7 @@ void ScanStructure::AdvancePointers() {
61748
61803
 
61749
61804
  void ScanStructure::GatherResult(Vector &result, const SelectionVector &result_vector,
61750
61805
  const SelectionVector &sel_vector, const idx_t count, const idx_t col_no) {
61751
- const auto col_offset = ht.layout.GetOffsets()[col_no];
61752
- RowOperations::Gather(pointers, sel_vector, result, result_vector, count, col_offset, col_no);
61806
+ RowOperations::Gather(pointers, sel_vector, result, result_vector, count, ht.layout, col_no);
61753
61807
  }
61754
61808
 
61755
61809
  void ScanStructure::GatherResult(Vector &result, const SelectionVector &sel_vector, const idx_t count,
@@ -62092,8 +62146,7 @@ void JoinHashTable::GatherFullOuter(DataChunk &result, Vector &addresses, idx_t
62092
62146
  auto &vector = result.data[left_column_count + i];
62093
62147
  D_ASSERT(vector.GetType() == build_types[i]);
62094
62148
  const auto col_no = condition_types.size() + i;
62095
- const auto col_offset = layout.GetOffsets()[col_no];
62096
- RowOperations::Gather(addresses, sel_vector, vector, sel_vector, found_entries, col_offset, col_no);
62149
+ RowOperations::Gather(addresses, sel_vector, vector, sel_vector, found_entries, layout, col_no);
62097
62150
  }
62098
62151
  }
62099
62152
 
@@ -69348,8 +69401,7 @@ bool PerfectHashJoinExecutor::FullScanHashTable(JoinHTScanState &state, LogicalT
69348
69401
  auto &vector = perfect_hash_table[i];
69349
69402
  D_ASSERT(vector.GetType() == ht.build_types[i]);
69350
69403
  const auto col_no = ht.condition_types.size() + i;
69351
- const auto col_offset = ht.layout.GetOffsets()[col_no];
69352
- RowOperations::Gather(tuples_addresses, sel_tuples, vector, sel_build, keys_count, col_offset, col_no,
69404
+ RowOperations::Gather(tuples_addresses, sel_tuples, vector, sel_build, keys_count, ht.layout, col_no,
69353
69405
  build_size);
69354
69406
  }
69355
69407
  return true;
@@ -71518,8 +71570,10 @@ public:
71518
71570
 
71519
71571
  public:
71520
71572
  // Gather the result values and slice the payload columns to those values.
71521
- static void SliceSortedPayload(DataChunk &payload, GlobalSortState &state, const idx_t block_idx,
71522
- const SelectionVector &result, const idx_t result_count, const idx_t left_cols = 0);
71573
+ // Returns a buffer handle to the pinned heap block (if any)
71574
+ static BufferHandle SliceSortedPayload(DataChunk &payload, GlobalSortState &state, const idx_t block_idx,
71575
+ const SelectionVector &result, const idx_t result_count,
71576
+ const idx_t left_cols = 0);
71523
71577
  // Apply a tail condition to the current selection
71524
71578
  static idx_t SelectJoinTail(const ExpressionType &condition, Vector &left, Vector &right,
71525
71579
  const SelectionVector *sel, idx_t count, SelectionVector *true_sel);
@@ -73946,6 +74000,7 @@ public:
73946
74000
  DataChunk rhs_keys;
73947
74001
  DataChunk rhs_input;
73948
74002
  ExpressionExecutor rhs_executor;
74003
+ BufferHandle payload_heap_handle;
73949
74004
 
73950
74005
  public:
73951
74006
  void ResolveJoinKeys(DataChunk &input) {
@@ -74295,8 +74350,8 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte
74295
74350
  for (idx_t c = 0; c < state.lhs_payload.ColumnCount(); ++c) {
74296
74351
  chunk.data[c].Slice(state.lhs_payload.data[c], left_info.result, result_count);
74297
74352
  }
74298
- SliceSortedPayload(chunk, right_info.state, right_info.block_idx, right_info.result, result_count,
74299
- left_cols);
74353
+ state.payload_heap_handle = SliceSortedPayload(chunk, right_info.state, right_info.block_idx,
74354
+ right_info.result, result_count, left_cols);
74300
74355
  chunk.SetCardinality(result_count);
74301
74356
 
74302
74357
  auto sel = FlatVector::IncrementalSelectionVector();
@@ -74736,9 +74791,9 @@ idx_t PhysicalRangeJoin::LocalSortedTable::MergeNulls(const vector<JoinCondition
74736
74791
  }
74737
74792
  }
74738
74793
 
74739
- void PhysicalRangeJoin::SliceSortedPayload(DataChunk &payload, GlobalSortState &state, const idx_t block_idx,
74740
- const SelectionVector &result, const idx_t result_count,
74741
- const idx_t left_cols) {
74794
+ BufferHandle PhysicalRangeJoin::SliceSortedPayload(DataChunk &payload, GlobalSortState &state, const idx_t block_idx,
74795
+ const SelectionVector &result, const idx_t result_count,
74796
+ const idx_t left_cols) {
74742
74797
  // There should only be one sorted block if they have been sorted
74743
74798
  D_ASSERT(state.sorted_blocks.size() == 1);
74744
74799
  SBScanState read_state(state.buffer_manager, state);
@@ -74748,6 +74803,7 @@ void PhysicalRangeJoin::SliceSortedPayload(DataChunk &payload, GlobalSortState &
74748
74803
  read_state.SetIndices(block_idx, 0);
74749
74804
  read_state.PinData(sorted_data);
74750
74805
  const auto data_ptr = read_state.DataPtr(sorted_data);
74806
+ data_ptr_t heap_ptr = nullptr;
74751
74807
 
74752
74808
  // Set up a batch of pointers to scan data from
74753
74809
  Vector addresses(LogicalType::POINTER, result_count);
@@ -74773,19 +74829,18 @@ void PhysicalRangeJoin::SliceSortedPayload(DataChunk &payload, GlobalSortState &
74773
74829
 
74774
74830
  // Unswizzle the offsets back to pointers (if needed)
74775
74831
  if (!sorted_data.layout.AllConstant() && state.external) {
74776
- RowOperations::UnswizzlePointers(sorted_data.layout, data_ptr, read_state.payload_heap_handle.Ptr(),
74777
- addr_count);
74778
- sorted_data.data_blocks[read_state.block_idx]->block->SetSwizzling("PhysicalRangeJoin::SliceSortedPayload");
74832
+ heap_ptr = read_state.payload_heap_handle.Ptr();
74779
74833
  }
74780
74834
 
74781
74835
  // Deserialize the payload data
74782
74836
  auto sel = FlatVector::IncrementalSelectionVector();
74783
- for (idx_t col_idx = 0; col_idx < sorted_data.layout.ColumnCount(); col_idx++) {
74784
- const auto col_offset = sorted_data.layout.GetOffsets()[col_idx];
74785
- auto &col = payload.data[left_cols + col_idx];
74786
- RowOperations::Gather(addresses, *sel, col, *sel, addr_count, col_offset, col_idx);
74837
+ for (idx_t col_no = 0; col_no < sorted_data.layout.ColumnCount(); col_no++) {
74838
+ auto &col = payload.data[left_cols + col_no];
74839
+ RowOperations::Gather(addresses, *sel, col, *sel, addr_count, sorted_data.layout, col_no, 0, heap_ptr);
74787
74840
  col.Slice(gsel, result_count);
74788
74841
  }
74842
+
74843
+ return move(read_state.payload_heap_handle);
74789
74844
  }
74790
74845
 
74791
74846
  idx_t PhysicalRangeJoin::SelectJoinTail(const ExpressionType &condition, Vector &left, Vector &right,
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 "28c9eb44a"
15
- #define DUCKDB_VERSION "v0.4.1-dev2193"
14
+ #define DUCKDB_SOURCE_ID "0e8ff9fff"
15
+ #define DUCKDB_VERSION "v0.4.1-dev2195"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //