Skip to content

Commit

Permalink
debug [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Oct 3, 2024
1 parent 0b7ee6f commit 2e3f152
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apis/r/R/SOMADataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ SOMADataFrame <- R6::R6Class(
write = function(values) {
private$check_open_for_write()

### 3079:04

# Prevent downcasting of int64 to int32 when materializing a column
op <- options(arrow.int64_downcast = FALSE)
on.exit(options(op), add = TRUE, after = FALSE)
Expand Down Expand Up @@ -295,6 +297,7 @@ SOMADataFrame <- R6::R6Class(
tiledb_create_options <- TileDBCreateOptions$new(self$platform_config)

# Check compatibility of new/old data types in common columns
### debug 3079:02
check_arrow_schema_data_types(
old_schema[common_cols],
new_schema[common_cols]
Expand Down
2 changes: 2 additions & 0 deletions apis/r/R/utils-arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ check_arrow_schema_data_types <- function(from, to) {
}
}

### debug 3079:03

if (length(msgs) > 0L) {
stop(
"Schemas are incompatible:\n",
Expand Down
51 changes: 49 additions & 2 deletions apis/r/tests/testthat/test-SOMADataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,30 @@ test_that("SOMADataFrame can be updated", {

# Add a new enum and update
tbl0$frobo <- factor(sample(letters[1:3], nrow(tbl0), replace = TRUE))
expect_no_condition(sdf <- SOMADataFrameOpen(uri, mode = "WRITE")$update(tbl0))

# Browse[2]> tbl0
# Table
# 10 rows x 5 columns
# $int_column <int32 not null>
# $soma_joinid <int64>
# $string_column <large_string>
# $float_column <bool>
# $frobo <dictionary<values=string, indices=int8>>
# ^^^^^^

### debug 3079
### expect_no_condition(sdf <- SOMADataFrameOpen(uri, mode = "WRITE")$update(tbl0))
sdf <- SOMADataFrameOpen(uri, mode = "WRITE")
sdf <- sdf$update(tbl0)

# Browse[2]> SOMADataFrameOpen(uri)$schema()
# Schema
# int_column: int32 not null
# soma_joinid: int64
# string_column: large_string
# float_column: bool
# frobo: dictionary<values=binary, indices=int8>
# ^^^^^^

# Verify enum was added on disk
expect_s3_class(
Expand All @@ -663,7 +686,31 @@ test_that("SOMADataFrame can be updated", {
levels(tbl0$GetColumnByName("rlvl")$as_vector()),
c("green", "red", "blue")
)
expect_no_condition(sdf <- SOMADataFrameOpen(uri, mode = "WRITE")$update(tbl0))
### debug 3079:01
### expect_no_condition(sdf <- SOMADataFrameOpen(uri, mode = "WRITE")$update(tbl0))

# Browse[2]> tbl0
# Table
# 10 rows x 6 columns
# $int_column <int32 not null>
# $soma_joinid <int64>
# $string_column <large_string>
# $float_column <bool>
# $frobo <dictionary<values=string, indices=int8>>
# ^^^^^^

# Browse[2]> SOMADataFrameOpen(uri)$schema()
# Schema
# int_column: int32 not null
# soma_joinid: int64
# string_column: large_string
# float_column: bool
# frobo: dictionary<values=binary, indices=int8>
# ^^^^^^

# The written-to sdf has binary values

sdf <- SOMADataFrameOpen(uri, mode = "WRITE")$update(tbl0)

# Verify unordered enum was added on disk
expect_s3_class(
Expand Down

0 comments on commit 2e3f152

Please sign in to comment.