rroonga 7.0.2 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2010-2012 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2010-2018 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
@@ -190,6 +190,41 @@ class CommandSelectTest < Test::Unit::TestCase
190
190
  end
191
191
  end
192
192
  end
193
+
194
+ class TestNoSyntaxError < self
195
+ def setup_data
196
+ @paren =
197
+ @entries.add("Have paren",
198
+ "content" => "(hello)")
199
+ @no_paren =
200
+ @entries.add("Not have paren",
201
+ "content" => "hello")
202
+ end
203
+
204
+ def test_true
205
+ result = @entries.select do |record|
206
+ record[:content].match("(", :no_syntax_error => true)
207
+ end
208
+ assert_equal_select_result([@paren],
209
+ result)
210
+ end
211
+
212
+ def test_false
213
+ assert_raise(Groonga::SyntaxError) do
214
+ @entries.select do |record|
215
+ record[:content].match("(", :no_syntax_error => false)
216
+ end
217
+ end
218
+ end
219
+
220
+ def test_default
221
+ assert_raise(Groonga::SyntaxError) do
222
+ @entries.select do |record|
223
+ record[:content].match("(")
224
+ end
225
+ end
226
+ end
227
+ end
193
228
  end
194
229
 
195
230
  private
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  # Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -41,7 +41,6 @@ class ContextTest < Test::Unit::TestCase
41
41
  end
42
42
 
43
43
  def test_create_temporary_database
44
- Groonga::Logger.register(nil)
45
44
  before_files = @tmp_dir.children
46
45
  context = Groonga::Context.new
47
46
  database = context.create_database
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  # Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -30,7 +30,6 @@ class DatabaseTest < Test::Unit::TestCase
30
30
  end
31
31
 
32
32
  def test_temporary
33
- Groonga::Logger.register(nil)
34
33
  before_files = @tmp_dir.children
35
34
  database = Groonga::Database.create
36
35
  assert_nil(database.name)
@@ -377,6 +376,7 @@ class DatabaseTest < Test::Unit::TestCase
377
376
  def test_empty
378
377
  paths = [
379
378
  @database.path,
379
+ "#{@database.path}.conf",
380
380
  "#{@database.path}.001",
381
381
  "#{@database.path}.0000000",
382
382
  ]
@@ -396,6 +396,10 @@ class DatabaseTest < Test::Unit::TestCase
396
396
  @database.touch
397
397
  assert_equal(Time.now.sec, @database.last_modified.sec)
398
398
  end
399
+ end
400
+
401
+ class DirtyTest < self
402
+ setup :setup_database
399
403
 
400
404
  def test_dirty?
401
405
  assert do
@@ -407,4 +411,14 @@ class DatabaseTest < Test::Unit::TestCase
407
411
  end
408
412
  end
409
413
  end
414
+
415
+ class CorruptTest < self
416
+ setup :setup_database
417
+
418
+ def test_corrupt?
419
+ assert do
420
+ not @database.corrupt?
421
+ end
422
+ end
423
+ end
410
424
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2010-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  # Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -19,11 +19,13 @@ class LoggerTest < Test::Unit::TestCase
19
19
 
20
20
  def setup
21
21
  @default_log_path = Groonga::Logger.path
22
+ @default_log_max_level = Groonga::Logger.max_level
22
23
  @default_rotate_threshold_size = Groonga::Logger.rotate_threshold_size
23
24
  end
24
25
 
25
26
  def teardown
26
27
  Groonga::Logger.path = @default_log_path
28
+ Groonga::Logger.max_level = @default_log_max_level
27
29
  Groonga::Logger.rotate_threshold_size = @default_rotate_threshold_size
28
30
  end
29
31
 
@@ -53,6 +55,15 @@ class LoggerTest < Test::Unit::TestCase
53
55
  end
54
56
 
55
57
  sub_test_case ".log" do
58
+ setup do
59
+ GC.disable
60
+ end
61
+
62
+ teardown do
63
+ Groonga::Logger.unregister
64
+ GC.enable
65
+ end
66
+
56
67
  test "no options" do
57
68
  messages = []
58
69
  Groonga::Logger.register do |event, level, time, title, message, location|
@@ -141,6 +152,7 @@ class LoggerTest < Test::Unit::TestCase
141
152
  def test_rotate_threshold_size
142
153
  Groonga::Logger.unregister
143
154
  Groonga::Logger.path = @log_path.to_s
155
+ Groonga::Logger.reopen
144
156
  Groonga::Logger.rotate_threshold_size = 10
145
157
  assert_equal([], Dir.glob("#{@log_path}.*"))
146
158
  Groonga::Logger.log("Hello")
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2014 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2018 Kouhei Sutou <kou@clear-code.com>
2
2
  # Copyright (C) 2015 Masafumi Yokoyama <yokoyama@clear-code.com>
3
3
  #
4
4
  # This library is free software; you can redistribute it and/or
@@ -58,6 +58,12 @@ class ProcedureTest < Test::Unit::TestCase
58
58
  end
59
59
  end
60
60
 
61
+ def test_stable?
62
+ assert do
63
+ not Groonga["rand"].stable?
64
+ end
65
+ end
66
+
61
67
  private
62
68
  def assert_equal_procedure(expected_name, id, options={})
63
69
  procedure = Groonga::Context.default[id]
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2015-2018 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
@@ -19,11 +19,13 @@ class QueryLoggerTest < Test::Unit::TestCase
19
19
  def setup
20
20
  @default_log_path = Groonga::QueryLogger.path
21
21
  @default_rotate_threshold_size = Groonga::QueryLogger.rotate_threshold_size
22
+ @default_flags = Groonga::QueryLogger.flags
22
23
  end
23
24
 
24
25
  def teardown
25
26
  Groonga::QueryLogger.path = @default_log_path
26
27
  Groonga::QueryLogger.rotate_threshold_size = @default_rotate_threshold_size
28
+ Groonga::QueryLogger.flags = @default_flags
27
29
  end
28
30
 
29
31
  def test_reopen
@@ -141,9 +143,18 @@ class QueryLoggerTest < Test::Unit::TestCase
141
143
  def test_rotate_threshold_size
142
144
  Groonga::QueryLogger.unregister
143
145
  Groonga::QueryLogger.path = @query_log_path.to_s
146
+ Groonga::QueryLogger.reopen
144
147
  Groonga::QueryLogger.rotate_threshold_size = 10
145
148
  assert_equal([], Dir.glob("#{@query_log_path}.*"))
146
149
  Groonga::QueryLogger.log("command")
147
150
  assert_not_equal([], Dir.glob("#{@query_log_path}.*"))
148
151
  end
152
+
153
+ sub_test_case("flags") do
154
+ test("name") do
155
+ Groonga::QueryLogger.flags = :command
156
+ assert_equal(Groonga::QueryLogger::Flags::COMMAND,
157
+ Groonga::QueryLogger.flags)
158
+ end
159
+ end
149
160
  end
@@ -0,0 +1,193 @@
1
+ # Copyright (C) 2017-2018 Kouhei Sutou <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 version 2.1 as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ # Lesser General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
+
16
+ class TableArrowTest < Test::Unit::TestCase
17
+ include GroongaTestUtils
18
+
19
+ def setup
20
+ setup_database
21
+
22
+ omit("Apache Arrow support is required") unless context.support_arrow?
23
+ end
24
+
25
+ def assert_dump_load(type, n_records)
26
+ Groonga::Schema.define do |schema|
27
+ schema.create_table("Source") do |table|
28
+ table.__send__(type, "data")
29
+ end
30
+
31
+ schema.create_table("Destination") do |table|
32
+ end
33
+ end
34
+
35
+ source = Groonga["Source"]
36
+ destination = Groonga["Destination"]
37
+
38
+ expected = []
39
+ n_records.times do |i|
40
+ data = yield(i)
41
+ expected << {"_id" => i + 1, "data" => data}
42
+ source.add(:data => data)
43
+ end
44
+
45
+ tempfile = Tempfile.new(["table-arrow", ".arrow"])
46
+ source.dump_arrow(tempfile.path)
47
+ destination.load_arrow(tempfile.path)
48
+
49
+ assert_equal(expected,
50
+ destination.collect(&:attributes))
51
+ end
52
+
53
+ def test_uint8
54
+ n_records = 128
55
+ assert_dump_load(:uint8, n_records) do |i|
56
+ i
57
+ end
58
+ end
59
+
60
+ def test_int8
61
+ n_records = 128
62
+ assert_dump_load(:int8, n_records) do |i|
63
+ data = i
64
+ data = -data if (i % 2).zero?
65
+ data
66
+ end
67
+ end
68
+
69
+ def test_uint16
70
+ n_records = 128
71
+ assert_dump_load(:uint16, n_records) do |i|
72
+ i * 10
73
+ end
74
+ end
75
+
76
+ def test_int16
77
+ n_records = 128
78
+ assert_dump_load(:int16, n_records) do |i|
79
+ data = i * 10
80
+ data = -data if (i % 2).zero?
81
+ data
82
+ end
83
+ end
84
+
85
+ def test_uint32
86
+ n_records = 128
87
+ assert_dump_load(:uint32, n_records) do |i|
88
+ i * 100
89
+ end
90
+ end
91
+
92
+ def test_int32
93
+ n_records = 128
94
+ assert_dump_load(:int32, n_records) do |i|
95
+ data = i * 100
96
+ data = -data if (i % 2).zero?
97
+ data
98
+ end
99
+ end
100
+
101
+ def test_uint64
102
+ n_records = 128
103
+ assert_dump_load(:uint64, n_records) do |i|
104
+ i * 100
105
+ end
106
+ end
107
+
108
+ def test_int64
109
+ n_records = 128
110
+ assert_dump_load(:int64, n_records) do |i|
111
+ data = i * 100
112
+ data = -data if (i % 2).zero?
113
+ data
114
+ end
115
+ end
116
+
117
+ def test_float
118
+ n_records = 128
119
+ assert_dump_load(:float, n_records) do |i|
120
+ data = i * 1.1
121
+ data = -data if (i % 2).zero?
122
+ data
123
+ end
124
+ end
125
+
126
+ def test_time
127
+ n_records = 128
128
+ now = Time.at(Time.now.to_i)
129
+ assert_dump_load(:time, n_records) do |i|
130
+ now + i
131
+ end
132
+ end
133
+
134
+ def test_dump_columns
135
+ Groonga::Schema.define do |schema|
136
+ schema.create_table("Source") do |table|
137
+ table.int32("data1")
138
+ table.short_text("data2")
139
+ end
140
+
141
+ schema.create_table("Destination") do |table|
142
+ end
143
+ end
144
+
145
+ source = Groonga["Source"]
146
+ destination = Groonga["Destination"]
147
+
148
+ expected = []
149
+ 10.times do |i|
150
+ data1 = i * 10
151
+ data2 = i.to_s
152
+ expected << {"_id" => i + 1, "data1" => data1}
153
+ source.add(:data1 => data1, :data2 => data2)
154
+ end
155
+
156
+ tempfile = Tempfile.new(["table-arrow", ".arrow"])
157
+ source.dump_arrow(tempfile.path, :columns => source.columns[0, 1])
158
+ destination.load_arrow(tempfile.path)
159
+
160
+ assert_equal(expected,
161
+ destination.collect(&:attributes))
162
+ end
163
+
164
+ def test_dump_column_names
165
+ Groonga::Schema.define do |schema|
166
+ schema.create_table("Source") do |table|
167
+ table.int32("data1")
168
+ table.short_text("data2")
169
+ end
170
+
171
+ schema.create_table("Destination") do |table|
172
+ end
173
+ end
174
+
175
+ source = Groonga["Source"]
176
+ destination = Groonga["Destination"]
177
+
178
+ expected = []
179
+ 10.times do |i|
180
+ data1 = i * 10
181
+ data2 = i.to_s
182
+ expected << {"_id" => i + 1, "data1" => data1}
183
+ source.add(:data1 => data1, :data2 => data2)
184
+ end
185
+
186
+ tempfile = Tempfile.new(["table-arrow", ".arrow"])
187
+ source.dump_arrow(tempfile.path, :column_names => ["data1"])
188
+ destination.load_arrow(tempfile.path)
189
+
190
+ assert_equal(expected,
191
+ destination.collect(&:attributes))
192
+ end
193
+ end
@@ -27,8 +27,10 @@ module TestOffsetAndLimitSupport
27
27
  assert_equal(((200 - 1)...200).to_a, ids(:offset => -1))
28
28
  assert_equal(((200 - 32)...200).to_a, ids(:offset => -32))
29
29
  assert_equal(((200 - 100)...200).to_a, ids(:offset => -100))
30
+ assert_equal(((200 - 100)...101).to_a, ids(:offset => -199))
31
+ assert_equal(((200 - 100)...100).to_a, ids(:offset => -200))
30
32
  assert_raise(Groonga::TooSmallOffset) do
31
- ids(:offset => -101)
33
+ ids(:offset => -201)
32
34
  end
33
35
  end
34
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rroonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-04-28 00:00:00.000000000 Z
15
+ date: 2018-01-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pkg-config
@@ -118,14 +118,14 @@ dependencies:
118
118
  requirements:
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 0.6.0
121
+ version: 0.6.2
122
122
  type: :development
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - ">="
127
127
  - !ruby/object:Gem::Version
128
- version: 0.6.0
128
+ version: 0.6.2
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: bundler
131
131
  requirement: !ruby/object:Gem::Requirement
@@ -194,10 +194,10 @@ email:
194
194
  - y.hayamizu@gmail.com
195
195
  - dara@shidara.net
196
196
  executables:
197
- - groonga-index-dump
198
- - grndump
199
- - groonga-database-inspect
200
197
  - grntest-log-analyze
198
+ - groonga-database-inspect
199
+ - grndump
200
+ - groonga-index-dump
201
201
  extensions:
202
202
  - ext/groonga/extconf.rb
203
203
  extra_rdoc_files:
@@ -234,6 +234,7 @@ files:
234
234
  - ext/groonga/rb-grn-accessor.c
235
235
  - ext/groonga/rb-grn-array-cursor.c
236
236
  - ext/groonga/rb-grn-array.c
237
+ - ext/groonga/rb-grn-column-cache.c
237
238
  - ext/groonga/rb-grn-column.c
238
239
  - ext/groonga/rb-grn-config.c
239
240
  - ext/groonga/rb-grn-context.c
@@ -317,9 +318,7 @@ files:
317
318
  - lib/groonga/query-logger.rb
318
319
  - lib/groonga/record.rb
319
320
  - lib/groonga/schema.rb
320
- - lib/groonga/statistic-measurer.rb
321
321
  - lib/groonga/sub-records.rb
322
- - lib/groonga/table.rb
323
322
  - lib/rroonga.rb
324
323
  - misc/grnop2ruby.rb
325
324
  - rroonga-build.rb
@@ -328,6 +327,7 @@ files:
328
327
  - test/run-test.rb
329
328
  - test/test-accessor.rb
330
329
  - test/test-array.rb
330
+ - test/test-column-cache.rb
331
331
  - test/test-column.rb
332
332
  - test/test-command-select.rb
333
333
  - test/test-config.rb
@@ -373,8 +373,8 @@ files:
373
373
  - test/test-schema-type.rb
374
374
  - test/test-schema.rb
375
375
  - test/test-snippet.rb
376
- - test/test-statistic-measurer.rb
377
376
  - test/test-sub-records.rb
377
+ - test/test-table-arrow.rb
378
378
  - test/test-table-dumper.rb
379
379
  - test/test-table-group.rb
380
380
  - test/test-table-key-support.rb
@@ -414,78 +414,79 @@ required_rubygems_version: !ruby/object:Gem::Requirement
414
414
  version: '0'
415
415
  requirements: []
416
416
  rubyforge_project:
417
- rubygems_version: 2.5.2
417
+ rubygems_version: 2.5.2.2
418
418
  signing_key:
419
419
  specification_version: 4
420
420
  summary: Ruby bindings for Groonga that provide full text search and column store
421
421
  features.
422
422
  test_files:
423
- - test/test-schema.rb
424
- - test/test-snippet.rb
425
- - test/test-request-canceler.rb
426
- - test/test-variable.rb
427
- - test/test-geo-point.rb
428
- - test/test-plugin.rb
429
- - test/test-table-group.rb
430
- - test/test-accessor.rb
423
+ - test/test-context.rb
424
+ - test/test-normalizer.rb
431
425
  - test/test-double-array-trie.rb
432
- - test/test-pagination.rb
433
- - test/test-memory-pool.rb
434
- - test/test-request-timer.rb
435
- - test/test-column.rb
436
- - test/test-table-traverse.rb
426
+ - test/test-token-regexp.rb
427
+ - test/test-remote.rb
437
428
  - test/test-expression.rb
429
+ - test/test-schema-dumper.rb
430
+ - test/test-patricia-trie.rb
431
+ - test/test-table-group.rb
438
432
  - test/test-table-select.rb
439
433
  - test/test-encoding.rb
440
- - test/test-logger.rb
441
- - test/test-schema-create-table.rb
434
+ - test/test-windows-event-logger.rb
435
+ - test/test-plugin.rb
436
+ - test/test-table-select-normalize.rb
442
437
  - test/test-hash.rb
443
- - test/test-type.rb
444
- - test/test-table-offset-and-limit.rb
445
- - test/test-version.rb
438
+ - test/test-gqtp.rb
439
+ - test/test-table-dumper.rb
446
440
  - test/test-data-column.rb
447
- - test/test-lock-timeout.rb
441
+ - test/test-pagination.rb
442
+ - test/test-column.rb
443
+ - test/test-table-traverse.rb
444
+ - test/test-default-cache.rb
445
+ - test/test-type.rb
446
+ - test/test-package-label.rb
447
+ - test/groonga-test-utils.rb
448
+ - test/test-thread.rb
449
+ - test/test-procedure.rb
450
+ - test/test-query-logger.rb
448
451
  - test/test-index-column.rb
449
- - test/test-table-key-support.rb
450
452
  - test/test-vector-column.rb
453
+ - test/test-fix-size-column.rb
451
454
  - test/test-error-message.rb
452
- - test/test-normalizer.rb
453
- - test/test-table-select-weight.rb
454
- - test/test-schema-type.rb
455
- - test/test-sub-records.rb
456
- - test/test-procedure.rb
457
- - test/test-config.rb
458
- - test/test-context.rb
459
- - test/test-gqtp.rb
460
- - test/test-remote.rb
455
+ - test/test-operator.rb
461
456
  - test/test-database-dumper.rb
462
- - test/test-name.rb
463
- - test/test-database-inspector.rb
464
- - test/test-id.rb
465
- - test/test-patricia-trie.rb
466
457
  - test/run-test.rb
467
- - test/test-fix-size-column.rb
468
- - test/test-statistic-measurer.rb
469
- - test/test-array.rb
458
+ - test/test-column-cache.rb
459
+ - test/test-index-cursor.rb
460
+ - test/test-schema-type.rb
461
+ - test/test-database.rb
462
+ - test/test-id.rb
463
+ - test/test-request-canceler.rb
464
+ - test/test-logger.rb
470
465
  - test/test-table.rb
471
- - test/groonga-test-utils.rb
472
466
  - test/test-record.rb
473
- - test/test-exception.rb
474
- - test/test-table-select-normalize.rb
475
- - test/test-thread.rb
476
- - test/test-schema-dumper.rb
477
- - test/test-token-regexp.rb
478
- - test/test-table-dumper.rb
479
- - test/test-database.rb
480
- - test/test-query-logger.rb
481
- - test/test-package-label.rb
482
- - test/test-variable-size-column.rb
483
- - test/test-default-cache.rb
467
+ - test/test-version.rb
484
468
  - test/test-table-select-mecab.rb
485
- - test/test-windows-event-logger.rb
469
+ - test/test-lock-timeout.rb
470
+ - test/test-table-select-weight.rb
471
+ - test/test-geo-point.rb
472
+ - test/test-array.rb
473
+ - test/test-request-timer.rb
474
+ - test/test-sub-records.rb
475
+ - test/test-schema-create-table.rb
476
+ - test/test-name.rb
477
+ - test/test-schema.rb
478
+ - test/test-command-select.rb
486
479
  - test/test-expression-builder.rb
487
- - test/test-operator.rb
488
- - test/test-flushable.rb
489
480
  - test/test-convert.rb
490
- - test/test-index-cursor.rb
491
- - test/test-command-select.rb
481
+ - test/test-memory-pool.rb
482
+ - test/test-flushable.rb
483
+ - test/test-table-offset-and-limit.rb
484
+ - test/test-exception.rb
485
+ - test/test-variable-size-column.rb
486
+ - test/test-config.rb
487
+ - test/test-table-key-support.rb
488
+ - test/test-table-arrow.rb
489
+ - test/test-database-inspector.rb
490
+ - test/test-variable.rb
491
+ - test/test-snippet.rb
492
+ - test/test-accessor.rb