groonga-command 1.4.4 → 1.4.9

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: ce9859484daef364ba74d82aa2391c0f1adbf7c28370b3d8ca974cb7dd18c451
4
- data.tar.gz: c59cf788e9ac27ec0eea8e7ae330d62a48b6a48af000ef72d2c284b730969c01
3
+ metadata.gz: fe62b9d5aed0f3cbfbfa7a7b5b9c5865f6c70886355f3a5c7086399183c62b83
4
+ data.tar.gz: 540863dccacf354e6011fcac61c8e5c3ad03097ce85107b00e7524b1857b3d08
5
5
  SHA512:
6
- metadata.gz: 801903b0deea2eaccb58f175e3eca3557f3783c1e627986016c65ce82709a7bc3f3ddbe882fd0fed9146e94819d0e8fe68ee836f321b0b5c6a37c72dc216c615
7
- data.tar.gz: 7fca220f7e886b28753a6610a228c4deffa2b2e18d0946d44c5179920a9452cc1dae9eed3101c481c61c659151c4f391fc979d3342a38313f0a1a2370d6bd556
6
+ metadata.gz: 7ee5c1ef2e8994b4caa48e88105c9cae72062f0ce7a24071c621c138f098e6e79a94dab16ad93773ead68a0d9eded7f6c49c11ab93cba01f0b999bdd1b06cba3
7
+ data.tar.gz: b65924d1478338a21cfcf9afc4648b9bfde02d368882f5f2d668eacc516b1706f6af80abd641a97b5a30b3a0d1187d764421fd4049b8a98a42e45ae150d5697a
@@ -1,5 +1,48 @@
1
1
  # News
2
2
 
3
+ ## 1.4.9: 2020-06-14
4
+
5
+ ### Improvements
6
+
7
+ * {Groonga::Command::ReferenceAcquire}: Added support for
8
+ `reference_acquire`.
9
+
10
+ * {Groonga::Command::ReferenceRelease}: Added support for
11
+ `reference_release`.
12
+
13
+ * {Groonga::Command::IOFlush#recursive}: Added.
14
+
15
+ * {Groonga::Command::IOFlush#recursive_dependent?}: Added.
16
+
17
+ ## 1.4.8: 2020-05-03
18
+
19
+ ### Improvements
20
+
21
+ * {Groonga::Command::Load#build_arrow_table}: Added support for
22
+ float32 weight vector.
23
+
24
+ ## 1.4.7: 2020-01-10
25
+
26
+ ### Improvements
27
+
28
+ * {Groonga::Command::Load#build_arrow_table}: Added support for raw
29
+ values case.
30
+
31
+ ## 1.4.6: 2020-01-10
32
+
33
+ ### Improvements
34
+
35
+ * {Groonga::Command::Load#build_arrow_table}: Added.
36
+
37
+ ## 1.4.5: 2019-09-02
38
+
39
+ ### Improvements
40
+
41
+ * {Groonga::Command::Select}: Added support for labeled drilldowns in slice.
42
+
43
+ * {Groonga::Command::LogicalSelect}: Added support for labeled
44
+ drilldowns in slice.
45
+
3
46
  ## 1.4.4: 2019-09-02
4
47
 
5
48
  ### Improvements
@@ -1,6 +1,6 @@
1
- # -*- mode: ruby; coding: utf-8 -*-
1
+ # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2012-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -54,12 +54,13 @@ Gem::Specification.new do |spec|
54
54
 
55
55
  spec.add_runtime_dependency("json")
56
56
 
57
- spec.add_development_dependency("test-unit")
58
- spec.add_development_dependency("test-unit-notify")
59
- spec.add_development_dependency("rake")
60
57
  spec.add_development_dependency("bundler")
61
58
  spec.add_development_dependency("packnga")
62
- spec.add_development_dependency("yard")
59
+ spec.add_development_dependency("rake")
60
+ spec.add_development_dependency("red-arrow")
63
61
  spec.add_development_dependency("redcarpet")
62
+ spec.add_development_dependency("test-unit")
63
+ spec.add_development_dependency("test-unit-notify")
64
+ spec.add_development_dependency("yard")
64
65
  end
65
66
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2012-2020 Kouhei Sutou <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
@@ -51,6 +51,8 @@ require "groonga/command/query-log-flags-get"
51
51
  require "groonga/command/query-log-flags-remove"
52
52
  require "groonga/command/query-log-flags-set"
53
53
  require "groonga/command/range-filter"
54
+ require "groonga/command/reference-acquire"
55
+ require "groonga/command/reference-release"
54
56
  require "groonga/command/register"
55
57
  require "groonga/command/reindex"
56
58
  require "groonga/command/request-cancel"
@@ -91,15 +91,15 @@ module Groonga
91
91
  #
92
92
  # @since 1.2.8
93
93
  def labeled_drilldowns
94
- @labeled_drilldowns ||= parse_labeled_drilldowns
94
+ @labeled_drilldowns ||= parse_labeled_drilldowns("")
95
95
  end
96
96
 
97
97
  private
98
- def parse_labeled_drilldowns
98
+ def parse_labeled_drilldowns(prefix)
99
99
  raw_labeled_drilldowns = {}
100
100
  @arguments.each do |name, value|
101
101
  case name.to_s
102
- when /\Adrilldowns?\[(.+?)\]\.(.+?)\z/
102
+ when /\A#{Regexp.escape(prefix)}drilldowns?\[(.+?)\]\.(.+?)\z/
103
103
  label = $1
104
104
  parameter_name = $2
105
105
  raw_labeled_drilldowns[label] ||= {}
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2015-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
@@ -44,11 +44,25 @@ module Groonga
44
44
  self[:target_name]
45
45
  end
46
46
 
47
- # @return [Boolean] `recursive` parameter value.
47
+ # @return [String] `recursive` parameter value.
48
+ #
49
+ # @since 1.4.9
50
+ def recursive
51
+ self[:recursive]
52
+ end
53
+
54
+ # @return [Boolean] Whether `recursive` parameter value isn't `no`.
48
55
  #
49
56
  # @since 1.1.3
50
57
  def recursive?
51
- self[:recursive] != "no"
58
+ recursive != "no"
59
+ end
60
+
61
+ # @return [Boolean] `recursive` parameter value.
62
+ #
63
+ # @since 1.4.9
64
+ def recursive_dependent?
65
+ recursive == "dependent"
52
66
  end
53
67
  end
54
68
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2017 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,11 @@
16
16
 
17
17
  require "json"
18
18
 
19
+ begin
20
+ require "arrow"
21
+ rescue LoadError
22
+ end
23
+
19
24
  require "groonga/command/base"
20
25
 
21
26
  module Groonga
@@ -66,6 +71,35 @@ module Groonga
66
71
  @columns ||= parse_columns(self[:columns])
67
72
  end
68
73
 
74
+ # Builds `Arrow::Table` for data of this `load` command.
75
+ #
76
+ # This requires red-arrow gem. If red-arrow gem isn't available,
77
+ # `NotImplementedError` is raised.
78
+ #
79
+ # @return [Arrow::Table, nil] `Arrow::Table` if there is one or more
80
+ # records, `nil` otherwise.
81
+ #
82
+ # @since 1.4.6
83
+ def build_arrow_table
84
+ unless defined?(::Arrow)
85
+ raise NotImplementedError, "red-arrow is required"
86
+ end
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)
100
+ builder.build
101
+ end
102
+
69
103
  # @return [Boolean] `true` if `output_ids` value is `"yes"`.
70
104
  #
71
105
  # @since 1.3.0
@@ -85,6 +119,152 @@ module Groonga
85
119
  return columns if columns.nil?
86
120
  columns.split(/\s*,\s*/)
87
121
  end
122
+
123
+ class ArrowTableBuilder
124
+ def initialize(columns, values)
125
+ @columns = columns
126
+ @values = values
127
+ end
128
+
129
+ def build
130
+ raw_table = build_raw_table
131
+ return nil if raw_table.empty?
132
+ build_arrow_table(raw_table)
133
+ end
134
+
135
+ private
136
+ def build_raw_table
137
+ raw_table = {}
138
+ if @values.first.is_a?(Array)
139
+ columns = @columns
140
+ if columns
141
+ records = @values
142
+ else
143
+ columns = @values.first
144
+ records = @values[1..-1]
145
+ end
146
+ records.each_with_index do |record, i|
147
+ columns.zip(record).each do |name, value|
148
+ raw_table[name] ||= []
149
+ raw_table[name][i] = value
150
+ end
151
+ end
152
+ else
153
+ @values.each_with_index do |record, i|
154
+ record.each do |name, value|
155
+ raw_table[name] ||= []
156
+ raw_table[name][i] = value
157
+ end
158
+ end
159
+ raw_table.each_key do |key|
160
+ if @values.size > raw_table[key].size
161
+ raw_table[key][@values.size - 1] = nil
162
+ end
163
+ end
164
+ end
165
+ raw_table
166
+ end
167
+
168
+ def build_arrow_table(raw_table)
169
+ arrow_fields = []
170
+ arrow_arrays = []
171
+ raw_table.each do |name, raw_array|
172
+ sample = raw_array.find {|element| not element.nil?}
173
+ case sample
174
+ when Array
175
+ data_type = nil
176
+ raw_array.each do |sub_raw_array|
177
+ next if sub_raw_array.nil?
178
+ data_type = detect_arrow_data_type(sub_raw_array)
179
+ break if data_type
180
+ end
181
+ data_type ||= :string
182
+ arrow_array = build_arrow_array(data_type, raw_array)
183
+ when Hash
184
+ data_type = arrow_weight_vector_data_type(sample)
185
+ arrow_array = build_arrow_array(data_type, raw_array)
186
+ else
187
+ data_type = detect_arrow_data_type(raw_array) || :string
188
+ if data_type == :string
189
+ raw_array = raw_array.collect do |element|
190
+ element&.to_s
191
+ end
192
+ end
193
+ data_type = Arrow::DataType.resolve(data_type)
194
+ arrow_array = data_type.build_array(raw_array)
195
+ end
196
+ arrow_fields << Arrow::Field.new(name,
197
+ arrow_array.value_data_type)
198
+ arrow_arrays << arrow_array
199
+ end
200
+ arrow_schema = Arrow::Schema.new(arrow_fields)
201
+ Arrow::Table.new(arrow_schema, arrow_arrays)
202
+ end
203
+
204
+ def prepare_raw_array(raw_array)
205
+ raw_array.collect do |element|
206
+ case element
207
+ when Array
208
+ prepare_raw_array(element)
209
+ when Hash
210
+ element.collect do |value, weight|
211
+ {
212
+ "value" => value,
213
+ "weight" => weight,
214
+ }
215
+ end
216
+ else
217
+ element
218
+ end
219
+ end
220
+ end
221
+
222
+ def build_arrow_array(data_type, raw_array)
223
+ arrow_list_field = Arrow::Field.new("item", data_type)
224
+ arrow_list_data_type = Arrow::ListDataType.new(arrow_list_field)
225
+ raw_array = prepare_raw_array(raw_array)
226
+ Arrow::ListArrayBuilder.build(arrow_list_data_type, raw_array)
227
+ end
228
+
229
+ def arrow_weight_vector_data_type(raw_value)
230
+ if raw_value.values.any? {|value| value.is_a?(Float)}
231
+ weight_type = :float
232
+ else
233
+ weight_type = :int32
234
+ end
235
+ Arrow::StructDataType.new("value" => :string,
236
+ "weight" => weight_type)
237
+ end
238
+
239
+ def detect_arrow_data_type(raw_array)
240
+ type = nil
241
+ raw_array.each do |element|
242
+ case element
243
+ when nil
244
+ when true, false
245
+ type ||= :boolean
246
+ when Integer
247
+ if element >= (2 ** 63)
248
+ type = nil if type == :int64
249
+ type ||= :uint64
250
+ else
251
+ type ||= :int64
252
+ end
253
+ when Float
254
+ type = nil if type == :int64
255
+ type ||= :double
256
+ when Hash
257
+ item_type = arrow_weight_vector_data_type(element)
258
+ arrow_list_field = Arrow::Field.new("item", item_type)
259
+ arrow_list_data_type = Arrow::ListDataType.new(arrow_list_field)
260
+ return arrow_list_data_type
261
+ else
262
+ return :string
263
+ end
264
+ end
265
+ type
266
+ end
267
+ end
88
268
  end
89
269
  end
90
270
  end
@@ -0,0 +1,69 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/command/base"
18
+
19
+ module Groonga
20
+ module Command
21
+ # A command class that represents `reference_acquire` command.
22
+ #
23
+ # @since 1.4.9
24
+ class ReferenceAcquire < Base
25
+ class << self
26
+ def command_name
27
+ "reference_acquire"
28
+ end
29
+
30
+ def parameter_names
31
+ [
32
+ :target_name,
33
+ :recursive,
34
+ ]
35
+ end
36
+ end
37
+
38
+ Command.register(command_name, self)
39
+
40
+ # @return [String] `target_name` parameter value.
41
+ #
42
+ # @since 1.4.9
43
+ def target_name
44
+ self[:target_name]
45
+ end
46
+
47
+ # @return [String] `recursive` parameter value.
48
+ #
49
+ # @since 1.4.9
50
+ def recursive
51
+ self[:recursive]
52
+ end
53
+
54
+ # @return [Boolean] Whether `recursive` parameter value isn't `no`.
55
+ #
56
+ # @since 1.4.9
57
+ def recursive?
58
+ recursive != "no"
59
+ end
60
+
61
+ # @return [Boolean] `recursive` parameter value.
62
+ #
63
+ # @since 1.4.9
64
+ def recursive_dependent?
65
+ recursive == "dependent"
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "groonga/command/base"
18
+
19
+ module Groonga
20
+ module Command
21
+ # A command class that represents `reference_release` command.
22
+ #
23
+ # @since 1.4.9
24
+ class ReferenceRelease < Base
25
+ class << self
26
+ def command_name
27
+ "reference_release"
28
+ end
29
+
30
+ def parameter_names
31
+ [
32
+ :target_name,
33
+ :recursive,
34
+ ]
35
+ end
36
+ end
37
+
38
+ Command.register(command_name, self)
39
+
40
+ # @return [String] `target_name` parameter value.
41
+ #
42
+ # @since 1.4.9
43
+ def target_name
44
+ self[:target_name]
45
+ end
46
+
47
+ # @return [String] `recursive` parameter value.
48
+ #
49
+ # @since 1.4.9
50
+ def recursive
51
+ self[:recursive]
52
+ end
53
+
54
+ # @return [Boolean] Whether `recursive` parameter value isn't `no`.
55
+ #
56
+ # @since 1.4.9
57
+ def recursive?
58
+ self[:recursive] != "no"
59
+ end
60
+
61
+ # @return [Boolean] `recursive` parameter value.
62
+ #
63
+ # @since 1.4.9
64
+ def recursive_dependent?
65
+ self[:recursive] == "dependent"
66
+ end
67
+ end
68
+ end
69
+ end
@@ -51,6 +51,7 @@ module Groonga
51
51
  output_columns = parse_array_value(raw_slice["output_columns"])
52
52
  offset = parse_integer_value(raw_slice["offset"])
53
53
  limit = parse_integer_value(raw_slice["limit"])
54
+ labeled_drilldowns = parse_labeled_drilldowns("slices[#{label}].")
54
55
  slices[label] = Slice.new(label,
55
56
  match_columns,
56
57
  query,
@@ -60,7 +61,8 @@ module Groonga
60
61
  sort_keys,
61
62
  output_columns,
62
63
  offset,
63
- limit)
64
+ limit,
65
+ labeled_drilldowns)
64
66
  end
65
67
  slices
66
68
  end
@@ -75,7 +77,8 @@ module Groonga
75
77
  :sort_keys,
76
78
  :output_columns,
77
79
  :offset,
78
- :limit)
80
+ :limit,
81
+ :labeled_drilldowns)
79
82
  end
80
83
  end
81
84
  end
@@ -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.4"
19
+ VERSION = "1.4.9"
20
20
  end
21
21
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2015-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
@@ -53,6 +53,9 @@ class IOFlushCommandTest < Test::Unit::TestCase
53
53
  assert do
54
54
  command.recursive?
55
55
  end
56
+ assert do
57
+ not command.recursive_dependent?
58
+ end
56
59
  end
57
60
 
58
61
  def test_no
@@ -60,6 +63,19 @@ class IOFlushCommandTest < Test::Unit::TestCase
60
63
  assert do
61
64
  not command.recursive?
62
65
  end
66
+ assert do
67
+ not command.recursive_dependent?
68
+ end
69
+ end
70
+
71
+ def test_dependent
72
+ command = reference_acquire_command(:recursive => "dependent")
73
+ assert do
74
+ command.recursive?
75
+ end
76
+ assert do
77
+ command.recursive_dependent?
78
+ end
63
79
  end
64
80
  end
65
81
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2017 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
@@ -116,4 +116,90 @@ class LoadCommandTest < Test::Unit::TestCase
116
116
  end
117
117
  end
118
118
  end
119
+
120
+ sub_test_case("#build_arrow_table") do
121
+ def setup
122
+ omit("red-arrow is needed") unless defined?(Arrow)
123
+ end
124
+
125
+ sub_test_case("Array") do
126
+ def test_without_columns_argument
127
+ command = load_command({"values" => [
128
+ ["column1", "column2"],
129
+ ["value1", "value2"],
130
+ ].to_json})
131
+ assert_equal(Arrow::Table.new({
132
+ "column1" => ["value1"],
133
+ "column2" => ["value2"],
134
+ }),
135
+ command.build_arrow_table)
136
+ end
137
+
138
+ def test_with_columns_argument
139
+ command = load_command({"columns" => ["column1", "column2"].join(", "),
140
+ "values" => [
141
+ ["value1", "value2"],
142
+ ].to_json})
143
+ assert_equal(Arrow::Table.new({
144
+ "column1" => ["value1"],
145
+ "column2" => ["value2"],
146
+ }),
147
+ command.build_arrow_table)
148
+ end
149
+ end
150
+
151
+ sub_test_case("Hash") do
152
+ def test_integer
153
+ command = load_command({"values" => [
154
+ {
155
+ "column1" => 1,
156
+ "column2" => 2,
157
+ },
158
+ {
159
+ "column1" => 10,
160
+ "column2" => 20,
161
+ },
162
+ ].to_json})
163
+ columns = {
164
+ "column1" => Arrow::Int64Array.new([1, 10]),
165
+ "column2" => Arrow::Int64Array.new([2, 20]),
166
+ }
167
+ assert_equal(Arrow::Table.new(columns),
168
+ command.build_arrow_table)
169
+ end
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
204
+ end
119
205
  end
@@ -344,6 +344,7 @@ class LogicalSelectCommandTest < Test::Unit::TestCase
344
344
 
345
345
  def slice(parameters)
346
346
  slice = Groonga::Command::LogicalSelect::Slice.new
347
+ slice.labeled_drilldowns = {}
347
348
  parameters.each do |key, value|
348
349
  slice[key] = value
349
350
  end
@@ -0,0 +1,82 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class ReferenceAcquireCommandTest < Test::Unit::TestCase
18
+ private
19
+ def reference_acquire_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::ReferenceAcquire.new(pair_arguments,
21
+ ordered_arguments)
22
+ end
23
+
24
+ class ConstructorTest < self
25
+ def test_ordered_arguments
26
+ target_name = "Users"
27
+ recursive = "no"
28
+
29
+ ordered_arguments = [
30
+ target_name,
31
+ recursive,
32
+ ]
33
+ command = reference_acquire_command({}, ordered_arguments)
34
+ assert_equal({
35
+ :target_name => target_name,
36
+ :recursive => recursive,
37
+ },
38
+ command.arguments)
39
+ end
40
+ end
41
+
42
+ class TargetNameTest < self
43
+ def test_reader
44
+ command = reference_acquire_command(:target_name => "Users")
45
+ assert_equal("Users", command.target_name)
46
+ end
47
+ end
48
+
49
+ class RecursiveTest < self
50
+ class ReaderTest < self
51
+ def test_default
52
+ command = reference_acquire_command
53
+ assert do
54
+ command.recursive?
55
+ end
56
+ assert do
57
+ not command.recursive_dependent?
58
+ end
59
+ end
60
+
61
+ def test_no
62
+ command = reference_acquire_command(:recursive => "no")
63
+ assert do
64
+ not command.recursive?
65
+ end
66
+ assert do
67
+ not command.recursive_dependent?
68
+ end
69
+ end
70
+
71
+ def test_dependent
72
+ command = reference_acquire_command(:recursive => "dependent")
73
+ assert do
74
+ command.recursive?
75
+ end
76
+ assert do
77
+ command.recursive_dependent?
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,82 @@
1
+ # Copyright (C) 2020 Sutou Kouhei <kou@clear-code.com>
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class ReferenceReleaseCommandTest < Test::Unit::TestCase
18
+ private
19
+ def reference_release_command(pair_arguments={}, ordered_arguments=[])
20
+ Groonga::Command::ReferenceRelease.new(pair_arguments,
21
+ ordered_arguments)
22
+ end
23
+
24
+ class ConstructorTest < self
25
+ def test_ordered_arguments
26
+ target_name = "Users"
27
+ recursive = "no"
28
+
29
+ ordered_arguments = [
30
+ target_name,
31
+ recursive,
32
+ ]
33
+ command = reference_release_command({}, ordered_arguments)
34
+ assert_equal({
35
+ :target_name => target_name,
36
+ :recursive => recursive,
37
+ },
38
+ command.arguments)
39
+ end
40
+ end
41
+
42
+ class TargetNameTest < self
43
+ def test_reader
44
+ command = reference_release_command(:target_name => "Users")
45
+ assert_equal("Users", command.target_name)
46
+ end
47
+ end
48
+
49
+ class RecursiveTest < self
50
+ class ReaderTest < self
51
+ def test_default
52
+ command = reference_release_command
53
+ assert do
54
+ command.recursive?
55
+ end
56
+ assert do
57
+ not command.recursive_dependent?
58
+ end
59
+ end
60
+
61
+ def test_no
62
+ command = reference_release_command(:recursive => "no")
63
+ assert do
64
+ not command.recursive?
65
+ end
66
+ assert do
67
+ not command.recursive_dependent?
68
+ end
69
+ end
70
+
71
+ def test_dependent
72
+ command = reference_release_command(:recursive => "dependent")
73
+ assert do
74
+ command.recursive?
75
+ end
76
+ assert do
77
+ command.recursive_dependent?
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -335,6 +335,7 @@ class SelectCommandTest < Test::Unit::TestCase
335
335
 
336
336
  def slice(parameters)
337
337
  slice = Groonga::Command::Select::Slice.new
338
+ slice.labeled_drilldowns = {}
338
339
  parameters.each do |key, value|
339
340
  slice[key] = value
340
341
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-02 00:00:00.000000000 Z
11
+ date: 2020-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: test-unit
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: test-unit-notify
42
+ name: packnga
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: bundler
70
+ name: red-arrow
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: packnga
84
+ name: redcarpet
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: yard
98
+ name: test-unit
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,21 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: redcarpet
112
+ name: test-unit-notify
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: yard
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -176,6 +190,8 @@ files:
176
190
  - lib/groonga/command/query-log-flags-remove.rb
177
191
  - lib/groonga/command/query-log-flags-set.rb
178
192
  - lib/groonga/command/range-filter.rb
193
+ - lib/groonga/command/reference-acquire.rb
194
+ - lib/groonga/command/reference-release.rb
179
195
  - lib/groonga/command/register.rb
180
196
  - lib/groonga/command/reindex.rb
181
197
  - lib/groonga/command/request-cancel.rb
@@ -233,6 +249,8 @@ files:
233
249
  - test/command/test-query-log-flags-remove.rb
234
250
  - test/command/test-query-log-flags-set.rb
235
251
  - test/command/test-range-filter.rb
252
+ - test/command/test-reference-acquire.rb
253
+ - test/command/test-reference-release.rb
236
254
  - test/command/test-register.rb
237
255
  - test/command/test-reindex.rb
238
256
  - test/command/test-request-cancel.rb
@@ -273,66 +291,67 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
291
  - !ruby/object:Gem::Version
274
292
  version: '0'
275
293
  requirements: []
276
- rubyforge_project:
277
- rubygems_version: 2.7.6.2
294
+ rubygems_version: 3.2.0.pre1
278
295
  signing_key:
279
296
  specification_version: 4
280
297
  summary: Groonga-command is a library that represents [Groonga](http://groonga.org/)'s
281
298
  command. You can write a program that handle Groonga's command by using groonga-command.
282
299
  test_files:
283
- - test/run-test.rb
284
- - test/command/test-range-filter.rb
300
+ - test/command/format/test-command.rb
301
+ - test/command/test-base.rb
302
+ - test/command/test-column-copy.rb
303
+ - test/command/test-column-create.rb
304
+ - test/command/test-column-list.rb
305
+ - test/command/test-column-remove.rb
285
306
  - test/command/test-column-rename.rb
286
- - test/command/test-object-exist.rb
307
+ - test/command/test-config-delete.rb
287
308
  - test/command/test-config-get.rb
288
- - test/command/test-table-create.rb
289
- - test/command/test-plugin-register.rb
290
- - test/command/test-query-log-flags-remove.rb
291
- - test/command/format/test-command.rb
292
- - test/command/test-table-rename.rb
293
- - test/command/test-truncate.rb
309
+ - test/command/test-config-set.rb
310
+ - test/command/test-delete.rb
311
+ - test/command/test-dump.rb
312
+ - test/command/test-get.rb
313
+ - test/command/test-index-column-diff.rb
314
+ - test/command/test-io-flush.rb
315
+ - test/command/test-load.rb
316
+ - test/command/test-log-level.rb
294
317
  - test/command/test-log-put.rb
295
- - test/command/test-query-log-flags-get.rb
296
- - test/command/test-query-log-flags-set.rb
318
+ - test/command/test-logical-count.rb
297
319
  - test/command/test-logical-range-filter.rb
298
- - test/command/test-column-list.rb
299
- - test/command/test-ruby-load.rb
300
- - test/command/test-query-log-flags-add.rb
301
- - test/command/test-table-copy.rb
302
- - test/command/test-config-delete.rb
303
320
  - test/command/test-logical-select.rb
304
- - test/command/test-tokenize.rb
305
- - test/command/test-table-tokenize.rb
306
- - test/command/test-request-cancel.rb
307
- - test/command/test-column-copy.rb
308
- - test/command/test-suggest.rb
309
- - test/command/test-column-remove.rb
310
- - test/command/test-object-remove.rb
311
321
  - test/command/test-logical-shard-list.rb
312
- - test/command/test-column-create.rb
313
- - test/command/test-get.rb
314
- - test/command/test-load.rb
315
- - test/command/test-reindex.rb
316
- - test/command/test-plugin-unregister.rb
317
- - test/command/test-io-flush.rb
318
322
  - test/command/test-logical-table-remove.rb
319
- - test/command/test-index-column-diff.rb
320
- - test/command/test-register.rb
323
+ - test/command/test-normalize.rb
324
+ - test/command/test-object-exist.rb
321
325
  - test/command/test-object-inspect.rb
322
- - test/command/test-delete.rb
326
+ - test/command/test-object-remove.rb
327
+ - test/command/test-plugin-register.rb
328
+ - test/command/test-plugin-unregister.rb
323
329
  - test/command/test-query-expand.rb
324
- - test/command/test-table-list.rb
325
- - test/command/test-status.rb
326
- - test/command/test-thread-limit.rb
327
- - test/command/test-config-set.rb
328
- - test/command/test-log-level.rb
329
- - test/command/test-shutdown.rb
330
+ - test/command/test-query-log-flags-add.rb
331
+ - test/command/test-query-log-flags-get.rb
332
+ - test/command/test-query-log-flags-remove.rb
333
+ - test/command/test-query-log-flags-set.rb
334
+ - test/command/test-range-filter.rb
335
+ - test/command/test-reference-acquire.rb
336
+ - test/command/test-reference-release.rb
337
+ - test/command/test-register.rb
338
+ - test/command/test-reindex.rb
339
+ - test/command/test-request-cancel.rb
330
340
  - test/command/test-ruby-eval.rb
341
+ - test/command/test-ruby-load.rb
331
342
  - test/command/test-schema.rb
332
- - test/command/test-normalize.rb
333
- - test/command/test-dump.rb
334
- - test/command/test-base.rb
335
- - test/command/test-logical-count.rb
336
- - test/command/test-table-remove.rb
337
343
  - test/command/test-select.rb
344
+ - test/command/test-shutdown.rb
345
+ - test/command/test-status.rb
346
+ - test/command/test-suggest.rb
347
+ - test/command/test-table-copy.rb
348
+ - test/command/test-table-create.rb
349
+ - test/command/test-table-list.rb
350
+ - test/command/test-table-remove.rb
351
+ - test/command/test-table-rename.rb
352
+ - test/command/test-table-tokenize.rb
353
+ - test/command/test-thread-limit.rb
354
+ - test/command/test-tokenize.rb
355
+ - test/command/test-truncate.rb
338
356
  - test/groonga-command-test-utils.rb
357
+ - test/run-test.rb