duckdb 0.3.5-dev677.0 → 0.3.5-dev692.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.5-dev677.0",
4
+ "version": "0.3.5-dev692.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -18728,6 +18728,7 @@ duckdb::string_t StringCastTZ::Operation(timestamp_t input, Vector &result);
18728
18728
 
18729
18729
 
18730
18730
 
18731
+ #include <cmath>
18731
18732
 
18732
18733
  namespace duckdb {
18733
18734
 
@@ -18786,10 +18787,21 @@ bool TryCastWithOverflowCheckFloat(SRC value, T &result, SRC min, SRC max) {
18786
18787
  if (!(value >= min && value < max)) {
18787
18788
  return false;
18788
18789
  }
18789
- result = T(value);
18790
+ // PG FLOAT => INT casts use statistical rounding.
18791
+ result = std::nearbyint(value);
18790
18792
  return true;
18791
18793
  }
18792
18794
 
18795
+ template <>
18796
+ bool TryCastWithOverflowCheck(float value, int8_t &result) {
18797
+ return TryCastWithOverflowCheckFloat<float, int8_t>(value, result, -128.0f, 128.0f);
18798
+ }
18799
+
18800
+ template <>
18801
+ bool TryCastWithOverflowCheck(float value, int16_t &result) {
18802
+ return TryCastWithOverflowCheckFloat<float, int16_t>(value, result, -32768.0f, 32768.0f);
18803
+ }
18804
+
18793
18805
  template <>
18794
18806
  bool TryCastWithOverflowCheck(float value, int32_t &result) {
18795
18807
  return TryCastWithOverflowCheckFloat<float, int32_t>(value, result, -2147483648.0f, 2147483648.0f);
@@ -18801,6 +18813,21 @@ bool TryCastWithOverflowCheck(float value, int64_t &result) {
18801
18813
  9223372036854775808.0f);
18802
18814
  }
18803
18815
 
18816
+ template <>
18817
+ bool TryCastWithOverflowCheck(double value, int8_t &result) {
18818
+ return TryCastWithOverflowCheckFloat<double, int8_t>(value, result, -128.0, 128.0);
18819
+ }
18820
+
18821
+ template <>
18822
+ bool TryCastWithOverflowCheck(double value, int16_t &result) {
18823
+ return TryCastWithOverflowCheckFloat<double, int16_t>(value, result, -32768.0, 32768.0);
18824
+ }
18825
+
18826
+ template <>
18827
+ bool TryCastWithOverflowCheck(double value, int32_t &result) {
18828
+ return TryCastWithOverflowCheckFloat<double, int32_t>(value, result, -2147483648.0, 2147483648.0);
18829
+ }
18830
+
18804
18831
  template <>
18805
18832
  bool TryCastWithOverflowCheck(double value, int64_t &result) {
18806
18833
  return TryCastWithOverflowCheckFloat<double, int64_t>(value, result, -9223372036854775808.0, 9223372036854775808.0);
@@ -19026,12 +19053,12 @@ bool TryCastWithOverflowCheck(uint64_t value, hugeint_t &result) {
19026
19053
 
19027
19054
  template <>
19028
19055
  bool TryCastWithOverflowCheck(float value, hugeint_t &result) {
19029
- return Hugeint::TryConvert(value, result);
19056
+ return Hugeint::TryConvert(std::nearbyintf(value), result);
19030
19057
  }
19031
19058
 
19032
19059
  template <>
19033
19060
  bool TryCastWithOverflowCheck(double value, hugeint_t &result) {
19034
- return Hugeint::TryConvert(value, result);
19061
+ return Hugeint::TryConvert(std::nearbyint(value), result);
19035
19062
  }
19036
19063
 
19037
19064
  template <>
@@ -23282,7 +23309,7 @@ struct IntegerCastOperation {
23282
23309
  if (dbl_res < NumericLimits<result_t>::Minimum() || dbl_res > NumericLimits<result_t>::Maximum()) {
23283
23310
  return false;
23284
23311
  }
23285
- state.result = (result_t)dbl_res;
23312
+ state.result = (result_t)std::nearbyint(dbl_res);
23286
23313
  return true;
23287
23314
  }
23288
23315
 
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 "9dba4e1a0"
15
- #define DUCKDB_VERSION "v0.3.5-dev677"
14
+ #define DUCKDB_SOURCE_ID "c2581dfeb"
15
+ #define DUCKDB_VERSION "v0.3.5-dev692"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //