groonga-query-log 1.4.3 → 1.4.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7240ad397522c036f76e50dc18eedc0f78e46f30195ba5be597ff815e2ac0e60
4
- data.tar.gz: 7a1f61f1aae8f991880088b0e0ef342f5c2525283ccf67405eb3cc41fae16226
3
+ metadata.gz: faeaa6fd86742d02ee7dd26056139a4cc4d267d10e5d18ae70bfb343ab946439
4
+ data.tar.gz: 4288f0e864a772a278d01bfd0d818d8d7f342234c883e2945025e4a8c881935f
5
5
  SHA512:
6
- metadata.gz: 6fea044a3f892b6ac10b0ebc6166461378056503208678b15891cd0e4cf0debcf37e6f07e4318c7e07f213c6078dc7bf35e538dbbc4ab7354a39d28cae80947b
7
- data.tar.gz: f884e0485c054211b6384ae85ea5a8724b31a2902f02034970b018ba104eaa0b118c12f1f1aae871dac251a4109b3d79a582fe5e7f6057cf41d80f365c0c73ff
6
+ metadata.gz: de6b0181aa230461a7cfc90aa611587d5458aef929c8c6b85dfacb176f9052ac3ae62525ae86797338f629e330998c60712b6e7f604765cfaddeb2a0c321c648
7
+ data.tar.gz: 6cdb79c3619951d64ede9dabbce9c136a19bc4b6e7bc23ecfe07c92696be633217478ee7e7dac2c3fc9fd99ab496f6001c085dc956921508fe49a98a63fc6ac3
@@ -1,5 +1,20 @@
1
1
  # News
2
2
 
3
+ ## 1.4.4: 2019-08-05
4
+
5
+ ### Improvements
6
+
7
+ * `groonga-query-log-run-regression-test`:
8
+
9
+ * Added support for rewriting `"&& !" operator`.
10
+ Specify --rewrite-and-not-operator option to enable it.
11
+
12
+ ### Fixes
13
+
14
+ * `rewrite-filter`:
15
+
16
+ * Fix a wrong rewrite value.
17
+
3
18
  ## 1.4.3: 2019-05-22
4
19
 
5
20
  ### Fixes
@@ -55,6 +55,7 @@ module GroongaQueryLog
55
55
  @rewrite_nullable_reference_number = false
56
56
  @nullable_reference_number_accessors = []
57
57
  @rewrite_not_or_regular_expression = false
58
+ @rewrite_and_not_operator = false
58
59
 
59
60
  @care_order = true
60
61
  @ignored_drilldown_keys = []
@@ -220,6 +221,14 @@ module GroongaQueryLog
220
221
  "(#{@rewrite_not_or_regular_expression})") do |boolean|
221
222
  @rewrite_not_or_regular_expression = boolean
222
223
  end
224
+ parser.on("--[no-]rewrite-and-not-operator",
225
+ "Rewrite '(column1 @ \"keyword1\") && !(column2 @ " +
226
+ "\"keyword2\")' " +
227
+ "with '(column1 @ \"keyword1\") &! (column2 @ " +
228
+ "\"keyword2\")'",
229
+ "(#{@rewrite_and_not_operator})") do |boolean|
230
+ @rewrite_and_not_operator = boolean
231
+ end
223
232
 
224
233
  parser.separator("")
225
234
  parser.separator("Comparisons:")
@@ -329,6 +338,8 @@ module GroongaQueryLog
329
338
  @nullable_reference_number_accessors,
330
339
  :rewrite_not_or_regular_expression =>
331
340
  @rewrite_not_or_regular_expression,
341
+ :rewite_and_not_operator =>
342
+ @rewrite_and_not_operator,
332
343
  :target_command_names => @target_command_names,
333
344
  :read_timeout => @read_timeout,
334
345
  }
@@ -627,6 +638,9 @@ module GroongaQueryLog
627
638
  if @options[:rewrite_not_or_regular_expression]
628
639
  command_line << "--rewrite-not-or-regular-expression"
629
640
  end
641
+ if @options[:rewrite_and_not_operator]
642
+ command_line << "--rewrite-and-not-operator"
643
+ end
630
644
  if @options[:target_command_names]
631
645
  command_line << "--target-command-names"
632
646
  command_line << @options[:target_command_names].join(",")
@@ -239,6 +239,15 @@ module GroongaQueryLog
239
239
  @options.rewrite_not_or_regular_expression = boolean
240
240
  end
241
241
 
242
+ parser.on("--[no-]rewrite-and-not-operator",
243
+ "Rewrite '(column1 @ \"keyword1\") && !(column2 @ " +
244
+ "\"keyword2\")' " +
245
+ "with '(column1 @ \"keyword1\") &! (column2 @ " +
246
+ "\"keyword2\")'",
247
+ "(#{@options.rewrite_and_not_operator?})") do |boolean|
248
+ @options.rewrite_and_not_operator = boolean
249
+ end
250
+
242
251
  parser.on("--nullable-reference-number-accessor=ACCESSOR",
243
252
  "Mark ACCESSOR as rewrite nullable reference number targets",
244
253
  "You can specify multiple accessors by",
@@ -1,4 +1,5 @@
1
1
  # Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
2
+ # Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
2
3
  #
3
4
  # This library is free software; you can redistribute it and/or
4
5
  # modify it under the terms of the GNU Lesser General Public
@@ -38,6 +39,9 @@ module GroongaQueryLog
38
39
  if @options[:rewrite_not_or_regular_expression]
39
40
  rewritten = rewrite_not_or_regular_expression(rewritten)
40
41
  end
42
+ if @options[:rewrite_and_not_operator]
43
+ rewritten = rewrite_and_not_operator(rewritten)
44
+ end
41
45
  rewritten
42
46
  end
43
47
 
@@ -74,7 +78,7 @@ module GroongaQueryLog
74
78
  accessor = $1
75
79
  if @nullable_reference_number_accessors.include?(accessor)
76
80
  sub_accessor = accessor.split(".")[0..-2].join(".")
77
- "(#{sub_accessor}._key == null ? 0 : #{accessor})"
81
+ "(#{sub_accessor}._key == \"\" ? 0 : #{accessor})"
78
82
  else
79
83
  matched
80
84
  end
@@ -100,5 +104,9 @@ module GroongaQueryLog
100
104
  end
101
105
  end
102
106
  end
107
+
108
+ def rewrite_and_not_operator(filter)
109
+ filter.gsub(/&& *!/, "&!")
110
+ end
103
111
  end
104
112
  end
@@ -241,6 +241,7 @@ module GroongaQueryLog
241
241
  attr_writer :rewrite_nullable_reference_number
242
242
  attr_accessor :nullable_reference_number_accessors
243
243
  attr_writer :rewrite_not_or_regular_expression
244
+ attr_writer :rewrite_and_not_operator
244
245
  def initialize
245
246
  @groonga1 = GroongaOptions.new
246
247
  @groonga2 = GroongaOptions.new
@@ -270,6 +271,7 @@ module GroongaQueryLog
270
271
  @rewrite_nullable_reference_number = false
271
272
  @nullable_reference_number_accessors = []
272
273
  @rewrite_not_or_regular_expression = false
274
+ @rewrite_and_not_operator = false
273
275
  end
274
276
 
275
277
  def request_queue_size
@@ -304,6 +306,10 @@ module GroongaQueryLog
304
306
  @rewrite_not_or_regular_expression
305
307
  end
306
308
 
309
+ def rewrite_and_not_operator?
310
+ @rewrite_and_not_operator
311
+ end
312
+
307
313
  def target_command_name?(name)
308
314
  return false if name.nil?
309
315
 
@@ -333,7 +339,8 @@ module GroongaQueryLog
333
339
  rewrite_vector_equal? or
334
340
  rewrite_vector_not_equal_empty_string? or
335
341
  rewrite_nullable_reference_number? or
336
- rewrite_not_or_regular_expression?
342
+ rewrite_not_or_regular_expression? or
343
+ rewrite_and_not_operator?
337
344
  end
338
345
 
339
346
  def to_filter_rewriter_options
@@ -348,6 +355,8 @@ module GroongaQueryLog
348
355
  nullable_reference_number_accessors,
349
356
  :rewrite_not_or_regular_expression =>
350
357
  rewrite_not_or_regular_expression?,
358
+ :rewrite_and_not_operator =>
359
+ rewrite_and_not_operator?,
351
360
  }
352
361
  end
353
362
  end
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module GroongaQueryLog
18
- VERSION = "1.4.3"
18
+ VERSION = "1.4.4"
19
19
  end
@@ -1,4 +1,5 @@
1
1
  # Copyright (C) 2018 Kouhei Sutou <kou@clear-code.com>
2
+ # Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
2
3
  #
3
4
  # This library is free software; you can redistribute it and/or
4
5
  # modify it under the terms of the GNU Lesser General Public
@@ -99,13 +100,13 @@ class FilterRewriterTest < Test::Unit::TestCase
99
100
  end
100
101
 
101
102
  def test_parenthesis
102
- assert_equal("(((reference._key == null ? 0 : reference.number)) < 1000)",
103
+ assert_equal("(((reference._key == \"\" ? 0 : reference.number)) < 1000)",
103
104
  rewrite("((reference.number) < 1000)",
104
105
  ["reference.number"]))
105
106
  end
106
107
 
107
108
  def test_under_score
108
- assert_equal("(ref_column._key == null ? 0 : ref_column.number) < 1000",
109
+ assert_equal("(ref_column._key == \"\" ? 0 : ref_column.number) < 1000",
109
110
  rewrite("ref_column.number < 1000",
110
111
  ["ref_column.number"]))
111
112
  end
@@ -137,4 +138,21 @@ class FilterRewriterTest < Test::Unit::TestCase
137
138
  rewrite("column1 @ \"value1\" && column2 @~ \"^(?!.*value2 | value3 | value4).+$\""))
138
139
  end
139
140
  end
141
+
142
+ class AndNotOperatorTest < self
143
+ def rewrite(filter, enabled = true)
144
+ super(filter,
145
+ :rewrite_and_not_operator => enabled)
146
+ end
147
+
148
+ def test_one
149
+ assert_equal("(column1 @ \"value1\") &! (column2 @ \"value2\")",
150
+ rewrite("(column1 @ \"value1\") && ! (column2 @ \"value2\")"))
151
+ end
152
+
153
+ def test_multiple
154
+ assert_equal("(column1 @ \"value1\") &! (column2 @ \"value2\") &! (column2 @ \"value3\")",
155
+ rewrite("(column1 @ \"value1\") && ! (column2 @ \"value2\") && ! (column2 @ \"value3\")"))
156
+ end
157
+ end
140
158
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-query-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
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-05-22 00:00:00.000000000 Z
11
+ date: 2019-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-command-parser
@@ -154,17 +154,17 @@ description: ''
154
154
  email:
155
155
  - kou@clear-code.com
156
156
  executables:
157
- - groonga-query-log-detect-memory-leak
158
- - groonga-query-log-analyze
157
+ - groonga-query-log-format-regression-test-logs
158
+ - groonga-query-log-run-regression-test
159
159
  - groonga-query-log-check-crash
160
160
  - groonga-query-log-replay
161
- - groonga-query-log-extract
162
- - groonga-query-log-show-running-queries
163
161
  - groonga-query-log-check-command-version-compatibility
164
- - groonga-query-log-run-regression-test
165
162
  - groonga-query-log-verify-server
163
+ - groonga-query-log-show-running-queries
164
+ - groonga-query-log-analyze
165
+ - groonga-query-log-extract
166
+ - groonga-query-log-detect-memory-leak
166
167
  - groonga-query-log-analyze-load
167
- - groonga-query-log-format-regression-test-logs
168
168
  extensions: []
169
169
  extra_rdoc_files: []
170
170
  files:
@@ -289,36 +289,36 @@ summary: Groonga-query-log is a collection of library and tools to process [Groo
289
289
  as a library. You can analyze your Groonga's queries and test with your Groonga's
290
290
  query log by using groonga-query-log as a tool.
291
291
  test_files:
292
- - test/run-test.rb
293
- - test/fixtures/n_entries.expected
294
- - test/fixtures/target-tables.expected
295
- - test/fixtures/no-report-summary.expected
292
+ - test/fixtures/reporter/console.expected
293
+ - test/fixtures/reporter/html.expected
294
+ - test/fixtures/reporter/json-stream.expected
295
+ - test/fixtures/reporter/json.expected
296
+ - test/fixtures/order/start-time.expected
296
297
  - test/fixtures/order/-start-time.expected
297
298
  - test/fixtures/order/-elapsed.expected
298
- - test/fixtures/order/start-time.expected
299
299
  - test/fixtures/order/elapsed.expected
300
- - test/fixtures/regression-test-logs/url-format.log
301
- - test/fixtures/regression-test-logs/command-format.log
302
- - test/fixtures/regression-test-logs/error.log
303
- - test/fixtures/multi.expected
304
- - test/fixtures/query.log
305
- - test/fixtures/other-query.log
306
- - test/fixtures/reporter/json-stream.expected
307
- - test/fixtures/reporter/console.expected
308
- - test/fixtures/reporter/json.expected
309
- - test/fixtures/reporter/html.expected
310
- - test/fixtures/run-regression-test/schema/schema.grn
300
+ - test/fixtures/no-report-summary.expected
301
+ - test/fixtures/target-commands.expected
311
302
  - test/fixtures/run-regression-test/data/data.grn
312
- - test/fixtures/run-regression-test/indexes/indexes.grn
313
303
  - test/fixtures/run-regression-test/query-logs/query.log
314
- - test/fixtures/target-commands.expected
315
- - test/test-parser.rb
316
- - test/helper.rb
317
- - test/test-replayer.rb
318
- - test/test-response-comparer.rb
304
+ - test/fixtures/run-regression-test/indexes/indexes.grn
305
+ - test/fixtures/run-regression-test/schema/schema.grn
306
+ - test/fixtures/other-query.log
307
+ - test/fixtures/query.log
308
+ - test/fixtures/target-tables.expected
309
+ - test/fixtures/n_entries.expected
310
+ - test/fixtures/multi.expected
311
+ - test/fixtures/regression-test-logs/command-format.log
312
+ - test/fixtures/regression-test-logs/url-format.log
313
+ - test/fixtures/regression-test-logs/error.log
319
314
  - test/command/test-run-regression-test.rb
320
315
  - test/command/test-format-regression-test-logs.rb
321
316
  - test/command/test-analyzer.rb
322
317
  - test/command/test-extract.rb
318
+ - test/test-response-comparer.rb
319
+ - test/test-replayer.rb
323
320
  - test/test-incompatibility-detector.rb
324
321
  - test/test-filter-rewriter.rb
322
+ - test/test-parser.rb
323
+ - test/helper.rb
324
+ - test/run-test.rb