From 872bbda4eb2e75690f0c756c616c171ad6615739 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 11 Jan 2023 17:15:08 +0900 Subject: [PATCH] GH-26209: [Ruby] Add support for Ruby 2.5 (#33602) # Which issue does this PR close? Closes #26209 # Rationale for this change Ruby 2.5 was EOL but Ubuntu 18.04 still uses Ruby 2.5. Note that Ubuntu 18.04 will reach EOL on 2023-04. # What changes are included in this PR? Ruby 2.5 compatible implementation and tests. # Are these changes tested? Yes # Are there any user-facing changes? No. * Closes: #26209 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- .../lib/arrow-dataset/arrow-table-loadable.rb | 2 +- ruby/red-arrow/lib/arrow/table.rb | 2 +- ruby/red-arrow/test/test-table.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/arrow-table-loadable.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/arrow-table-loadable.rb index b3e6b1a1096e8..38bcc86f3fb2f 100644 --- a/ruby/red-arrow-dataset/lib/arrow-dataset/arrow-table-loadable.rb +++ b/ruby/red-arrow-dataset/lib/arrow-dataset/arrow-table-loadable.rb @@ -42,7 +42,7 @@ def internal_load_from_uri(uri) factory.file_system_uri = uri finish_options = FinishOptions.new FinishOptions.instance_methods(false).each do |method| - next unless method.end_with?("=") + next unless method.to_s.end_with?("=") value = options.delete(method[0..-2].to_sym) next if value.nil? finish_options.public_send(method, value) diff --git a/ruby/red-arrow/lib/arrow/table.rb b/ruby/red-arrow/lib/arrow/table.rb index 5a4c0d467040a..4f016207016c4 100644 --- a/ruby/red-arrow/lib/arrow/table.rb +++ b/ruby/red-arrow/lib/arrow/table.rb @@ -517,7 +517,7 @@ def pack # # @since 7.0.0 def join(right, keys=nil, type: :inner, left_outputs: nil, right_outputs: nil) - keys ||= column_names.intersection(right.column_names) + keys ||= (column_names & right.column_names) plan = ExecutePlan.new left_node = plan.build_source_node(self) right_node = plan.build_source_node(right) diff --git a/ruby/red-arrow/test/test-table.rb b/ruby/red-arrow/test/test-table.rb index dace8164f66aa..96806090f3da9 100644 --- a/ruby/red-arrow/test/test-table.rb +++ b/ruby/red-arrow/test/test-table.rb @@ -1199,7 +1199,7 @@ def setup ]), table1.join(table2, {left: "left_key", right: :right_key}, - **{})) + type: :inner)) end test("keys: {left: [String, Symbol], right: [Symbol, String]}") do @@ -1222,7 +1222,7 @@ def setup left: ["left_key1", :left_key2], right: [:right_key1, "right_key2"], }, - **{})) + type: :inner)) end test("type:") do