Skip to content

Commit 9da0115

Browse files
authored
fix: check_duplicate_names() (#317)
* Use noble * load_all() * Rename * All of them * Reduce number of runs * Reverse * fix: `check_duplicate_names()`
1 parent 7549a09 commit 9da0115

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

R/relational-duckdb.R

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ vec_ptype_safe <- function(x) {
195195

196196
#' @export
197197
rel_to_df.duckdb_relation <- function(rel, ...) {
198-
if (anyDuplicated(tolower(names(rel)))) {
199-
cli::cli_abort("Column names are case-insensitive in duckdb, fallback required.")
200-
}
201-
202198
duckdb$rel_to_altrep(rel)
203199
}
204200

@@ -226,6 +222,8 @@ rel_project.duckdb_relation <- function(rel, exprs, ...) {
226222
list(!!!to_duckdb_exprs_meta(exprs))
227223
)))
228224

225+
check_duplicate_names(out)
226+
229227
out
230228
}
231229

@@ -246,6 +244,8 @@ rel_aggregate.duckdb_relation <- function(rel, groups, aggregates, ...) {
246244
aggregates = list(!!!to_duckdb_exprs_meta(aggregates))
247245
)))
248246

247+
check_duplicate_names(out)
248+
249249
out
250250
}
251251

@@ -292,6 +292,8 @@ rel_join.duckdb_relation <- function(left, right, conds, join, join_ref_type, ..
292292
)))
293293
}
294294

295+
check_duplicate_names(out)
296+
295297
out
296298
}
297299

@@ -520,3 +522,10 @@ to_duckdb_expr_meta <- function(x) {
520522
cli::cli_abort("Unknown expr class: {.cls {class(x)}}")
521523
)
522524
}
525+
526+
check_duplicate_names <- function(rel) {
527+
# https://github.com/duckdb/duckdb/discussions/14682
528+
if (anyDuplicated(tolower(duckdb$rel_names(rel)))) {
529+
cli::cli_abort("Column names are case-insensitive in duckdb, fallback required.")
530+
}
531+
}

0 commit comments

Comments
 (0)