duckdb 0.9.2-dev2.0 → 0.9.2-dev5.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.9.2-dev2.0",
5
+ "version": "0.9.2-dev5.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/statement.cpp CHANGED
@@ -187,6 +187,15 @@ static Napi::Value convert_col_val(Napi::Env &env, duckdb::Value dval, duckdb::L
187
187
  const auto scale = duckdb::Interval::SECS_PER_DAY * duckdb::Interval::MSECS_PER_SEC;
188
188
  value = Napi::Date::New(env, double(dval.GetValue<int32_t>() * scale));
189
189
  } break;
190
+ case duckdb::LogicalTypeId::TIMESTAMP_NS: {
191
+ value = Napi::Date::New(env, double(dval.GetValue<int64_t>() / (duckdb::Interval::MICROS_PER_MSEC * 1000)));
192
+ } break;
193
+ case duckdb::LogicalTypeId::TIMESTAMP_MS: {
194
+ value = Napi::Date::New(env, double(dval.GetValue<int64_t>()));
195
+ } break;
196
+ case duckdb::LogicalTypeId::TIMESTAMP_SEC: {
197
+ value = Napi::Date::New(env, double(dval.GetValue<int64_t>() * duckdb::Interval::MSECS_PER_SEC));
198
+ } break;
190
199
  case duckdb::LogicalTypeId::TIMESTAMP:
191
200
  case duckdb::LogicalTypeId::TIMESTAMP_TZ: {
192
201
  value = Napi::Date::New(env, double(dval.GetValue<int64_t>() / duckdb::Interval::MICROS_PER_MSEC));
@@ -22,10 +22,12 @@ function timedelta(obj: { days: number; micros: number; months: number }) {
22
22
  const replacement_values: Record<string, string> = {
23
23
  timestamp:
24
24
  "'1990-01-01 00:00:00'::TIMESTAMP, '9999-12-31 23:59:59'::TIMESTAMP, NULL::TIMESTAMP",
25
- // TODO: fix these, they are currently being returned as strings
26
- // timestamp_s: "'1990-01-01 00:00:00'::TIMESTAMP_S",
27
- // timestamp_ns: "'1990-01-01 00:00:00'::TIMESTAMP_NS",
28
- // timestamp_ms: "'1990-01-01 00:00:00'::TIMESTAMP_MS",
25
+ timestamp_s:
26
+ "'1990-01-01 00:00:00'::TIMESTAMP_S, '9999-12-31 23:59:59'::TIMESTAMP_S, NULL::TIMESTAMP_S",
27
+ // note: timestamp_ns does not support extreme values
28
+ timestamp_ns: "'1990-01-01 00:00:00'::TIMESTAMP_NS, NULL::TIMESTAMP_NS",
29
+ timestamp_ms:
30
+ "'1990-01-01 00:00:00'::TIMESTAMP_MS, '9999-12-31 23:59:59'::TIMESTAMP_MS, NULL::TIMESTAMP_MS",
29
31
  timestamp_tz:
30
32
  "'1990-01-01 00:00:00Z'::TIMESTAMPTZ, '9999-12-31 23:59:59.999999Z'::TIMESTAMPTZ, NULL::TIMESTAMPTZ",
31
33
  date: "'1990-01-01'::DATE, '9999-12-31'::DATE, NULL::DATE",
@@ -157,7 +159,7 @@ const correct_answer_map: Record<string, any[]> = {
157
159
  null,
158
160
  ],
159
161
  map: ["{}", "{key1=🦆🦆🦆🦆🦆🦆, key2=goose}", null],
160
- union: ['Frank', '5', null],
162
+ union: ["Frank", "5", null],
161
163
 
162
164
  time_tz: ["00:00:00-1559", "23:59:59.999999+1559", null],
163
165
  interval: [
@@ -176,16 +178,15 @@ const correct_answer_map: Record<string, any[]> = {
176
178
  null,
177
179
  ],
178
180
  date: [new Date("1990-01-01"), new Date("9999-12-31"), null],
179
- timestamp_s: ["290309-12-22 (BC) 00:00:00", "294247-01-10 04:00:54", null],
180
-
181
- timestamp_ns: [
182
- "1677-09-21 00:12:43.145225",
183
- "2262-04-11 23:47:16.854775",
181
+ timestamp_s: [
182
+ new Date(Date.UTC(1990, 0, 1)),
183
+ new Date("9999-12-31T23:59:59.000Z"),
184
184
  null,
185
185
  ],
186
+ timestamp_ns: [new Date(Date.UTC(1990, 0, 1)), null],
186
187
  timestamp_ms: [
187
- "290309-12-22 (BC) 00:00:00",
188
- "294247-01-10 04:00:54.775",
188
+ new Date(Date.UTC(1990, 0, 1)),
189
+ new Date("9999-12-31T23:59:59.000Z"),
189
190
  null,
190
191
  ],
191
192
  timestamp_tz: [