Skip to content

Commit

Permalink
Explicit date casting in queries (#47)
Browse files Browse the repository at this point in the history
* Explicit date casting in queries

To fix test failures caused by DuckDB v1.1.1 release

* Bump NEWS
  • Loading branch information
zsusswein authored Sep 25, 2024
1 parent c86a24c commit a4b3e69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
* Updated DESCRIPTION and added guidelines for package authorship
* Set up README with explanation of purpose and scope
* Removed `add.R` placeholder
* Fix bugs in date casting caused by DuckDB v1.1.1 release
2 changes: 1 addition & 1 deletion R/parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ read_interval_pmf <- function(path,
AND parameter = ?
AND disease = ?
AND start_date < ? :: DATE
AND (end_date > ? OR end_date IS NULL)
AND (CAST(end_date AS DATE) > ? :: DATE OR end_date IS NULL)
"
parameters <- list(
path,
Expand Down
12 changes: 6 additions & 6 deletions R/read_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ read_data <- function(data_path,
WHERE 1=1
AND disease = ?
AND metric = 'count_ed_visits'
AND reference_date >= ?
AND reference_date <= ?
AND report_date = ?
AND reference_date >= ? :: DATE
AND reference_date <= ? :: DATE
AND report_date = ? :: DATE
GROUP BY reference_date, report_date, disease
ORDER BY reference_date
"
Expand All @@ -90,9 +90,9 @@ read_data <- function(data_path,
WHERE 1=1
AND disease = ?
AND metric = 'count_ed_visits'
AND reference_date >= ?
AND reference_date <= ?
AND report_date = ?
AND reference_date >= ? :: DATE
AND reference_date <= ? :: DATE
AND report_date = ? :: DATE
AND geo_value = ?
GROUP BY geo_value, reference_date, report_date, disease
ORDER BY reference_date
Expand Down

0 comments on commit a4b3e69

Please sign in to comment.