Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(r): Improve printing and conversion of buffers #208

Merged
merged 8 commits into from
May 31, 2023

Conversation

paleolimbot
Copy link
Member

After #207, buffer data types are readily available. Before, the R bindings did most of this on their own to get debug buffer printing. This PR exploits the new feature to improve debug output and adds the ability to convert buffers into R vectors along the way.

Before this PR:

library(nanoarrow)
as_nanoarrow_array(c(NA, stringr::words))
#> <nanoarrow_array string[981]>
#>  $ length    : int 981
#>  $ null_count: int 1
#>  $ offset    : int 0
#>  $ buffers   :List of 3
#>   ..$ :<nanoarrow_buffer_validity[123 b] at 0x13b71d8d0>
#>   ..$ :<nanoarrow_buffer_data_offset32[3928 b] at 0x13d87b600>
#>   ..$ :<nanoarrow_buffer_data_utf8[5126 b] at 0x13d87c600>
#>  $ dictionary: NULL
#>  $ children  : list()

Created on 2023-05-30 with reprex v2.0.2

After this PR:

library(nanoarrow)
as_nanoarrow_array(c(NA, stringr::words))
#> <nanoarrow_array string[981]>
#>  $ length    : int 981
#>  $ null_count: int 1
#>  $ offset    : int 0
#>  $ buffers   :List of 3
#>   ..$ :<nanoarrow_buffer validity<bool>[984][123 b]> `FALSE TRUE TRUE TRUE T...`
#>   ..$ :<nanoarrow_buffer data_offset<int32>[982][3928 b]> `0 0 1 5 10 18 24 ...`
#>   ..$ :<nanoarrow_buffer data<string>[5126 b]> `aableaboutabsoluteacceptacco...`
#>  $ dictionary: NULL
#>  $ children  : list()

Created on 2023-05-30 with reprex v2.0.2

@codecov-commenter
Copy link

Codecov Report

Merging #208 (b022bb3) into main (1e6ca7e) will decrease coverage by 0.10%.
The diff coverage is 81.16%.

@@            Coverage Diff             @@
##             main     #208      +/-   ##
==========================================
- Coverage   87.93%   87.84%   -0.10%     
==========================================
  Files          60       60              
  Lines        9164     9211      +47     
==========================================
+ Hits         8058     8091      +33     
- Misses       1106     1120      +14     
Impacted Files Coverage Δ
r/src/init.c 100.00% <ø> (ø)
r/src/buffer.c 82.53% <78.68%> (-4.42%) ⬇️
r/R/buffer.R 76.28% <78.94%> (+2.21%) ⬆️
r/R/infer-ptype.R 100.00% <100.00%> (ø)
r/src/array.c 95.59% <100.00%> (+3.43%) ⬆️
r/src/buffer.h 94.59% <100.00%> (+1.26%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@paleolimbot paleolimbot merged commit 1690579 into apache:main May 31, 2023
12 checks passed
@paleolimbot paleolimbot deleted the r-buffers branch September 19, 2023 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants