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

Raw Vector is turned into RDoubleVector where an instance of RAbstractIntVector is expected using pdftools and underlying poppler #46

Closed
NRBPerdijk opened this issue Jan 3, 2019 · 2 comments

Comments

@NRBPerdijk
Copy link

Hello!

I am using GraalVM rc10 with fastR to make our R-functions executable from our Scala codebase. I have made some nice progress, but I’m now stuck on what appears to be an internal issue with how graal/fastr handles R vectors.
I am trying to render a pdf using the R package pdftools, but when passing the function pdf_render_page a raw vector (as it demands) I get the stack trace printed below, saying it dies in the underlying poppler_render_page call. Apparently, somewhere internally, the raw vector gets converted to an RDoubleVector, which cannot be cast to an RAbstractIntVector (makes sense).
The same raw vector works fine when passed to pdf_info (which is from the same pdftools package).

The original data is an Array of Integers handed over from Scala code, using GraalVM, so there is nothing in the data that precludes making it an IntVector. I also explicitly convert it to raw using as.raw().

Not sure if this is relevant, but I am on MacOS and have poppler 0.72.0 installed using brew (required for the pdftools package)

Thanks in advance!

Stacktrace

	at com.oracle.truffle.r.nodes.function.FunctionDefinitionNode.execute(FunctionDefinitionNode.java:325)
	at <R>.poppler_render_page(Unknown)
	at <R>.pdf_render_page(unknown.r:1)
	at <R>.[my application]
@steve-s
Copy link
Member

steve-s commented Jan 3, 2019

Hello Nathan,

thank you for the report. I could reproduce ClassCastException involving double vector to int vector conversion using this snippet:

pdf_render_page("doc/NEWS.pdf")

the stack trace is

Caused by: java.lang.ClassCastException: com.oracle.truffle.r.runtime.data.RDoubleVector cannot be cast to com.oracle.truffle.r.runtime.data.model.RAbstractIntVector
        at com.oracle.truffle.r.runtime.data.RVector.setAttr(RVector.java:209)
        at com.oracle.truffle.r.ffi.impl.common.JavaUpCallsRFFIImpl.Rf_setAttrib(JavaUpCallsRFFIImpl.java:347)
        at com.oracle.truffle.r.ffi.impl.upcalls.Rf_setAttribCall$Rf_setAttribCallFactory$1.execute(Rf_setAttribCall.java:61)
        at com.oracle.truffle.api.impl.DefaultCallTarget.callDirectOrIndirect(DefaultCallTarget.java:81)
        at com.oracle.truffle.api.impl.DefaultDirectCallNode.call(DefaultDirectCallNode.java:59)
        ...

We're working on a fix.

dougxc pushed a commit that referenced this issue Jan 4, 2019
@steve-s
Copy link
Member

steve-s commented Jan 4, 2019

Should be fixed now. The fixes will probably make it to the next RC, or you can compile GraalVM from the sources to have them right now.

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

No branches or pull requests

2 participants