groonga-command 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04a4658a7058ae319eef6558e4b0890cf63f1374cbc18ca6620f89c1713d1079
4
- data.tar.gz: 585f68bee46bc0455b5b0be0056636b9b61518bf53354513081191ceb7156996
3
+ metadata.gz: c0516f0f80a6af2fefb12d10390e6f314ecf88e08f1cafc3abc942c92e13a23b
4
+ data.tar.gz: 67eb82831789e515f65f153d9dd6b2833b0b364b4d80befdb04013ca7343caf2
5
5
  SHA512:
6
- metadata.gz: 6141e8378ce9f64024c481af745a519e598c40b15b313447537d78030f24ce8d7a84ca1f2df52ad06176a1153792f2edbde20cf32d4dce40ff1b043a53780ba3
7
- data.tar.gz: eee5697534989943e5d0b038b14af59eea0a811c9aab09e2bf25d4251c7783efac899846c6a631e3de291b16d95fc33f9f88fe5e318be87eba61c7331870deba
6
+ metadata.gz: e6771fb6bd7beab7ac173819a9164d810240372a2caad156c3b34d86a45d3a79549fda55e2a86aaba17040640fdede581ef3b878f79870ba3bf588f4d0388d88
7
+ data.tar.gz: 96d88ac9df80ab87c3df8537a0f6280d851cd24af476fc04ccd6439e46f91a80a01ee59c6e0511c8d340cdaabebd1ecfcf651bc16e3d7b3a769997d8e8187048
data/doc/text/news.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # News
2
2
 
3
+ ## 1.4.7: 2020-01-10
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::Command::Load#build_arrow_table}: Added support for raw
8
+ values case.
9
+
3
10
  ## 1.4.6: 2020-01-10
4
11
 
5
12
  ### Improvements
@@ -84,7 +84,19 @@ module Groonga
84
84
  unless defined?(::Arrow)
85
85
  raise NotImplementedError, "red-arrow is required"
86
86
  end
87
- builder = ArrowTableBuilder.new(columns, values)
87
+ source_lines = (original_source || "").lines
88
+ if source_lines.size >= 2
89
+ if /\s--columns\s/ =~ source_lines.first
90
+ target_columns = columns
91
+ else
92
+ target_columns = nil
93
+ end
94
+ target_values = JSON.parse(source_lines[1..-1].join(""))
95
+ else
96
+ target_columns = columns
97
+ target_values = values
98
+ end
99
+ builder = ArrowTableBuilder.new(target_columns, target_values)
88
100
  builder.build
89
101
  end
90
102
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Groonga
18
18
  module Command
19
- VERSION = "1.4.6"
19
+ VERSION = "1.4.7"
20
20
  end
21
21
  end
@@ -123,7 +123,7 @@ class LoadCommandTest < Test::Unit::TestCase
123
123
  end
124
124
 
125
125
  sub_test_case("Array") do
126
- def test_no_columns_argument
126
+ def test_without_columns_argument
127
127
  command = load_command({"values" => [
128
128
  ["column1", "column2"],
129
129
  ["value1", "value2"],
@@ -135,7 +135,7 @@ class LoadCommandTest < Test::Unit::TestCase
135
135
  command.build_arrow_table)
136
136
  end
137
137
 
138
- def test_columns_argument
138
+ def test_with_columns_argument
139
139
  command = load_command({"columns" => ["column1", "column2"].join(", "),
140
140
  "values" => [
141
141
  ["value1", "value2"],
@@ -168,5 +168,38 @@ class LoadCommandTest < Test::Unit::TestCase
168
168
  command.build_arrow_table)
169
169
  end
170
170
  end
171
+
172
+ sub_test_case("raw values") do
173
+ def test_without_columns_argument
174
+ columns = ["column1", "column2"]
175
+ command = load_command("columns" => columns.join(","))
176
+ command.original_source = "load\n" + [
177
+ columns,
178
+ ["value1", "value2"],
179
+ ["value10", "value20"],
180
+ ].to_json
181
+ columns = {
182
+ "column1" => ["value1", "value10"],
183
+ "column2" => ["value2", "value20"],
184
+ }
185
+ assert_equal(Arrow::Table.new(columns),
186
+ command.build_arrow_table)
187
+ end
188
+
189
+ def test_with_columns_argument
190
+ columns = ["column1", "column2"]
191
+ command = load_command("columns" => columns.join(","))
192
+ command.original_source = "load --columns #{columns.join(",")}\n" + [
193
+ ["value1", "value2"],
194
+ ["value10", "value20"],
195
+ ].to_json
196
+ columns = {
197
+ "column1" => ["value1", "value10"],
198
+ "column2" => ["value2", "value20"],
199
+ }
200
+ assert_equal(Arrow::Table.new(columns),
201
+ command.build_arrow_table)
202
+ end
203
+ end
171
204
  end
172
205
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou