paleolimbot opened a new issue, #141:
URL: https://github.com/apache/arrow-nanoarrow/issues/141

   Kindly reported by @kou (thank you!)
   
   ```
   ── Error ('test-as-array.R:466'): as_nanoarrow_array() works for 
blob::blob() -> na_large_binary() ──
   ── Error ('test-convert-array.R:757'): convert to vector works for data 
frames nested inside lists ──
   ── Error ('test-convert-array.R:775'): convert to vector works for lists 
nested in data frames ──
   ── Error ('test-infer-ptype.R:104'): infer_nanoarrow_ptype() infers ptypes 
for nested types ──
   ```
   
   These seem like real errors...they all involve nested lists and 
`vctrs::list_of()` in some way and I recall that was a rather difficult 
conversion to get right.
   
   I would be interested to see what the output of 
`sessioninfo::session_info()` is for the nanoarrow dependencies. Here is what 
it looks like for me:
   
   ``` r
   sessioninfo::session_info(c("blob", "hms", "rlang", "tibble", "vctrs", 
"withr"))
   #> ─ Session info 
───────────────────────────────────────────────────────────────
   #>  setting  value
   #>  version  R version 4.2.2 (2022-10-31)
   #>  os       macOS Monterey 12.5
   #>  system   aarch64, darwin20
   #>  ui       X11
   #>  language (EN)
   #>  collate  en_US.UTF-8
   #>  ctype    en_US.UTF-8
   #>  tz       America/Halifax
   #>  date     2023-03-01
   #>  pandoc   2.19.2 @ 
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via 
rmarkdown)
   #> 
   #> ─ Packages 
───────────────────────────────────────────────────────────────────
   #>  package   * version date (UTC) lib source
   #>  blob        1.2.3   2022-04-10 [1] CRAN (R 4.2.0)
   #>  cli         3.6.0   2023-01-09 [1] CRAN (R 4.2.0)
   #>  crayon      1.5.2   2022-09-29 [1] CRAN (R 4.2.0)
   #>  ellipsis    0.3.2   2021-04-29 [1] CRAN (R 4.2.0)
   #>  fansi       1.0.4   2023-01-22 [1] CRAN (R 4.2.0)
   #>  glue        1.6.2   2022-02-24 [1] CRAN (R 4.2.0)
   #>  hms         1.1.2   2022-08-19 [1] CRAN (R 4.2.0)
   #>  lifecycle   1.0.3   2022-10-07 [1] CRAN (R 4.2.0)
   #>  magrittr    2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
   #>  pillar      1.8.1   2022-08-19 [1] CRAN (R 4.2.0)
   #>  pkgconfig   2.0.3   2019-09-22 [1] CRAN (R 4.2.0)
   #>  rlang       1.0.6   2022-09-24 [1] CRAN (R 4.2.0)
   #>  tibble      3.1.8   2022-07-22 [1] CRAN (R 4.2.0)
   #>  utf8        1.2.3   2023-01-31 [1] CRAN (R 4.2.0)
   #>  vctrs       0.5.2   2023-01-23 [1] CRAN (R 4.2.0)
   #>  withr       2.5.0   2022-03-03 [1] CRAN (R 4.2.0)
   #> 
   #>  [1] /Users/deweydunnington/Library/R/arm64/4.2/library
   #>  [2] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
   #> 
   #> 
──────────────────────────────────────────────────────────────────────────────
   ```
   
   I will try to replicate in Docker as well.
   
   Detailed output:
   
   <details>
   
   ```
   R version 4.2.2 Patched (2022-11-10 r83330) -- "Innocent and Trusting"
   Copyright (C) 2022 The R Foundation for Statistical Computing
   Platform: x86_64-pc-linux-gnu (64-bit)
   
   R is free software and comes with ABSOLUTELY NO WARRANTY.
   You are welcome to redistribute it under certain conditions.
   Type 'license()' or 'licence()' for distribution details.
   
   R is a collaborative project with many contributors.
   Type 'contributors()' for more information and
   'citation()' on how to cite R or R packages in publications.
   
   Type 'demo()' for some demos, 'help()' for on-line help, or
   'help.start()' for an HTML browser interface to help.
   Type 'q()' to quit R.
   
   > # Licensed to the Apache Software Foundation (ASF) under one
   > # or more contributor license agreements.  See the NOTICE file
   > # distributed with this work for additional information
   > # regarding copyright ownership.  The ASF licenses this file
   > # to you under the Apache License, Version 2.0 (the
   > # "License"); you may not use this file except in compliance
   > # with the License.  You may obtain a copy of the License at
   > #
   > #   http://www.apache.org/licenses/LICENSE-2.0
   > #
   > # Unless required by applicable law or agreed to in writing,
   > # software distributed under the License is distributed on an
   > # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   > # KIND, either express or implied.  See the License for the
   > # specific language governing permissions and limitations
   > # under the License.
   > 
   > library(testthat)
   > library(nanoarrow)
   > 
   > verbose_test_output <- identical(tolower(Sys.getenv("ARROW_R_DEV", 
"false")), "true") ||
   +   identical(tolower(Sys.getenv("ARROW_R_VERBOSE_TEST", "false")), "true")
   > 
   > if (verbose_test_output) {
   +   reporter <- MultiReporter$new(list(CheckReporter$new(), 
LocationReporter$new()))
   + } else {
   +   reporter <- check_reporter()
   + }
   > 
   > test_check("nanoarrow", reporter = reporter)
   [ FAIL 4 | WARN 0 | SKIP 4 | PASS 963 ]
   
   ══ Skipped tests 
═══════════════════════════════════════════════════════════════
   • On CRAN (4)
   
   ══ Failed tests 
════════════════════════════════════════════════════════════════
   ── Error ('test-as-array.R:466'): as_nanoarrow_array() works for 
blob::blob() -> na_large_binary() ──
   Error: Invalid: invalid R type to convert to binary
   Backtrace:
        ▆
     1. ├─nanoarrow::as_nanoarrow_array(...) at test-as-array.R:466:2
     2. ├─nanoarrow:::as_nanoarrow_array.blob(...)
     3. │ ├─nanoarrow::as_nanoarrow_array(unclass(x), schema = schema)
     4. │ └─nanoarrow:::as_nanoarrow_array.default(unclass(x), schema = schema)
     5. └─nanoarrow:::as_nanoarrow_array_from_c(`<list>`, `<nnrrw_sc>`)
     6.   ├─nanoarrow::as_nanoarrow_array(x, schema = schema, .from_c = TRUE)
     7.   └─nanoarrow:::as_nanoarrow_array.default(x, schema = schema, .from_c 
= TRUE)
     8.     ├─nanoarrow::as_nanoarrow_array(arrow::as_arrow_array(x, type = 
arrow::as_data_type(schema)))
     9.     ├─arrow::as_arrow_array(x, type = arrow::as_data_type(schema))
    10.     └─arrow:::as_arrow_array.default(x, type = 
arrow::as_data_type(schema))
    11.       └─arrow:::vec_to_Array(x, type)
   ── Error ('test-convert-array.R:757'): convert to vector works for data 
frames nested inside lists ──
   Error in `(function (x, ..., type = NULL) 
   {
       UseMethod("as_arrow_array")
   })(structure(list(structure(list(x = 1:5), class = "data.frame", row.names = 
c(NA, 
   -5L)), structure(list(x = 6:10), class = "data.frame", row.names = c(NA, 
   -5L)), structure(list(x = 11:15), class = "data.frame", row.names = c(NA, 
   -5L))), ptype = structure(list(x = integer(0)), class = "data.frame", 
row.names = integer(0)), class = c("vctrs_list_of", 
   "vctrs_vctr", "list")), type = <environment>, from_vec_to_array = TRUE)`: 
Can't create Array<list_of(struct(x = int32()))> from object of type 
vctrs_list_of / vctrs_vctr / list
   Backtrace:
        ▆
     1. ├─nanoarrow::as_nanoarrow_array(df_in_list) at 
test-convert-array.R:757:2
     2. ├─nanoarrow:::as_nanoarrow_array.default(df_in_list)
     3. ├─nanoarrow:::as_nanoarrow_array_from_c(`<list<df[,1]>>`, `<nnrrw_sc>`)
     4. │ ├─nanoarrow::as_nanoarrow_array(x, schema = schema, .from_c = TRUE)
     5. │ └─nanoarrow:::as_nanoarrow_array.default(x, schema = schema, .from_c 
= TRUE)
     6. │   ├─nanoarrow::as_nanoarrow_array(arrow::as_arrow_array(x, type = 
arrow::as_data_type(schema)))
     7. │   ├─arrow::as_arrow_array(x, type = arrow::as_data_type(schema))
     8. │   └─arrow:::as_arrow_array.default(x, type = 
arrow::as_data_type(schema))
     9. │     └─arrow:::vec_to_Array(x, type)
    10. ├─arrow (local) `<fn>`(`<list<df[,1]>>`, type = `<ListType>`, 
from_vec_to_array = TRUE)
    11. └─arrow:::as_arrow_array.default(`<list<df[,1]>>`, type = `<ListType>`, 
from_vec_to_array = TRUE)
    12.   └─arrow:::stop_cant_convert_array(x, type)
    13.     └─rlang::abort(...)
   ── Error ('test-convert-array.R:775'): convert to vector works for lists 
nested in data frames ──
   Error in `(function (x, ..., type = NULL) 
   {
       UseMethod("as_arrow_array")
   })(structure(list(structure(list(x = 1:5), class = "data.frame", row.names = 
c(NA, 
   -5L)), structure(list(x = 6:10), class = "data.frame", row.names = c(NA, 
   -5L)), structure(list(x = 11:15), class = "data.frame", row.names = c(NA, 
   -5L))), ptype = structure(list(x = integer(0)), class = "data.frame", 
row.names = integer(0)), class = c("vctrs_list_of", 
   "vctrs_vctr", "list")), type = <environment>, from_vec_to_array = TRUE)`: 
Can't create Array<list_of(struct(x = int32()))> from object of type 
vctrs_list_of / vctrs_vctr / list
   Backtrace:
        ▆
     1. ├─nanoarrow::as_nanoarrow_array(df_in_list_in_df) at 
test-convert-array.R:775:2
     2. ├─nanoarrow:::as_nanoarrow_array.default(df_in_list_in_df)
     3. ├─nanoarrow:::as_nanoarrow_array_from_c(`<list<df[,1]>>`, `<nnrrw_sc>`)
     4. │ ├─nanoarrow::as_nanoarrow_array(x, schema = schema, .from_c = TRUE)
     5. │ └─nanoarrow:::as_nanoarrow_array.default(x, schema = schema, .from_c 
= TRUE)
     6. │   ├─nanoarrow::as_nanoarrow_array(arrow::as_arrow_array(x, type = 
arrow::as_data_type(schema)))
     7. │   ├─arrow::as_arrow_array(x, type = arrow::as_data_type(schema))
     8. │   └─arrow:::as_arrow_array.default(x, type = 
arrow::as_data_type(schema))
     9. │     └─arrow:::vec_to_Array(x, type)
    10. ├─arrow (local) `<fn>`(`<list<df[,1]>>`, type = `<ListType>`, 
from_vec_to_array = TRUE)
    11. └─arrow:::as_arrow_array.default(`<list<df[,1]>>`, type = `<ListType>`, 
from_vec_to_array = TRUE)
    12.   └─arrow:::stop_cant_convert_array(x, type)
    13.     └─rlang::abort(...)
   ── Error ('test-infer-ptype.R:104'): infer_nanoarrow_ptype() infers ptypes 
for nested types ──
   Error in `(function (x, ..., type = NULL) 
   {
       UseMethod("as_arrow_array")
   })(structure(list(integer(0)), ptype = integer(0), class = 
c("vctrs_list_of", 
   "vctrs_vctr", "list")), type = <environment>, from_vec_to_array = TRUE)`: 
Can't create Array<list_of(int32())> from object of type vctrs_list_of / 
vctrs_vctr / list
   Backtrace:
        ▆
     1. ├─nanoarrow::as_nanoarrow_array(vctrs::list_of(integer())) at 
test-infer-ptype.R:104:2
     2. ├─nanoarrow:::as_nanoarrow_array.default(vctrs::list_of(integer()))
     3. ├─nanoarrow:::as_nanoarrow_array_from_c(`<list<int>>`, `<nnrrw_sc>`)
     4. │ ├─nanoarrow::as_nanoarrow_array(x, schema = schema, .from_c = TRUE)
     5. │ └─nanoarrow:::as_nanoarrow_array.default(x, schema = schema, .from_c 
= TRUE)
     6. │   ├─nanoarrow::as_nanoarrow_array(arrow::as_arrow_array(x, type = 
arrow::as_data_type(schema)))
     7. │   ├─arrow::as_arrow_array(x, type = arrow::as_data_type(schema))
     8. │   └─arrow:::as_arrow_array.default(x, type = 
arrow::as_data_type(schema))
     9. │     └─arrow:::vec_to_Array(x, type)
    10. ├─arrow (local) `<fn>`(`<list<int>>`, type = `<ListType>`, 
from_vec_to_array = TRUE)
    11. └─arrow:::as_arrow_array.default(`<list<int>>`, type = `<ListType>`, 
from_vec_to_array = TRUE)
    12.   └─arrow:::stop_cant_convert_array(x, type)
    13.     └─rlang::abort(...)
   
   [ FAIL 4 | WARN 0 | SKIP 4 | PASS 963 ]
   Error: Test failures
   Execution halted
   ```
   
   ...with full gist at 
https://gist.github.com/kou/1194cf28cb8e70fe309d0f07e6f49b3b#file-testthat-rout-fail
   
   </details>


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to