Open uzzell opened 1 year ago
Now that I've thought about this for a bit, it looks like this behavior reflects the fact that a Row object represents both a set of data (i.e., a row of a Relation) and an Iterator over sets of data. When one uses this constructor, the object returned acts like a newly instantiated Iterator. However--and this is the reason for the surprise--it does not act like a row of a Relation. One must iterate before any data is exposed.
Yes, it’s really an integrator as creating rows would be very expensive
On Mon, Feb 13, 2023 at 11:22 AM uzzell @.***> wrote:
Now that I've thought about this for a bit, it looks like this behavior reflects the fact that a Row object represents both a set of data (i.e., a row of a Relation) and an Iterator over sets of data. When one uses this constructor, the object returned acts like a newly instantiated Iterator. However--and this is the reason for the surprise--it does not act like a row of a Relation. One must iterate before any data is exposed.
— Reply to this email directly, view it on GitHub https://github.com/jtablesaw/tablesaw/issues/1184#issuecomment-1428235514, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2FPAUTNB4CQI3Y5G2ISODWXJNVNANCNFSM6AAAAAAUVUR2WY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
It would be helpful if the documentation for this constructor indicated that the Row object created wasn't positioned at any index of the Table.
When I create a Row from a Table (without specifying a row number) and try to set a value on the Row, I get an error.
Steps to reproduce:
Actual result: This produces
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 128
. No wonder: the Row'srowNumber
equals -1, so it's trying to set the-1
th entry of the column.If I use a (valid) row index to create the Row, as in
Row row = new Row(table, 0)
, everything is fine.Expected result: No exception