Giter Club home page Giter Club logo

Comments (6)

traversc avatar traversc commented on May 30, 2024

Could you update to the latest version 0.19.1, install.packages("qs")?

I did some digging, but I can't see how that error can be generated. But if you could send or create a reproducible example I would very much appreciate it!

Edit: to be a bit more clear, if you search the code for where attributes are set (https://github.com/traversc/qs/search?q=Rf_setAttrib&unscoped_q=Rf_setAttrib)

-- you can see that it's always accompanied by a Rf_install which converts the char to a symbol. So I don't understand how the SET_ATTRIB function can ever see a char.

E.g. if you made a simplified Rcpp function, I can't find any inputs that would produce that error:

void test(SEXP obj, SEXP new_attrib, std::string temp_attrib_string) {
   Rf_setAttrib(obj, Rf_install(temp_attribute_string.c_str()), new_attrib);
}

One thing I noticed is that I use temp_attribute_string.data() but it should be temp_attribute_string.c_str(). I don't think this makes a difference but maybe.

Anyway, please let me know what the error is on the latest version and if you can send me the example file.

from qs.

leungi avatar leungi commented on May 30, 2024

Thanks for prompt response @traversc.

Updated package to 0.19.1. Still can't open file, but error message is generic this time:

Error in c_qread(file, use_alt_rep, strict, nthreads) : 
  Failed to open file

Unfortunately, data are confidential, so I can't share.

I'll do the batch run with new pkg version, and hope output are all read-able this time 🤞; will update here.

from qs.

traversc avatar traversc commented on May 30, 2024

"Failed to open file" happens when it can't open up the file at all, right at the beginning of the function.

qs/src/qs_functions.cpp

Lines 272 to 276 in ce11fcd

SEXP c_qread(const std::string & file, const bool use_alt_rep, const bool strict, const int nthreads) {
std::ifstream myFile(R_ExpandFileName(file.c_str()), std::ios::in | std::ios::binary);
if(!myFile) {
throw std::runtime_error("Failed to open file");
}

from qs.

leungi avatar leungi commented on May 30, 2024

Noted; it's odd to me that it always happen to a handful (<5%) of files when running in batch (e.g. 50 output).

However, re-running the input data for those corrupted files the second time gives read-able output; I suppose it's the way of life - mutated/bad DNA every so often 😄.

On a side note, new error message on subsequent re-runs:

> qs::qread("output_data/my_file.q")
Error in c_qread(file, use_alt_rep, strict, nthreads) : 
  ReadItem: unknown type 0, perhaps written by later version of R
> qs::qread("output_data/my_file_2.q")
Error in c_qread(file, use_alt_rep, strict, nthreads) : 
  ReadItem: unknown type 88, perhaps written by later version of R

Since I can't replicate these errors manually, and can't share the data either (sorry!); I'll leave it up to you if you'd like to close issue.

from qs.

traversc avatar traversc commented on May 30, 2024

Sorry I'm not really able to help you. I use qs myself every day, and haven't run into these issues.

It's sure possible that there are bugs in qs, but to me it sounds like your files are getting corrupted some how. E.g. if you try to save to the same qs file from two different threads (e.g., using parallel processes) that might break it; if you are running a batch, make sure all the save file names are unique.

I will close, but feel free to re-open or make a new issue.

from qs.

leungi avatar leungi commented on May 30, 2024

Thanks for feedback; I do ensure file names are unique.

For the convenience qs provides, I can live with <5% lemons 😄 👍

from qs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.