duckdb 0.3.2-dev656.0 → 0.3.2-dev658.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.2-dev656.0",
4
+ "version": "0.3.2-dev658.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -65497,6 +65497,7 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalChunkGet &
65497
65497
 
65498
65498
 
65499
65499
 
65500
+
65500
65501
  namespace duckdb {
65501
65502
 
65502
65503
  static bool CanPlanIndexJoin(Transaction &transaction, TableScanBindData *bind_data, PhysicalTableScan &scan) {
@@ -65516,6 +65517,30 @@ static bool CanPlanIndexJoin(Transaction &transaction, TableScanBindData *bind_d
65516
65517
  return true;
65517
65518
  }
65518
65519
 
65520
+ bool ExtractNumericValue(Value val, int64_t &result) {
65521
+ if (!val.type().IsIntegral()) {
65522
+ switch (val.type().InternalType()) {
65523
+ case PhysicalType::INT16:
65524
+ result = val.GetValueUnsafe<int16_t>();
65525
+ break;
65526
+ case PhysicalType::INT32:
65527
+ result = val.GetValueUnsafe<int32_t>();
65528
+ break;
65529
+ case PhysicalType::INT64:
65530
+ result = val.GetValueUnsafe<int64_t>();
65531
+ break;
65532
+ default:
65533
+ return false;
65534
+ }
65535
+ } else {
65536
+ if (!val.TryCastAs(LogicalType::BIGINT)) {
65537
+ return false;
65538
+ }
65539
+ result = val.GetValue<int64_t>();
65540
+ }
65541
+ return true;
65542
+ }
65543
+
65519
65544
  void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &join_state) {
65520
65545
  // we only do this optimization for inner joins
65521
65546
  if (op.join_type != JoinType::INNER) {
@@ -65548,7 +65573,14 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
65548
65573
  if (stats_build->min.is_null || stats_build->max.is_null) {
65549
65574
  return;
65550
65575
  }
65551
- auto build_range = stats_build->max - stats_build->min; // Join Keys Range
65576
+ int64_t min_value, max_value;
65577
+ if (!ExtractNumericValue(stats_build->min, min_value) || !ExtractNumericValue(stats_build->max, max_value)) {
65578
+ return;
65579
+ }
65580
+ int64_t build_range;
65581
+ if (!TrySubtractOperator::Operation(max_value, min_value, build_range)) {
65582
+ return;
65583
+ }
65552
65584
 
65553
65585
  // Fill join_stats for invisible join
65554
65586
  auto stats_probe = reinterpret_cast<NumericStatistics *>(op.join_stats[1].get()); // rhs stats
@@ -65560,26 +65592,7 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi
65560
65592
  join_state.build_min = stats_build->min;
65561
65593
  join_state.build_max = stats_build->max;
65562
65594
  join_state.estimated_cardinality = op.estimated_cardinality;
65563
- if (!build_range.type().IsIntegral()) {
65564
- switch (build_range.type().InternalType()) {
65565
- case PhysicalType::INT16:
65566
- join_state.build_range = build_range.value_.smallint;
65567
- break;
65568
- case PhysicalType::INT32:
65569
- join_state.build_range = build_range.value_.integer;
65570
- break;
65571
- case PhysicalType::INT64:
65572
- join_state.build_range = build_range.value_.bigint;
65573
- break;
65574
- case PhysicalType::INT128:
65575
- // we do not support hugeint for this optimization
65576
- return;
65577
- default:
65578
- throw InternalException("Invalid Physical Type for Decimals");
65579
- }
65580
- } else {
65581
- join_state.build_range = build_range.GetValue<idx_t>(); // cast integer types into idx_t
65582
- }
65595
+ join_state.build_range = build_range;
65583
65596
  if (join_state.build_range > MAX_BUILD_SIZE || stats_probe->max.is_null || stats_probe->min.is_null) {
65584
65597
  return;
65585
65598
  }
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "52c01882a"
14
- #define DUCKDB_VERSION "0.3.2-dev656"
13
+ #define DUCKDB_SOURCE_ID "0f8960ac3"
14
+ #define DUCKDB_VERSION "0.3.2-dev658"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //