duckdb 0.3.2-dev597.0 → 0.3.2-dev599.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-dev597.0",
4
+ "version": "0.3.2-dev599.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -35179,7 +35179,9 @@ enum class DatePartSpecifier : uint8_t {
35179
35179
  WEEK,
35180
35180
  QUARTER,
35181
35181
  DOY,
35182
- YEARWEEK
35182
+ YEARWEEK,
35183
+ ERA,
35184
+ OFFSET
35183
35185
  };
35184
35186
 
35185
35187
  DUCKDB_API bool TryGetDatePartSpecifier(const string &specifier, DatePartSpecifier &result);
@@ -79428,7 +79430,7 @@ bool TryGetDatePartSpecifier(const string &specifier_p, DatePartSpecifier &resul
79428
79430
  result = DatePartSpecifier::YEAR;
79429
79431
  } else if (specifier == "month" || specifier == "mon" || specifier == "months" || specifier == "mons") {
79430
79432
  result = DatePartSpecifier::MONTH;
79431
- } else if (specifier == "day" || specifier == "days" || specifier == "d") {
79433
+ } else if (specifier == "day" || specifier == "days" || specifier == "d" || specifier == "dayofmonth") {
79432
79434
  result = DatePartSpecifier::DAY;
79433
79435
  } else if (specifier == "decade" || specifier == "decades") {
79434
79436
  result = DatePartSpecifier::DECADE;
@@ -79450,13 +79452,13 @@ bool TryGetDatePartSpecifier(const string &specifier_p, DatePartSpecifier &resul
79450
79452
  } else if (specifier == "epoch") {
79451
79453
  // seconds since 1970-01-01
79452
79454
  result = DatePartSpecifier::EPOCH;
79453
- } else if (specifier == "dow" || specifier == "dayofweek") {
79455
+ } else if (specifier == "dow" || specifier == "dayofweek" || specifier == "weekday") {
79454
79456
  // day of the week (Sunday = 0, Saturday = 6)
79455
79457
  result = DatePartSpecifier::DOW;
79456
79458
  } else if (specifier == "isodow") {
79457
79459
  // isodow (Monday = 1, Sunday = 7)
79458
79460
  result = DatePartSpecifier::ISODOW;
79459
- } else if (specifier == "week" || specifier == "weeks" || specifier == "w") {
79461
+ } else if (specifier == "week" || specifier == "weeks" || specifier == "w" || specifier == "weekofyear") {
79460
79462
  // week number
79461
79463
  result = DatePartSpecifier::WEEK;
79462
79464
  } else if (specifier == "doy" || specifier == "dayofyear") {
@@ -79468,6 +79470,10 @@ bool TryGetDatePartSpecifier(const string &specifier_p, DatePartSpecifier &resul
79468
79470
  } else if (specifier == "yearweek") {
79469
79471
  // Combined year and week YYYYWW
79470
79472
  result = DatePartSpecifier::YEARWEEK;
79473
+ } else if (specifier == "era") {
79474
+ result = DatePartSpecifier::ERA;
79475
+ } else if (specifier == "offset") {
79476
+ result = DatePartSpecifier::OFFSET;
79471
79477
  } else {
79472
79478
  return false;
79473
79479
  }
@@ -79786,6 +79792,35 @@ struct DatePart {
79786
79792
  return PropagateDatePartStatistics<T, EpochOperator>(child_stats);
79787
79793
  }
79788
79794
  };
79795
+
79796
+ struct EraOperator {
79797
+ template <class TA, class TR>
79798
+ static inline TR Operation(TA input) {
79799
+ return Date::ExtractYear(input) > 0 ? 1 : 0;
79800
+ }
79801
+
79802
+ template <class T>
79803
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
79804
+ FunctionData *bind_data,
79805
+ vector<unique_ptr<BaseStatistics>> &child_stats) {
79806
+ return PropagateSimpleDatePartStatistics<0, 1>(child_stats);
79807
+ }
79808
+ };
79809
+
79810
+ struct OffsetOperator {
79811
+ template <class TA, class TR>
79812
+ static inline TR Operation(TA input) {
79813
+ // Regular timestamps are UTC.
79814
+ return 0;
79815
+ }
79816
+
79817
+ template <class T>
79818
+ static unique_ptr<BaseStatistics> PropagateStatistics(ClientContext &context, BoundFunctionExpression &expr,
79819
+ FunctionData *bind_data,
79820
+ vector<unique_ptr<BaseStatistics>> &child_stats) {
79821
+ return PropagateSimpleDatePartStatistics<0, 0>(child_stats);
79822
+ }
79823
+ };
79789
79824
  };
79790
79825
 
79791
79826
  template <>
@@ -80060,6 +80095,36 @@ DatePart::EpochOperator::PropagateStatistics<dtime_t>(ClientContext &context, Bo
80060
80095
  return PropagateSimpleDatePartStatistics<0, 86400>(child_stats);
80061
80096
  }
80062
80097
 
80098
+ template <>
80099
+ int64_t DatePart::EraOperator::Operation(timestamp_t input) {
80100
+ return EraOperator::Operation<date_t, int64_t>(Timestamp::GetDate(input));
80101
+ }
80102
+
80103
+ template <>
80104
+ int64_t DatePart::EraOperator::Operation(interval_t input) {
80105
+ throw NotImplementedException("interval units \"era\" not recognized");
80106
+ }
80107
+
80108
+ template <>
80109
+ int64_t DatePart::EraOperator::Operation(dtime_t input) {
80110
+ throw NotImplementedException("\"time\" units \"era\" not recognized");
80111
+ }
80112
+
80113
+ template <>
80114
+ int64_t DatePart::OffsetOperator::Operation(timestamp_t input) {
80115
+ return 0;
80116
+ }
80117
+
80118
+ template <>
80119
+ int64_t DatePart::OffsetOperator::Operation(interval_t input) {
80120
+ return 0;
80121
+ }
80122
+
80123
+ template <>
80124
+ int64_t DatePart::OffsetOperator::Operation(dtime_t input) {
80125
+ return 0;
80126
+ }
80127
+
80063
80128
  template <class T>
80064
80129
  static int64_t ExtractElement(DatePartSpecifier type, T element) {
80065
80130
  switch (type) {
@@ -80099,6 +80164,10 @@ static int64_t ExtractElement(DatePartSpecifier type, T element) {
80099
80164
  return DatePart::MinutesOperator::template Operation<T, int64_t>(element);
80100
80165
  case DatePartSpecifier::HOUR:
80101
80166
  return DatePart::HoursOperator::template Operation<T, int64_t>(element);
80167
+ case DatePartSpecifier::ERA:
80168
+ return DatePart::EraOperator::template Operation<T, int64_t>(element);
80169
+ case DatePartSpecifier::OFFSET:
80170
+ return DatePart::OffsetOperator::template Operation<T, int64_t>(element);
80102
80171
  default:
80103
80172
  throw NotImplementedException("Specifier type not implemented for DATEPART");
80104
80173
  }
@@ -80212,6 +80281,7 @@ void DatePartFun::RegisterFunction(BuiltinFunctions &set) {
80212
80281
  AddDatePartOperator<DatePart::ISODayOfWeekOperator>(set, "isodow");
80213
80282
  AddDatePartOperator<DatePart::DayOfYearOperator>(set, "dayofyear");
80214
80283
  AddDatePartOperator<DatePart::WeekOperator>(set, "week");
80284
+ AddDatePartOperator<DatePart::EraOperator>(set, "era");
80215
80285
  AddTimePartOperator<DatePart::EpochOperator>(set, "epoch");
80216
80286
  AddTimePartOperator<DatePart::MicrosecondsOperator>(set, "microsecond");
80217
80287
  AddTimePartOperator<DatePart::MillisecondsOperator>(set, "millisecond");
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 "a3ba38f05"
14
- #define DUCKDB_VERSION "0.3.2-dev597"
13
+ #define DUCKDB_SOURCE_ID "e7d62425f"
14
+ #define DUCKDB_VERSION "0.3.2-dev599"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //