Project

General

Profile

Bug #3962

RExpression2 - support RecordTokens with length=1

Added by ben leinfelder over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Category:
actors
Target version:
Start date:
04/07/2009
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
3962

Description

Ptolemy expression: {a = 1, b = "b", c = 3}
results in a conversion error when going from Token->Java/R

History

#1 Updated by Derik Barseghian over 10 years ago

Hmm, this looks familiar. I think I fixed this, or something similar in the original RExpression actor. Not sure if that's in anyway helpful for RExpression2, but if so, grep your mail for "No longer ignore recordtokens with length 1 in conversion to dataframe.", a cvs commit on April 25, 2008 to see the relevant section.

#2 Updated by ben leinfelder over 10 years ago

I can see in the RExpression2 code that I'm assuming RecordTokens contain ArrayTokens. But when there's only one Token, there's a class cast exception (duh).

#3 Updated by ben leinfelder over 10 years ago

RExpression2 actor now accepts the length=1 RecordToken, but slightly mutates the structure during the conversion.
Ptolemy -> JRI -> Ptolemy results in the following Token: {a = {1}, b = "b", c = {3}}
Notice that the the numeric tokens (a and c) are now lists, whereas the string token is a single token.
JRI only assigns numeric values using arrays of them. Even treating the String as a String[] doesn't force "b" to be a list - this seems like a JRI limitation.

I think we can live with what's returned. The alternative is to treat the numbers as strings so that it's a uniform data structure.

Subsequent passes through multiple RExpression2 actors preserves the data structure as such: {a = {1}, b = "b", c = {3}}
so at least it's predictable from that standpoint.

#4 Updated by Redmine Admin over 6 years ago

Original Bugzilla ID was 3962

Also available in: Atom PDF