duckdb 0.3.5-dev22.0 → 0.3.5-dev26.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 +1 -1
- package/src/duckdb.cpp +104 -10
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +28333 -28333
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -84973,9 +84973,6 @@ void DateSubFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
84973
84973
|
|
|
84974
84974
|
|
|
84975
84975
|
|
|
84976
|
-
// TODO date_trunc function should also handle interval data type when it is implemented. See
|
|
84977
|
-
// https://www.postgresql.org/docs/9.1/functions-datetime.html
|
|
84978
|
-
|
|
84979
84976
|
namespace duckdb {
|
|
84980
84977
|
|
|
84981
84978
|
struct DateTrunc {
|
|
@@ -85186,6 +85183,101 @@ timestamp_t DateTrunc::MicrosecondOperator::Operation(date_t input) {
|
|
|
85186
85183
|
return DayOperator::Operation<date_t, timestamp_t>(input);
|
|
85187
85184
|
}
|
|
85188
85185
|
|
|
85186
|
+
// INTERVAL specialisations
|
|
85187
|
+
template <>
|
|
85188
|
+
interval_t DateTrunc::MillenniumOperator::Operation(interval_t input) {
|
|
85189
|
+
input.days = 0;
|
|
85190
|
+
input.micros = 0;
|
|
85191
|
+
input.months = (input.months / Interval::MONTHS_PER_MILLENIUM) * Interval::MONTHS_PER_MILLENIUM;
|
|
85192
|
+
return input;
|
|
85193
|
+
}
|
|
85194
|
+
|
|
85195
|
+
template <>
|
|
85196
|
+
interval_t DateTrunc::CenturyOperator::Operation(interval_t input) {
|
|
85197
|
+
input.days = 0;
|
|
85198
|
+
input.micros = 0;
|
|
85199
|
+
input.months = (input.months / Interval::MONTHS_PER_CENTURY) * Interval::MONTHS_PER_CENTURY;
|
|
85200
|
+
return input;
|
|
85201
|
+
}
|
|
85202
|
+
|
|
85203
|
+
template <>
|
|
85204
|
+
interval_t DateTrunc::DecadeOperator::Operation(interval_t input) {
|
|
85205
|
+
input.days = 0;
|
|
85206
|
+
input.micros = 0;
|
|
85207
|
+
input.months = (input.months / Interval::MONTHS_PER_DECADE) * Interval::MONTHS_PER_DECADE;
|
|
85208
|
+
return input;
|
|
85209
|
+
}
|
|
85210
|
+
|
|
85211
|
+
template <>
|
|
85212
|
+
interval_t DateTrunc::YearOperator::Operation(interval_t input) {
|
|
85213
|
+
input.days = 0;
|
|
85214
|
+
input.micros = 0;
|
|
85215
|
+
input.months = (input.months / Interval::MONTHS_PER_YEAR) * Interval::MONTHS_PER_YEAR;
|
|
85216
|
+
return input;
|
|
85217
|
+
}
|
|
85218
|
+
|
|
85219
|
+
template <>
|
|
85220
|
+
interval_t DateTrunc::QuarterOperator::Operation(interval_t input) {
|
|
85221
|
+
input.days = 0;
|
|
85222
|
+
input.micros = 0;
|
|
85223
|
+
input.months = (input.months / Interval::MONTHS_PER_QUARTER) * Interval::MONTHS_PER_QUARTER;
|
|
85224
|
+
return input;
|
|
85225
|
+
}
|
|
85226
|
+
|
|
85227
|
+
template <>
|
|
85228
|
+
interval_t DateTrunc::MonthOperator::Operation(interval_t input) {
|
|
85229
|
+
input.days = 0;
|
|
85230
|
+
input.micros = 0;
|
|
85231
|
+
return input;
|
|
85232
|
+
}
|
|
85233
|
+
|
|
85234
|
+
template <>
|
|
85235
|
+
interval_t DateTrunc::WeekOperator::Operation(interval_t input) {
|
|
85236
|
+
input.micros = 0;
|
|
85237
|
+
input.days = (input.days / Interval::DAYS_PER_WEEK) * Interval::DAYS_PER_WEEK;
|
|
85238
|
+
return input;
|
|
85239
|
+
}
|
|
85240
|
+
|
|
85241
|
+
template <>
|
|
85242
|
+
interval_t DateTrunc::ISOYearOperator::Operation(interval_t input) {
|
|
85243
|
+
return YearOperator::Operation<interval_t, interval_t>(input);
|
|
85244
|
+
}
|
|
85245
|
+
|
|
85246
|
+
template <>
|
|
85247
|
+
interval_t DateTrunc::DayOperator::Operation(interval_t input) {
|
|
85248
|
+
input.micros = 0;
|
|
85249
|
+
return input;
|
|
85250
|
+
}
|
|
85251
|
+
|
|
85252
|
+
template <>
|
|
85253
|
+
interval_t DateTrunc::HourOperator::Operation(interval_t input) {
|
|
85254
|
+
input.micros = (input.micros / Interval::MICROS_PER_HOUR) * Interval::MICROS_PER_HOUR;
|
|
85255
|
+
return input;
|
|
85256
|
+
}
|
|
85257
|
+
|
|
85258
|
+
template <>
|
|
85259
|
+
interval_t DateTrunc::MinuteOperator::Operation(interval_t input) {
|
|
85260
|
+
input.micros = (input.micros / Interval::MICROS_PER_MINUTE) * Interval::MICROS_PER_MINUTE;
|
|
85261
|
+
return input;
|
|
85262
|
+
}
|
|
85263
|
+
|
|
85264
|
+
template <>
|
|
85265
|
+
interval_t DateTrunc::SecondOperator::Operation(interval_t input) {
|
|
85266
|
+
input.micros = (input.micros / Interval::MICROS_PER_SEC) * Interval::MICROS_PER_SEC;
|
|
85267
|
+
return input;
|
|
85268
|
+
}
|
|
85269
|
+
|
|
85270
|
+
template <>
|
|
85271
|
+
interval_t DateTrunc::MillisecondOperator::Operation(interval_t input) {
|
|
85272
|
+
input.micros = (input.micros / Interval::MICROS_PER_MSEC) * Interval::MICROS_PER_MSEC;
|
|
85273
|
+
return input;
|
|
85274
|
+
}
|
|
85275
|
+
|
|
85276
|
+
template <>
|
|
85277
|
+
interval_t DateTrunc::MicrosecondOperator::Operation(interval_t input) {
|
|
85278
|
+
return input;
|
|
85279
|
+
}
|
|
85280
|
+
|
|
85189
85281
|
template <class TA, class TR>
|
|
85190
85282
|
static TR TruncateElement(DatePartSpecifier type, TA element) {
|
|
85191
85283
|
switch (type) {
|
|
@@ -85289,7 +85381,7 @@ static void DateTruncUnaryExecutor(DatePartSpecifier type, Vector &left, Vector
|
|
|
85289
85381
|
}
|
|
85290
85382
|
}
|
|
85291
85383
|
|
|
85292
|
-
template <typename
|
|
85384
|
+
template <typename TA, typename TR>
|
|
85293
85385
|
static void DateTruncFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
85294
85386
|
D_ASSERT(args.ColumnCount() == 2);
|
|
85295
85387
|
auto &part_arg = args.data[0];
|
|
@@ -85302,20 +85394,22 @@ static void DateTruncFunction(DataChunk &args, ExpressionState &state, Vector &r
|
|
|
85302
85394
|
ConstantVector::SetNull(result, true);
|
|
85303
85395
|
} else {
|
|
85304
85396
|
const auto type = GetDatePartSpecifier(ConstantVector::GetData<string_t>(part_arg)->GetString());
|
|
85305
|
-
DateTruncUnaryExecutor<
|
|
85397
|
+
DateTruncUnaryExecutor<TA, TR>(type, date_arg, result, args.size());
|
|
85306
85398
|
}
|
|
85307
85399
|
} else {
|
|
85308
|
-
BinaryExecutor::ExecuteStandard<string_t,
|
|
85309
|
-
|
|
85400
|
+
BinaryExecutor::ExecuteStandard<string_t, TA, TR, DateTruncBinaryOperator>(part_arg, date_arg, result,
|
|
85401
|
+
args.size());
|
|
85310
85402
|
}
|
|
85311
85403
|
}
|
|
85312
85404
|
|
|
85313
85405
|
void DateTruncFun::RegisterFunction(BuiltinFunctions &set) {
|
|
85314
85406
|
ScalarFunctionSet date_trunc("date_trunc");
|
|
85315
85407
|
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::TIMESTAMP,
|
|
85316
|
-
DateTruncFunction<timestamp_t>));
|
|
85317
|
-
date_trunc.AddFunction(
|
|
85318
|
-
|
|
85408
|
+
DateTruncFunction<timestamp_t, timestamp_t>));
|
|
85409
|
+
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::TIMESTAMP,
|
|
85410
|
+
DateTruncFunction<date_t, timestamp_t>));
|
|
85411
|
+
date_trunc.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::INTERVAL}, LogicalType::INTERVAL,
|
|
85412
|
+
DateTruncFunction<interval_t, interval_t>));
|
|
85319
85413
|
set.AddFunction(date_trunc);
|
|
85320
85414
|
date_trunc.name = "datetrunc";
|
|
85321
85415
|
set.AddFunction(date_trunc);
|
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 "
|
|
15
|
-
#define DUCKDB_VERSION "v0.3.5-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "b6daef25a"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.5-dev26"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|