You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "fonsan (Jira)" <ji...@apache.org> on 2020/11/19 18:35:00 UTC

[jira] [Comment Edited] (ARROW-10587) [Ruby] Table#initialize examples are out of date

    [ https://issues.apache.org/jira/browse/ARROW-10587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17235644#comment-17235644 ] 

fonsan edited comment on ARROW-10587 at 11/19/20, 6:34 PM:
-----------------------------------------------------------

The broken combinations are
 #initialize(columns) ⇒ Table
 #initialize(schema, columns) ⇒ Table

But you suggestion above is actually the previously existing
 #initialize(schema, arrays) ⇒ Table

Should we maintain support for the column variants? if so is this how they are meant to be used?
 #initialize(columns) ⇒ Table
{code:ruby}
table_one = Arrow::Table.new("count" => Arrow::UInt32Array.new([0, 2, nil, 4]),
                 "visible" => Arrow::BooleanArray.new([true, nil, nil, false]))
table_two = Arrow::Table.new(table_one.columns)

{code}
#initialize(schema, columns) ⇒ Table
{code:ruby}
count_field = Arrow::Field.new("count", :uint32)
visible_field = Arrow::Field.new("visible", :boolean)
schema = Arrow::Schema.new([count_field, visible_field])
other_table = Arrow::Table.new("count" => Arrow::UInt32Array.new([0, 2, nil, 4]),
                 "visible" => Arrow::BooleanArray.new([true, nil, nil, false]))
Arrow::Table.new(schema, other_table.columns)
{code}


was (Author: fonsan):
The broken combinations are
#initialize(columns) ⇒ Table
#initialize(schema, columns) ⇒ Table

But you suggestion above is actually the previously existing
#initialize(schema, arrays) ⇒ Table

Should we maintain support for the column variants? if so is this how they are meant to be used?
#initialize(columns) ⇒ Table

{code:ruby}
table_one = Arrow::Table.new("count" => Arrow::UInt32Array.new([0, 2, nil, 4]),
                 "visible" => Arrow::BooleanArray.new([true, nil, nil, false]))
table_two = Arrow::Table.new(table_one.columns)

{code}

#initialize(schema, columns) ⇒ Table

{code:ruby}
count_field = Arrow::Field.new("count", :uint32)
visible_field = Arrow::Field.new("visible", :boolean)
schema = Arrow::Schema.new([count_field, visible_field])
other_table = Arrow::Table.new("count" => Arrow::UInt32Array.new([0, 2, nil, 4]),
                 "visible" => Arrow::BooleanArray.new([true, nil, nil, false]))
{code}





> [Ruby] Table#initialize examples are out of date
> ------------------------------------------------
>
>                 Key: ARROW-10587
>                 URL: https://issues.apache.org/jira/browse/ARROW-10587
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Ruby
>            Reporter: fonsan
>            Assignee: fonsan
>            Priority: Minor
>
> https://www.rubydoc.info/gems/red-arrow/Arrow/Table
> {code:ruby}
> count_field = Arrow::Field.new("count", :uint32)
> count_array = Arrow::UInt32Array.new([0, 2, nil, 4])
> count_column = Arrow::Column.new(count_field, count_array)
> visible_field = Arrow::Field.new("visible", :boolean)
> visible_array = Arrow::BooleanArray.new([true, nil, nil, false])
> visible_column = Arrow::Column.new(visible_field, visible_array)
> Arrow::Table.new(Arrow::Schema.new([count_field, visible_field]),
>                  [count_column, visible_column])
> {code}
> {noformat}
> NoMethodError (undefined method `schema' for #<Arrow::Field:0x7f88cc971e48 ptr=0x7f88cf0266e0 count: uint32>)
> {noformat}
> I would write tests but I presume that the interface has changed and the docs have been left behind. Please advise on how I could help out.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)