From 65846a0afef3072456ef7ec97f6b0db139688ab1 Mon Sep 17 00:00:00 2001 From: lch34677 Date: Sat, 14 Sep 2019 13:16:47 -0400 Subject: [PATCH 1/3] Simple exploration about arrow. --- inst/julia/arrow.jl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 inst/julia/arrow.jl diff --git a/inst/julia/arrow.jl b/inst/julia/arrow.jl new file mode 100644 index 00000000..6eacfb97 --- /dev/null +++ b/inst/julia/arrow.jl @@ -0,0 +1,18 @@ +using Arrow +import RCall.sexp +import RCall.rcopy +import RCall: RClass, rcopytype + +## Julia Tuple will be convert to S3 class JuliaTuple based on R list + +function sexp(x ::Primitive{Float64}) + sexp(x[:]) +end + +const Ras_vector = R"function(x) x[['as_vector']]()" + +function rcopy(::Type{Primitive}, x::Ptr{EnvSxp}) + rcopy(RCall.rcall_p(Ras_vector, x)) +end + +rcopytype(::Type{RClass{Symbol("arrow::Array")}}, x::Ptr{EnvSxp}) = Primitive From a61da21b9636eb410197ccc96aa5a86fb548d506 Mon Sep 17 00:00:00 2001 From: lch34677 Date: Sun, 15 Sep 2019 17:12:42 -0400 Subject: [PATCH 2/3] Use Require to load arrow related code conditionally. --- inst/julia/arrow.jl | 4 ++-- inst/julia/setup.jl | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/inst/julia/arrow.jl b/inst/julia/arrow.jl index 6eacfb97..7ca37165 100644 --- a/inst/julia/arrow.jl +++ b/inst/julia/arrow.jl @@ -1,11 +1,11 @@ -using Arrow +using .Arrow import RCall.sexp import RCall.rcopy import RCall: RClass, rcopytype ## Julia Tuple will be convert to S3 class JuliaTuple based on R list -function sexp(x ::Primitive{Float64}) +function sexp(x ::Primitive) sexp(x[:]) end diff --git a/inst/julia/setup.jl b/inst/julia/setup.jl index d4da70c6..b31603db 100644 --- a/inst/julia/setup.jl +++ b/inst/julia/setup.jl @@ -230,4 +230,12 @@ function include1(fname) end end +using RCall.Requires + +function __init__() + @require Arrow="69666777-d1a9-59fb-9406-91d4454c9d45" include("arrow.jl") +end + end + +using Main.JuliaCall From 59c3adee427689c35bccf5f46d023662e0f7e0fe Mon Sep 17 00:00:00 2001 From: lch34677 Date: Sun, 15 Sep 2019 18:00:36 -0400 Subject: [PATCH 3/3] Try to deal with Julia06 issue. --- inst/julia/setup.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inst/julia/setup.jl b/inst/julia/setup.jl index b31603db..8350b369 100644 --- a/inst/julia/setup.jl +++ b/inst/julia/setup.jl @@ -230,7 +230,12 @@ function include1(fname) end end -using RCall.Requires +if julia07 + using RCall.Requires +else + macro require(args...) + end +end function __init__() @require Arrow="69666777-d1a9-59fb-9406-91d4454c9d45" include("arrow.jl")