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/15 05:55:54 UTC

[arrow] branch master updated: GH-15289: [Ruby] Return self when saving Table to csv (#33653)

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 fee9588093 GH-15289: [Ruby] Return self when saving Table to csv (#33653)
fee9588093 is described below

commit fee95880932d6f52f97401efc9b6d89052095aee
Author: Hirokazu SUZUKI <he...@gmail.com>
AuthorDate: Sun Jan 15 14:55:47 2023 +0900

    GH-15289: [Ruby] Return self when saving Table to csv (#33653)
    
    # Rationale for this change
    
    Change return value of Table#save when saving Table to csv files.
    
    # What changes are included in this PR?
    
    Change return value to self (`@ table`).
    
    # Are these changes tested?
    
    Add test for saving to csv.
    
    # Are there any user-facing changes?
    
    Return value of Table#save is undetermined.
    
    * Closes: #15289
    
    Authored-by: Hirokazu SUZUKI <he...@gmail.com>
    Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
 ruby/red-arrow/lib/arrow/table-saver.rb | 1 +
 ruby/red-arrow/test/test-table.rb       | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/ruby/red-arrow/lib/arrow/table-saver.rb b/ruby/red-arrow/lib/arrow/table-saver.rb
index f19261cced..c33e641438 100644
--- a/ruby/red-arrow/lib/arrow/table-saver.rb
+++ b/ruby/red-arrow/lib/arrow/table-saver.rb
@@ -51,6 +51,7 @@ module Arrow
         raise ArgumentError, message
       end
       __send__(custom_save_method)
+      @table
     end
 
     private
diff --git a/ruby/red-arrow/test/test-table.rb b/ruby/red-arrow/test/test-table.rb
index 96806090f3..bd09c3536a 100644
--- a/ruby/red-arrow/test/test-table.rb
+++ b/ruby/red-arrow/test/test-table.rb
@@ -720,6 +720,11 @@ class TableTest < Test::Unit::TestCase
                                            schema: @table.schema))
           end
 
+          test("csv, return value") do
+            output = create_output(".csv")
+            assert_equal(@table, @table.save(output))
+          end
+
           test("csv.gz") do
             output = create_output(".csv.gz")
             @table.save(output)