Skip to content

Commit

Permalink
Merge branch 'feature' into ooc_stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lnkuiper committed Oct 16, 2024
2 parents 911060e + fb51e97 commit 780da4d
Show file tree
Hide file tree
Showing 91 changed files with 4,597 additions and 2,740 deletions.
2 changes: 1 addition & 1 deletion .github/config/distribution_matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"vcpkg_triplet": "x64-windows-static-md"
},
{
"duckdb_arch": "windows_amd64_rtools",
"duckdb_arch": "windows_amd64_mingw",
"vcpkg_triplet": "x64-mingw-static"
}
]
Expand Down
12 changes: 6 additions & 6 deletions .github/config/out_of_tree_extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (NOT MINGW)
duckdb_extension_load(azure
LOAD_TESTS
GIT_URL https://github.com/duckdb/duckdb_azure
GIT_TAG b0ffe7ada20cdbd0bee2bbe5461ecd22fb468062
GIT_TAG a40ecb7bc9036eb8ecc5bf30db935a31b78011f5
)
endif()

Expand All @@ -50,7 +50,7 @@ if (NOT MINGW AND NOT "${OS_NAME}" STREQUAL "linux")
duckdb_extension_load(delta
LOAD_TESTS
GIT_URL https://github.com/duckdb/duckdb_delta
GIT_TAG 3933ebd800ad06a64656c9aef6ca7d62897fa4db
GIT_TAG 811db25f5bd405dea186d6c461a642a387502ad8
APPLY_PATCHES
)
endif()
Expand All @@ -75,7 +75,7 @@ if (NOT MINGW)
duckdb_extension_load(iceberg
${LOAD_ICEBERG_TESTS}
GIT_URL https://github.com/duckdb/duckdb_iceberg
GIT_TAG 3f6d753787252e3da1d12157910b62edf729fc6e
GIT_TAG 8b48d1261564613274ac8e9fae01e572d965c99d
APPLY_PATCHES
)
endif()
Expand Down Expand Up @@ -105,7 +105,7 @@ endif()
duckdb_extension_load(spatial
DONT_LINK LOAD_TESTS
GIT_URL https://github.com/duckdb/duckdb_spatial.git
GIT_TAG bb9c829693965f029eb5a312aefed4c538fad781
GIT_TAG 3f94d52aa9f7d67b1a30e6cea642bbb790c04aa2
INCLUDE_DIR spatial/include
TEST_DIR test/sql
APPLY_PATCHES
Expand All @@ -122,7 +122,7 @@ endif()
duckdb_extension_load(sqlite_scanner
${STATIC_LINK_SQLITE} LOAD_TESTS
GIT_URL https://github.com/duckdb/sqlite_scanner
GIT_TAG 315861963c8106397af36cbda10faebc8dae485a
GIT_TAG d5d62657702d33cb44a46cddc7ffc4b67bf7e961
APPLY_PATCHES
)

Expand All @@ -148,7 +148,7 @@ duckdb_extension_load(vss
LOAD_TESTS
DONT_LINK
GIT_URL https://github.com/duckdb/duckdb_vss
GIT_TAG 77739ea5382cce3220af83803ac0b1e98b3ab7d8
GIT_TAG dd880d6121c0f3dff27131e54e057c9db0f1c710
TEST_DIR test/sql
APPLY_PATCHES
)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/R.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:

- uses: ./.github/actions/build_extensions
with:
deploy_as: windows_amd64_rtools
duckdb_arch: windows_amd64_rtools
deploy_as: windows_amd64_mingw
duckdb_arch: windows_amd64_mingw
vcpkg_target_triplet: x64-mingw-static
treat_warn_as_error: 0
s3_id: ${{ secrets.S3_ID }}
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ coverage-check:
generate-files:
python3 scripts/generate_c_api.py
python3 scripts/generate_functions.py
python3 scripts/generate_settings.py
python3 scripts/generate_serialization.py
python3 scripts/generate_enum_util.py
-@python3 tools/pythonpkg/scripts/generate_connection_code.py || echo "Warning: generate_connection_code.py failed, cxxheaderparser & pcpp are required to perform this step"
Expand Down
3 changes: 3 additions & 0 deletions data/csv/glob_dif_dialect/14166/__2000.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
date_col,int_col,double_col
2000-01-01,10,80.9189441112103
2000-01-02,5,109.16581782022259
1 change: 1 addition & 0 deletions data/csv/glob_dif_dialect/14166/__2001.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date_col,int_col,double_col
Empty file.
1 change: 1 addition & 0 deletions data/csv/glob_dif_dialect/14166/matching_types.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2003-01-02,5,109.16581782022259
4 changes: 4 additions & 0 deletions data/csv/small_bad.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1,A
1,A
C,A
1,B
18 changes: 12 additions & 6 deletions extension/core_functions/scalar/date/date_diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ struct DateDiff {
});
}

// We need to truncate down, not towards 0
static inline int64_t Truncate(int64_t value, int64_t units) {
return (value + (value < 0)) / units - (value < 0);
}
static inline int64_t Diff(int64_t start, int64_t end, int64_t units) {
return Truncate(end, units) - Truncate(start, units);
}

struct YearOperator {
template <class TA, class TB, class TR>
static inline TR Operation(TA startdate, TB enddate) {
Expand Down Expand Up @@ -204,30 +212,28 @@ template <>
int64_t DateDiff::MillisecondsOperator::Operation(timestamp_t startdate, timestamp_t enddate) {
D_ASSERT(Timestamp::IsFinite(startdate));
D_ASSERT(Timestamp::IsFinite(enddate));
return Timestamp::GetEpochMs(enddate) - Timestamp::GetEpochMs(startdate);
return Diff(startdate.value, enddate.value, Interval::MICROS_PER_MSEC);
}

template <>
int64_t DateDiff::SecondsOperator::Operation(timestamp_t startdate, timestamp_t enddate) {
D_ASSERT(Timestamp::IsFinite(startdate));
D_ASSERT(Timestamp::IsFinite(enddate));
return Timestamp::GetEpochSeconds(enddate) - Timestamp::GetEpochSeconds(startdate);
return Diff(startdate.value, enddate.value, Interval::MICROS_PER_SEC);
}

template <>
int64_t DateDiff::MinutesOperator::Operation(timestamp_t startdate, timestamp_t enddate) {
D_ASSERT(Timestamp::IsFinite(startdate));
D_ASSERT(Timestamp::IsFinite(enddate));
return Timestamp::GetEpochSeconds(enddate) / Interval::SECS_PER_MINUTE -
Timestamp::GetEpochSeconds(startdate) / Interval::SECS_PER_MINUTE;
return Diff(startdate.value, enddate.value, Interval::MICROS_PER_MINUTE);
}

template <>
int64_t DateDiff::HoursOperator::Operation(timestamp_t startdate, timestamp_t enddate) {
D_ASSERT(Timestamp::IsFinite(startdate));
D_ASSERT(Timestamp::IsFinite(enddate));
return Timestamp::GetEpochSeconds(enddate) / Interval::SECS_PER_HOUR -
Timestamp::GetEpochSeconds(startdate) / Interval::SECS_PER_HOUR;
return Diff(startdate.value, enddate.value, Interval::MICROS_PER_HOUR);
}

// TIME specialisations
Expand Down
Loading

0 comments on commit 780da4d

Please sign in to comment.