message: some code cleanup and better error expectations
diff: @@ -141,7 +141,7 @@ test_that("Union all has the correct values", {
  expect_false(df_is_materialized(rel_df))
  dim(rel_df)
  expect_true(df_is_materialized(rel_df))
  - expected_result = data.frame(a=c('1', '2', '5', '6'), b=c('3', '4', '7', '8'))
  + expected_result <- data.frame(a=c('1', '2', '5', '6'), b=c('3', '4', '7', '8'))
  expect_equal(rel_df, expected_result)
  })
  @@ -152,7 +152,7 @@ test_that("Union all keeps duplicates", {
  rel_df <- rel_to_altrep(rel)
  dim(rel_df)
  expect_true(df_is_materialized(rel_df))
  - expected_result = data.frame(a=c('1', '2', '1', '2'), b=c('3', '4', '3', '4'))
  + expected_result <- data.frame(a=c('1', '2', '1', '2'), b=c('3', '4', '3', '4'))
  expect_equal(rel_df, expected_result)
  })
  @@ -161,27 +161,20 @@ test_that("we can union the same relation to itself", {
  test_df_a2 <- rel_from_df(con, data.frame(a=c('1', '2'), b=c('3', '4')))
  rel <- rel_union_all(test_df_a2, test_df_a2)
  rel_df <- rel_to_altrep(rel)
  - expected_result = data.frame(a=c('1', '2', '1', '2'), b=c('3', '4', '3', '4'))
  + expected_result <- data.frame(a=c('1', '2', '1', '2'), b=c('3', '4', '3', '4'))
  expect_equal(rel_df, expected_result)
  })
  test_that("we throw an error when attempting to union all relations that are not compatible", {
  test_df_a2 <- rel_from_df(con, data.frame(a=c('1', '2'), b=c('3', '4')))
  test_df_b2 <- rel_from_df(con, data.frame(a=c('1', '2'), b=c('3', '4'), c=c('5', '6')))
  - # can't figure out how to catch the correct error
  - expect_error(rel_union_all(test_df_a2, test_df_b2))
  + # The two data frames have different dimensions, therefore you get a binding error.
  + expect_error(rel_union_all(test_df_a2, test_df_b2), "Binder Error")
  })
  test_that("A union with different column types throws an error", {
  - test_df_a1 <- duckdb:::rel_from_df(con, data.frame(a=c(1)))
  - test_df_a2 <- duckdb:::rel_from_df(con, data.frame(a=c('1')))
  - rel <- duckdb:::rel_union_all(test_df_a1, test_df_a2)
  - # Error in row.names.data.frame(x) :
  - # Invalid Error: Result mismatch in query!
  - # Expected the following columns: [a INT]
  - # But result contained the following: [a VARCHAR]
  - # expect_error(rel_to_altrep(rel))
  - # duckdb can't support the union all, so
  -
  - expect_true(TRUE)
  + test_df_a1 <- rel_from_df(con, data.frame(a=c(1)))
  + test_df_a2 <- rel_from_df(con, data.frame(a=c('1')))
  + rel <- rel_union_all(test_df_a1, test_df_a2)
  + expect_error(rapi_rel_to_df(rel), "Invalid Error: Result mismatch in query!")
  })
  