Skip to content

Commit

Permalink
Fixes based on testing
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Oct 24, 2023
1 parent b359569 commit 9903f18
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/backend-spark-sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ simulate_spark_sql <- function() simulate_dbi("Spark SQL")
var = win_aggregate("VARIANCE"),
quantile = sql_quantile("PERCENTILE", window = TRUE),
median = win_aggregate("MEDIAN"),
first = function(x, order_by = NULL, na_rm = FALSE) {
sql_nth(x, 1L, order_by = order_by, na_rm = na_rm, ignore_nulls = "bool")
},
last = function(x, order_by = NULL, na_rm = FALSE) {
sql_nth(x, Inf, order_by = order_by, na_rm = na_rm, ignore_nulls = "bool")
},
nth = function(x, n, order_by = NULL, na_rm = FALSE) {
sql_nth(x, n, order_by = order_by, na_rm = na_rm, ignore_nulls = "bool")
},
)
)
}
Expand Down Expand Up @@ -101,11 +110,11 @@ simulate_spark_sql <- function() simulate_dbi("Spark SQL")
table <- as_table_ident(table)
sql <- glue_sql2(
con,
"CREATE ", if (overwrite) "OR REPLACE",
"CREATE ", if (overwrite) "OR REPLACE ",
"TEMPORARY VIEW {.tbl {table}} AS \n",
"{.from {sql}}"
)
DBI::dbExecute(con)
DBI::dbExecute(con, sql)

table
}
Expand Down

0 comments on commit 9903f18

Please sign in to comment.