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

refactor: simplify import arrow array stream #25

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"ghcr.io/devcontainers-contrib/features/protoc:1": {},
"ghcr.io/rocker-org/devcontainer-features/r-dependent-packages": {
"when": "updateContent",
"additionalRepositories": "polars = 'https://rpolars.r-universe.dev'"
"additionalRepositories": "polars = 'https://rpolars.r-universe.dev'",
"dependencyTypes": "all,Config/Needs/dev,Config/Needs/website"
},
"ghcr.io/eitsupi/devcontainer-features/go-task:1": {}
},
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Config/Needs/dev:
Config/Needs/website:
pkgdown
Config/testthat/edition: 3
Config/glaredb/LibVersion: 0.0.1
Config/glaredb/LibVersion: 0.0.2
2 changes: 1 addition & 1 deletion R/as-external-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ as_nanoarrow_array_stream.RGlareDbTable <- function(x, ..., schema = NULL) {
}

stream <- nanoarrow_allocate_array_stream()
x$export_stream(nanoarrow_pointer_addr_chr(stream))
x$export_stream(stream)

stream
}
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

env:
NOT_CRAN: "true"
LIBR_GLAREDB: "false"
LIBR_GLAREDB_BUILD: "true"
DEBUG: "true"

vars:
Expand Down
2 changes: 1 addition & 1 deletion src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "r-glaredb"
version = "0.0.1"
version = "0.0.2"
edition = "2021"
publish = false

Expand Down
8 changes: 5 additions & 3 deletions src/rust/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ impl RGlareDbTable {
Ok(RGlareDbTable { schema, batches })
}

pub fn export_stream(&self, stream_ptr: &str) -> savvy::Result<()> {
let stream_ptr: usize = stream_ptr.parse().unwrap();
let stream_out = stream_ptr as *mut FFI_ArrowArrayStream;
pub fn export_stream(&self, stream_ptr: savvy::Sexp) -> savvy::Result<()> {
let stream_out = unsafe {
savvy::ExternalPointerSexp::try_from(stream_ptr)?
.cast_mut_unchecked::<FFI_ArrowArrayStream>()
};

let reader = arrow::record_batch::RecordBatchIterator::new(
self.batches.clone().into_iter().map(Ok),
Expand Down
4 changes: 0 additions & 4 deletions tools/lib-sums.tsv

This file was deleted.

Loading