You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ X] If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
Description
When using pointblank::scan_data() on a "tbl_Microsoft SQL Server" I receive the following error:
Arithmetic overflow error converting expression to data type int.
Reproducible example
I don't have a reproducible example readily available as I'm using this in a work setting but can attempt to create one later one if needed.
Expected result
The SQL query created is as follows:
SELECT
AVG("X") AS "mean",
MIN("X") AS "min",
MAX("X") AS "max"
FROM (
SELECT "X"
FROM "table_name"
) "q01"'
This is a common issue I see in Microsoft SQL Server and the simple fix is:
SELECT
AVG(CAST("X" as float)) AS "mean",
MIN(CAST("X" as float)) AS "min",
MAX(CAST("X" as float)) AS "max"
FROM (
SELECT "X"
FROM "table_name"
) "q01"'
The way I did this via dbplyr was
table_name %>% select(X) %>% summarize( mean = mean(X%>% as.numeric()) , min = min(X%>% as.numeric()) , max = max(X%>% as.numeric()) ) %>% show_query() %>% collect()
The text was updated successfully, but these errors were encountered:
Prework
Description
When using pointblank::scan_data() on a "tbl_Microsoft SQL Server" I receive the following error:
Arithmetic overflow error converting expression to data type int.
Reproducible example
I don't have a reproducible example readily available as I'm using this in a work setting but can attempt to create one later one if needed.
Expected result
The SQL query created is as follows:
SELECT
AVG("X") AS "mean",
MIN("X") AS "min",
MAX("X") AS "max"
FROM (
SELECT "X"
FROM "table_name"
) "q01"'
This is a common issue I see in Microsoft SQL Server and the simple fix is:
SELECT
AVG(CAST("X" as float)) AS "mean",
MIN(CAST("X" as float)) AS "min",
MAX(CAST("X" as float)) AS "max"
FROM (
SELECT "X"
FROM "table_name"
) "q01"'
The way I did this via dbplyr was
table_name %>% select(X) %>% summarize( mean = mean(X%>% as.numeric()) , min = min(X%>% as.numeric()) , max = max(X%>% as.numeric()) ) %>% show_query() %>% collect()
The text was updated successfully, but these errors were encountered: