duckdb 0.2.10-dev358.0 → 0.2.10-dev362.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 +17 -6
- package/src/duckdb.hpp +6 -3
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -35991,7 +35991,7 @@ int64_t Interval::GetNanoseconds(interval_t val) {
|
|
|
35991
35991
|
|
|
35992
35992
|
return nano;
|
|
35993
35993
|
}
|
|
35994
|
-
interval_t Interval::
|
|
35994
|
+
interval_t Interval::GetAge(timestamp_t timestamp_1, timestamp_t timestamp_2) {
|
|
35995
35995
|
date_t date1, date2;
|
|
35996
35996
|
dtime_t time1, time2;
|
|
35997
35997
|
|
|
@@ -36079,6 +36079,18 @@ interval_t Interval::GetDifference(timestamp_t timestamp_1, timestamp_t timestam
|
|
|
36079
36079
|
|
|
36080
36080
|
return interval;
|
|
36081
36081
|
}
|
|
36082
|
+
interval_t Interval::GetDifference(timestamp_t timestamp_1, timestamp_t timestamp_2) {
|
|
36083
|
+
const auto us_1 = Timestamp::GetEpochMicroSeconds(timestamp_1);
|
|
36084
|
+
const auto us_2 = Timestamp::GetEpochMicroSeconds(timestamp_2);
|
|
36085
|
+
const auto delta_us = us_1 - us_2;
|
|
36086
|
+
|
|
36087
|
+
interval_t result;
|
|
36088
|
+
result.months = 0;
|
|
36089
|
+
result.days = delta_us / Interval::MICROS_PER_DAY;
|
|
36090
|
+
result.micros = delta_us % Interval::MICROS_PER_DAY;
|
|
36091
|
+
|
|
36092
|
+
return result;
|
|
36093
|
+
}
|
|
36082
36094
|
|
|
36083
36095
|
static void NormalizeIntervalEntries(interval_t input, int64_t &months, int64_t &days, int64_t µs) {
|
|
36084
36096
|
int64_t extra_months_d = input.days / Interval::DAYS_PER_MONTH;
|
|
@@ -76581,7 +76593,7 @@ static void AgeFunctionStandard(DataChunk &input, ExpressionState &state, Vector
|
|
|
76581
76593
|
auto current_timestamp = Timestamp::GetCurrentTimestamp();
|
|
76582
76594
|
|
|
76583
76595
|
UnaryExecutor::Execute<timestamp_t, interval_t>(input.data[0], result, input.size(), [&](timestamp_t input) {
|
|
76584
|
-
return Interval::
|
|
76596
|
+
return Interval::GetAge(current_timestamp, input);
|
|
76585
76597
|
});
|
|
76586
76598
|
}
|
|
76587
76599
|
|
|
@@ -76590,7 +76602,7 @@ static void AgeFunction(DataChunk &input, ExpressionState &state, Vector &result
|
|
|
76590
76602
|
|
|
76591
76603
|
BinaryExecutor::Execute<timestamp_t, timestamp_t, interval_t>(
|
|
76592
76604
|
input.data[0], input.data[1], result, input.size(),
|
|
76593
|
-
[&](timestamp_t input1, timestamp_t input2) { return Interval::
|
|
76605
|
+
[&](timestamp_t input1, timestamp_t input2) { return Interval::GetAge(input1, input2); });
|
|
76594
76606
|
}
|
|
76595
76607
|
|
|
76596
76608
|
void AgeFun::RegisterFunction(BuiltinFunctions &set) {
|
|
@@ -77960,7 +77972,7 @@ struct DateSub {
|
|
|
77960
77972
|
// Our interval difference will now give the correct result.
|
|
77961
77973
|
// Note that PG gives different interval subtraction results,
|
|
77962
77974
|
// so if we change this we will have to reimplement.
|
|
77963
|
-
return Interval::
|
|
77975
|
+
return Interval::GetAge(end_ts, start_ts).months;
|
|
77964
77976
|
}
|
|
77965
77977
|
};
|
|
77966
77978
|
|
|
@@ -129694,8 +129706,7 @@ SetScope ToSetScope(duckdb_libpgquery::VariableSetScope pg_scope) {
|
|
|
129694
129706
|
case duckdb_libpgquery::VariableSetScope::VAR_SET_SCOPE_GLOBAL:
|
|
129695
129707
|
return SetScope::GLOBAL;
|
|
129696
129708
|
case duckdb_libpgquery::VariableSetScope::VAR_SET_SCOPE_DEFAULT:
|
|
129697
|
-
|
|
129698
|
-
return SetScope::GLOBAL;
|
|
129709
|
+
return SetScope::SESSION;
|
|
129699
129710
|
default:
|
|
129700
129711
|
throw InternalException("Unexpected pg_scope: %d", pg_scope);
|
|
129701
129712
|
}
|
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 "
|
|
14
|
-
#define DUCKDB_VERSION "0.2.10-
|
|
13
|
+
#define DUCKDB_SOURCE_ID "622ee7e43"
|
|
14
|
+
#define DUCKDB_VERSION "0.2.10-dev362"
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
// DuckDB
|
|
17
17
|
//
|
|
@@ -5964,7 +5964,10 @@ public:
|
|
|
5964
5964
|
//! Get Interval in Nanoseconds
|
|
5965
5965
|
static int64_t GetNanoseconds(interval_t val);
|
|
5966
5966
|
|
|
5967
|
-
//! Returns the
|
|
5967
|
+
//! Returns the age between two timestamps (including 30 day months)
|
|
5968
|
+
static interval_t GetAge(timestamp_t timestamp_1, timestamp_t timestamp_2);
|
|
5969
|
+
|
|
5970
|
+
//! Returns the exact difference between two timestamps (days and seconds)
|
|
5968
5971
|
static interval_t GetDifference(timestamp_t timestamp_1, timestamp_t timestamp_2);
|
|
5969
5972
|
|
|
5970
5973
|
//! Comparison operators
|