duckdb 0.4.1-dev63.0 → 0.4.1-dev75.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-dev63.0",
4
+ "version": "0.4.1-dev75.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -5514,6 +5514,7 @@ vector<string> DefaultSchemaGenerator::GetDefaultEntries() {
5514
5514
 
5515
5515
 
5516
5516
 
5517
+
5517
5518
  namespace duckdb {
5518
5519
 
5519
5520
  struct DefaultType {
@@ -5574,6 +5575,7 @@ static DefaultType internal_types[] = {{"int", LogicalTypeId::INTEGER},
5574
5575
  {"guid", LogicalTypeId::UUID},
5575
5576
  {"struct", LogicalTypeId::STRUCT},
5576
5577
  {"row", LogicalTypeId::STRUCT},
5578
+ {"list", LogicalTypeId::LIST},
5577
5579
  {"map", LogicalTypeId::MAP},
5578
5580
  {"utinyint", LogicalTypeId::UTINYINT},
5579
5581
  {"uint8", LogicalTypeId::UTINYINT},
@@ -24177,6 +24179,9 @@ bool TryCast::Operation(timestamp_t input, date_t &result, bool strict) {
24177
24179
 
24178
24180
  template <>
24179
24181
  bool TryCast::Operation(timestamp_t input, dtime_t &result, bool strict) {
24182
+ if (!Timestamp::IsFinite(input)) {
24183
+ return false;
24184
+ }
24180
24185
  result = Timestamp::GetTime(input);
24181
24186
  return true;
24182
24187
  }
@@ -25537,9 +25542,9 @@ duckdb::string_t StringCast::Operation(hugeint_t input, Vector &vector) {
25537
25542
  template <>
25538
25543
  duckdb::string_t StringCast::Operation(date_t input, Vector &vector) {
25539
25544
  if (input == date_t::infinity()) {
25540
- return "infinity";
25545
+ return StringVector::AddString(vector, Date::PINF);
25541
25546
  } else if (input == date_t::ninfinity()) {
25542
- return "-infinity";
25547
+ return StringVector::AddString(vector, Date::NINF);
25543
25548
  }
25544
25549
  int32_t date[3];
25545
25550
  Date::Convert(input, date[0], date[1], date[2]);
@@ -25577,9 +25582,9 @@ duckdb::string_t StringCast::Operation(dtime_t input, Vector &vector) {
25577
25582
  template <>
25578
25583
  duckdb::string_t StringCast::Operation(timestamp_t input, Vector &vector) {
25579
25584
  if (input == timestamp_t::infinity()) {
25580
- return string_t("infinity");
25585
+ return StringVector::AddString(vector, Date::PINF);
25581
25586
  } else if (input == timestamp_t::ninfinity()) {
25582
- return string_t("-infinity");
25587
+ return StringVector::AddString(vector, Date::NINF);
25583
25588
  }
25584
25589
  date_t date_entry;
25585
25590
  dtime_t time_entry;
@@ -25639,6 +25644,11 @@ string_t StringCastTZ::Operation(dtime_t input, Vector &vector) {
25639
25644
 
25640
25645
  template <>
25641
25646
  string_t StringCastTZ::Operation(timestamp_t input, Vector &vector) {
25647
+ if (input == timestamp_t::infinity()) {
25648
+ return StringVector::AddString(vector, Date::PINF);
25649
+ } else if (input == timestamp_t::ninfinity()) {
25650
+ return StringVector::AddString(vector, Date::NINF);
25651
+ }
25642
25652
  date_t date_entry;
25643
25653
  dtime_t time_entry;
25644
25654
  Timestamp::Convert(input, date_entry, time_entry);
@@ -40109,6 +40119,10 @@ namespace duckdb {
40109
40119
 
40110
40120
  static_assert(sizeof(date_t) == sizeof(int32_t), "date_t was padded");
40111
40121
 
40122
+ const char *Date::PINF = "infinity"; // NOLINT
40123
+ const char *Date::NINF = "-infinity"; // NOLINT
40124
+ const char *Date::EPOCH = "epoch"; // NOLINT
40125
+
40112
40126
  const string_t Date::MONTH_NAMES_ABBREVIATED[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
40113
40127
  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
40114
40128
  const string_t Date::MONTH_NAMES[] = {"January", "February", "March", "April", "May", "June",
@@ -40320,9 +40334,9 @@ bool Date::TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result
40320
40334
  }
40321
40335
  if (!StringUtil::CharacterIsDigit(buf[pos])) {
40322
40336
  // Check for special values
40323
- if (TryConvertDateSpecial(buf, len, pos, "infinity")) {
40337
+ if (TryConvertDateSpecial(buf, len, pos, PINF)) {
40324
40338
  result = yearneg ? date_t::ninfinity() : date_t::infinity();
40325
- } else if (TryConvertDateSpecial(buf, len, pos, "epoch")) {
40339
+ } else if (TryConvertDateSpecial(buf, len, pos, EPOCH)) {
40326
40340
  result = date_t::epoch();
40327
40341
  } else {
40328
40342
  return false;
@@ -40435,9 +40449,9 @@ string Date::ToString(date_t date) {
40435
40449
  // PG displays temporal infinities in lowercase,
40436
40450
  // but numerics in Titlecase.
40437
40451
  if (date == date_t::infinity()) {
40438
- return "infinity";
40452
+ return PINF;
40439
40453
  } else if (date == date_t::ninfinity()) {
40440
- return "-infinity";
40454
+ return NINF;
40441
40455
  }
40442
40456
  int32_t date_units[3];
40443
40457
  idx_t year_length;
@@ -43502,9 +43516,9 @@ timestamp_t Timestamp::FromString(const string &str) {
43502
43516
 
43503
43517
  string Timestamp::ToString(timestamp_t timestamp) {
43504
43518
  if (timestamp == timestamp_t::infinity()) {
43505
- return "infinity";
43519
+ return Date::PINF;
43506
43520
  } else if (timestamp == timestamp_t::ninfinity()) {
43507
- return "-infinity";
43521
+ return Date::NINF;
43508
43522
  }
43509
43523
  date_t date;
43510
43524
  dtime_t time;
@@ -43522,6 +43536,9 @@ date_t Timestamp::GetDate(timestamp_t timestamp) {
43522
43536
  }
43523
43537
 
43524
43538
  dtime_t Timestamp::GetTime(timestamp_t timestamp) {
43539
+ if (!IsFinite(timestamp)) {
43540
+ throw ConversionException("Can't get TIME of infinite TIMESTAMP");
43541
+ }
43525
43542
  date_t date = Timestamp::GetDate(timestamp);
43526
43543
  return dtime_t(timestamp.value - (int64_t(date.days) * int64_t(Interval::MICROS_PER_DAY)));
43527
43544
  }
@@ -126547,19 +126564,26 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
126547
126564
  return;
126548
126565
  }
126549
126566
 
126567
+ string temp_path = local_extension_path + ".tmp";
126568
+ if (fs.FileExists(temp_path)) {
126569
+ fs.RemoveFile(temp_path);
126570
+ }
126550
126571
  auto is_http_url = StringUtil::Contains(extension, "http://");
126551
126572
  if (fs.FileExists(extension)) {
126573
+
126552
126574
  std::ifstream in(extension, std::ios::binary);
126553
126575
  if (in.bad()) {
126554
126576
  throw IOException("Failed to read extension from \"%s\"", extension);
126555
126577
  }
126556
- std::ofstream out(local_extension_path, std::ios::binary);
126578
+ std::ofstream out(temp_path, std::ios::binary);
126557
126579
  out << in.rdbuf();
126558
126580
  if (out.bad()) {
126559
- throw IOException("Failed to write extension to \"%s\"", local_extension_path);
126581
+ throw IOException("Failed to write extension to \"%s\"", temp_path);
126560
126582
  }
126561
126583
  in.close();
126562
126584
  out.close();
126585
+
126586
+ fs.MoveFile(temp_path, local_extension_path);
126563
126587
  return;
126564
126588
  } else if (StringUtil::Contains(extension, "/") && !is_http_url) {
126565
126589
  throw IOException("Failed to read extension from \"%s\": no such file", extension);
@@ -126601,11 +126625,13 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten
126601
126625
  throw IOException("Failed to download extension %s%s", url_base, url_local_part);
126602
126626
  }
126603
126627
  auto decompressed_body = GZipFileSystem::UncompressGZIPString(res->body);
126604
- std::ofstream out(local_extension_path, std::ios::binary);
126628
+ std::ofstream out(temp_path, std::ios::binary);
126605
126629
  out.write(decompressed_body.data(), decompressed_body.size());
126606
126630
  if (out.bad()) {
126607
- throw IOException("Failed to write extension to %s", local_extension_path);
126631
+ throw IOException("Failed to write extension to %s", temp_path);
126608
126632
  }
126633
+ out.close();
126634
+ fs.MoveFile(temp_path, local_extension_path);
126609
126635
  #endif
126610
126636
  }
126611
126637
 
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 "382f97e45"
15
- #define DUCKDB_VERSION "v0.4.1-dev63"
14
+ #define DUCKDB_SOURCE_ID "26d123fdc"
15
+ #define DUCKDB_VERSION "v0.4.1-dev75"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -18876,6 +18876,10 @@ namespace duckdb {
18876
18876
  //! The Date class is a static class that holds helper functions for the Date type.
18877
18877
  class Date {
18878
18878
  public:
18879
+ static const char *PINF; // NOLINT
18880
+ static const char *NINF; // NOLINT
18881
+ static const char *EPOCH; // NOLINT
18882
+
18879
18883
  static const string_t MONTH_NAMES[12];
18880
18884
  static const string_t MONTH_NAMES_ABBREVIATED[12];
18881
18885
  static const string_t DAY_NAMES[7];