You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2023/01/30 08:06:32 UTC

[arrow] branch master updated: MINOR: [Ruby][Docs] Add a short example of Arrow::Table#join to README (#33922)

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 4acf7c1768 MINOR: [Ruby][Docs] Add a short example of Arrow::Table#join to README (#33922)
4acf7c1768 is described below

commit 4acf7c17689c926841a5a471828970eda2f496c5
Author: Rob Sharp <qn...@users.noreply.github.com>
AuthorDate: Mon Jan 30 19:06:22 2023 +1100

    MINOR: [Ruby][Docs] Add a short example of Arrow::Table#join to README (#33922)
    
    ### Rationale for this change
    
    The code for `Apache::Table` `join` has recently been merged (#12108, #30086) into the Ruby gem, but the current documentation for `join` suggests referring to Jira, which then links into GitHub, where the commit can be found.
    
    This change instead provides a short example of a join.
    
    ### What changes are included in this PR?
    
    I have added an example to the README and removed the link to the now-completed bug report.
    
    ### Are these changes tested?
    
    No, but is documentation only.
    
    ### Are there any user-facing changes?
    
    Yes - this PR is documentation.
    
    Authored-by: Robin Duncan Sharp <ro...@sharp.id.au>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 ruby/README.md | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/ruby/README.md b/ruby/README.md
index 02020468c5..06b9662f04 100644
--- a/ruby/README.md
+++ b/ruby/README.md
@@ -152,4 +152,19 @@ table.group('name').sum('amount')
 ```
 
 ### Joining
-Work in progress, see https://issues.apache.org/jira/browse/ARROW-14531
+```ruby
+amounts = Arrow::Table.new(
+  'name' => ['Tom', 'Max', 'Kate'],
+  'amount' => [10, 2, 3]
+)
+levels = Arrow::Table.new(
+  'name' => ['Max', 'Kate', 'Tom'],
+  'level' => [1, 9, 5]
+)
+amounts.join(levels, [:name])
+# => #<Arrow::Table:0x55d512ceb1b0 ptr=0x55d51262aa70>
+# 	name	amount	name	level
+# 0	Tom 	    10	Tom 	    5
+# 1	Max 	     2	Max 	    1
+# 2	Kate	     3	Kate	    9
+```