klin333 opened a new issue, #2684:
URL: https://github.com/apache/arrow-adbc/issues/2684

   ### What happened?
   
   When reading from an empty snowflake table (ie with 0 rows), BOOLEAN columns 
are read in to R data.frame as character() columns.
   
   The write_adbc correctly created the table. On Snowflake, I see the table is 
made using this sql query.
   ```
   create or replace TABLE EXAMPLE_DB.EXAMPLE_SCHEMA."empty" (
        "x" BOOLEAN
   );
   ```
   
   ```{r}
   library(adbcdrivermanager)
   
   uri <- "secret"
   db <- adbc_database_init(adbcsnowflake::adbcsnowflake(), uri = uri)
   snowflake_con <- adbc_connection_init(db)
   
   df <- data.frame(x = logical(1))
   write_adbc(df, snowflake_con, "non_empty", mode = "create") 
   df_read <- read_adbc(snowflake_con, 'SELECT * from "non_empty"') |> 
as.data.frame()
   str(df_read)
   #'data.frame':       1 obs. of  1 variable:
   # $ x: logi FALSE
   
   df <- data.frame(x = logical(0))
   write_adbc(df, snowflake_con, "empty", mode = "create") 
   df_read <- read_adbc(snowflake_con, 'SELECT * from "empty"') |> 
as.data.frame()
   str(df_read)
   #'data.frame':       0 obs. of  1 variable:
   # $ x: chr 
   
   ```
   
   sessionInfo():
   ```
   R version 4.3.2 (2023-10-31 ucrt)
   Platform: x86_64-w64-mingw32/x64 (64-bit)
   Running under: Windows 11 x64 (build 22631)
   
   Matrix products: default
   
   
   locale:
   [1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8    
LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C                      
   [5] LC_TIME=English_Australia.utf8    
   
   time zone: Australia/Sydney
   tzcode source: internal
   
   attached base packages:
   [1] graphics  grDevices utils     methods   base     
   
   other attached packages:
   [1] adbcdrivermanager_0.17.0
   
   loaded via a namespace (and not attached):
   [1] compiler_4.3.2       tools_4.3.2          rstudioapi_0.16.0    
adbcsnowflake_0.17.0 stats_4.3.2          nanoarrow_0.6.0      renv_1.0.3  
   ```
   
   ### Stack Trace
   
   _No response_
   
   ### How can we reproduce the bug?
   
   _No response_
   
   ### Environment/Setup
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to