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

R Script limit of 10000 characters #52

Open
stevecondylios opened this issue Feb 16, 2019 · 14 comments
Open

R Script limit of 10000 characters #52

stevecondylios opened this issue Feb 16, 2019 · 14 comments

Comments

@stevecondylios
Copy link

r.eval r_script appears to error suspiciously at the 10k character mark. Can this be increased?

@fenrir-naru
Copy link
Contributor

fenrir-naru commented Feb 20, 2019

Hi, I'm a contributor of RinRuby. I think this is probably related to R readBin function of R getting string from Ruby via socket, because its document says "Input strings are limited to 10000 characters". I think this limitation will be overcome by using another R function such as readChar. Could you provide me a quick example?

@stevecondylios
Copy link
Author

stevecondylios commented Feb 21, 2019

Sure thing

require 'rinruby'
r = RinRuby.new
r9999 = ("a <- 2 +2/n") * 909
r10000 = ("a <- 2 +2/n") * 908 + "a <- 2 + 2/n"
r9999.size # 9999 character R script
r10000.size # 10000 character R script
r.eval r9999 # Works
r.eval r10000
# irb(main):030:0> r.eval r10000
# Traceback (most recent call last):
#         1: from (irb):30
# RinRuby::ParseError (Parse error on eval:a <- 2 +2/na <- 2 +2/na <- 2 +2/na <- 2 +2/na ...

@fenrir-naru
Copy link
Contributor

Thank you.
BTW, I think "a <- 2 +2/n" is little odd, did you mean "a <- 2 +2\n"? (Is the last character 'return' ?)

@stevecondylios
Copy link
Author

Yes sorry that's what I meant

@fenrir-naru
Copy link
Contributor

OK, I will check with the following

require 'rinruby'
r = RinRuby.new
r10000 = ("a <- 2 +2\n") * 1000
r9999 = r10000[0..-2]
r9999.size # 9999 character R script
r10000.size # 10000 character R script
r.eval r9999
r.eval r10000

@stevecondylios
Copy link
Author

Or this will do similarly

r9999 = ("a <- 2 +2\n") * 999 + ("a <- 2+2\n") # 9999 characters
r10000 = ("a <- 2 +2\n") * 1000 # 10000 chracters

@fenrir-naru
Copy link
Contributor

OK, I've reproduced the error. In addition, I found that my forked version, which additionally supported m17n, seemed to deal with it well. Please try it.

@stevecondylios
Copy link
Author

Oh, awesome.

Out of curiosity, why not make a PR upstream if you've improved the functionality etc?

@fenrir-naru
Copy link
Contributor

I discussed the maintainer @clbustos , and agreed that the additional (experimental) functionality will not yet be merged into the master. Please see #37 (comment), and forgive me. In this case, I will make a PR to just work around this error.

@stevecondylios
Copy link
Author

stevecondylios commented Feb 21, 2019

I wonder if the 10k character limit could be altered (in original rinruby), perhaps without the experimental functionality (for now)? It would be really handy. I'm working with 40 - 80k character scripts and manually moving them into chunks is cumbersome (without taking into account when I make tweaks that I forget to manually copy/paste before every build..)

Although a minor change, it would be very useful

@stevecondylios
Copy link
Author

@fenrir-naru switching to your source fixes the 10k limit issue immediately. Great work. This would definitely be very useful in the original rinruby cc @clbustos 😄 👍

@fenrir-naru
Copy link
Contributor

@stevecondylios I'm happy to hear of the resolution. I hope this issue will be left open until a fix for the master is commited.

@clbustos
Copy link
Owner

Ok, I will check @fenrir-naru branch to update head branch.

@clbustos clbustos pinned this issue Feb 22, 2019
@clbustos
Copy link
Owner

@fenrir-naru, which branch should I review? dev or multibyte?

@dometto dometto mentioned this issue Feb 14, 2021
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

3 participants