norikra 1.0.1-java → 1.0.2-java

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
  SHA1:
3
- metadata.gz: 6647d0732102c2599115e2bfb9c455de92995c8b
4
- data.tar.gz: a7880bbb4b929fc44b4b22e83604153e024c3e19
3
+ metadata.gz: 484ecce14e3035444d000c902c7172bc66aa0f21
4
+ data.tar.gz: f964401ccd096def82fc7d2b0e980fcb634d05c9
5
5
  SHA512:
6
- metadata.gz: f42c58bf9d933ce6c3feb58c221a7e3144455b91c00b53bc41b75937aea889d85a82ee39a452c3897f8c6b3067c777bedf920396ba1c5a6436f55ae7c83e0ff0
7
- data.tar.gz: 55e6450e6c30993f92c2dca499cfcc98d1009d1f520e39c8506b37d6b1d5e760954e1bf39b528295367863cc0bdad33d50495592084db3541b39a7d3cadbcf34
6
+ metadata.gz: 968258b7e2456018e8c557d22802514a198dad763529a40f73edf94c39614ebac3879d9469435899bd353a44b2704615ef47b30516d1609e36136a37f148787e
7
+ data.tar.gz: 427efc15c89693c0750147176be8105e7d9bec03a7537fada0e8b612f1e1540274b9ea4d011585a2846e4ebcdfbe61addada81d102070ccf7b524f5f648736ad
@@ -0,0 +1,64 @@
1
+ # Changes
2
+
3
+ Changes of norikra.
4
+
5
+ ## v1
6
+ * v1.0.2:
7
+ * Fix bug:
8
+ * to handle encoding of input strings
9
+ * to set encoding of nested output values
10
+ * to handle wrong query groups in error which previously registered
11
+ * v1.0.1:
12
+ * String encoding in norikra is fixed as UTF-8
13
+ * v1.0.0:
14
+ * Update esper version (4.9.0 -> 5.0.0)
15
+ * Support Group By ROLLUP, Grouping Sets and CUBE
16
+ * Support Group By clause in subqueries
17
+ * Support subqueries that select multiple columns to provide input to enumeration methods
18
+ * Support Having clause to have subquery
19
+ * Add loopback query group to connect query output into targets directly
20
+ * RPC:
21
+ * Add JSON RPC API (/api on port 26578)
22
+ * Add API to fetch norikra server logs
23
+ * Add `--stats-secondary` option to store versioned stats files
24
+ * Fix bug:
25
+ * to return `[]` for NULL query output (fixed to `nil`)
26
+ * to handle container value for simple value field (exception -> NULL)
27
+
28
+ ## v0.1
29
+
30
+ * v0.1.7:
31
+ * Fix `Pattern` support bug
32
+ * v0.1.6:
33
+ * Fix bug: Wrong escape for java instance method calls
34
+ * v0.1.5:
35
+ * Add RPC port monitoring handler (GET /)
36
+ * Add `Pattern` support
37
+ * Changes for GC/JVM
38
+ * Server starts with default(recommended) JVM options for GC configurations
39
+ * Add option not to use default JVM options
40
+ * Add option to configure JVM to print GC logs
41
+ * Stats file changes
42
+ * Changed to use SIGUSR2 (SIGUSR1 is used by JVM on linux platform)
43
+ * Changed no to contain server process configurations (ports, threads, logs ...)
44
+ * WebUI improvements
45
+ * Add button to close target on WebUI
46
+ * Add link to download stats file
47
+ * Fix bugs
48
+ * Fieldname handlings about names with non-alphabetic chars
49
+ * Query parser bug for some built-in functions (ex: `rate(10)`)
50
+ * Write stats file in more safe way
51
+ * WebUI: Incorrect memory bar
52
+ * v0.1.4:
53
+ * Stat dump option on runtime per specified intervals (`--dump-stat-interval`)
54
+ * Stat dump on demand by SIGUSR1
55
+ * `norikra-client event see` command (and API call) to get query results, but not remove it
56
+ * Last modified time for each target on WebUI
57
+ * v0.1.3:
58
+ * Fix critical bug about query de-registration
59
+ * v0.1.2:
60
+ * Fix CLI start command to detect jruby path collectly (behind rbenv/rvm and others)
61
+ * v0.1.1:
62
+ * Fix types more explicitly for users ('int/long' -> 'integer', 'float/double' -> 'float')
63
+ * v0.1.0:
64
+ * First release for production
data/README.md CHANGED
@@ -70,55 +70,17 @@ See: http://norikra.github.io/
70
70
 
71
71
  ## Changes
72
72
 
73
- * v1.0.0:
74
- * Update esper version (4.9.0 -> 5.0.0)
75
- * Support Group By ROLLUP, Grouping Sets and CUBE
76
- * Support Group By clause in subqueries
77
- * Support subqueries that select multiple columns to provide input to enumeration methods
78
- * Support Having clause to have subquery
79
- * Add loopback query group to connect query output into targets directly
80
- * RPC:
81
- * Add JSON RPC API (/api on port 26578)
82
- * Add API to fetch norikra server logs
83
- * Add `--stats-secondary` option to store versioned stats files
84
- * Fix bug:
85
- * to return `[]` for NULL query output (fixed to `nil`)
86
- * to handle container value for simple value field (exception -> NULL)
87
- * v0.1.7:
88
- * Fix `Pattern` support bug
89
- * v0.1.6:
90
- * Fix bug: Wrong escape for java instance method calls
91
- * v0.1.5:
92
- * Add RPC port monitoring handler (GET /)
93
- * Add `Pattern` support
94
- * Changes for GC/JVM
95
- * Server starts with default(recommended) JVM options for GC configurations
96
- * Add option not to use default JVM options
97
- * Add option to configure JVM to print GC logs
98
- * Stats file changes
99
- * Changed to use SIGUSR2 (SIGUSR1 is used by JVM on linux platform)
100
- * Changed no to contain server process configurations (ports, threads, logs ...)
101
- * WebUI improvements
102
- * Add button to close target on WebUI
103
- * Add link to download stats file
104
- * Fix bugs
105
- * Fieldname handlings about names with non-alphabetic chars
106
- * Query parser bug for some built-in functions (ex: `rate(10)`)
107
- * Write stats file in more safe way
108
- * WebUI: Incorrect memory bar
109
- * v0.1.4:
110
- * Stat dump option on runtime per specified intervals (`--dump-stat-interval`)
111
- * Stat dump on demand by SIGUSR1
112
- * `norikra-client event see` command (and API call) to get query results, but not remove it
113
- * Last modified time for each target on WebUI
114
- * v0.1.3:
115
- * Fix critical bug about query de-registration
116
- * v0.1.2:
117
- * Fix CLI start command to detect jruby path collectly (behind rbenv/rvm and others)
118
- * v0.1.1:
119
- * Fix types more explicitly for users ('int/long' -> 'integer', 'float/double' -> 'float')
120
- * v0.1.0:
121
- * First release for production
73
+ * v1.0
74
+ * Esper-5.0 bundle
75
+ * Pattern support
76
+ * Nested object support
77
+ * Built-in default JVM options
78
+ * JSON APIs
79
+ * Many more features
80
+ * v0.1
81
+ * First release for production usage
82
+
83
+ See Changes.md for details.
122
84
 
123
85
  ## Copyright
124
86
 
@@ -249,25 +249,22 @@ module Norikra
249
249
  @events_statistics = events_statistics
250
250
  end
251
251
 
252
- def type_convert(event)
253
- event = (event.respond_to?(:getUnderlying) ? event.getUnderlying : event).to_hash
254
- converted = {}
255
- event.keys.each do |key|
256
- trace "event content key:#{key}, value:#{event[key]}, value class:#{event[key].class}"
257
- unescaped_key = Norikra::Field.unescape_name(key)
258
- if event[key].nil?
259
- converted[unescaped_key] = nil
260
- elsif event[key].respond_to?(:to_hash)
261
- converted[unescaped_key] = event[key].to_hash
262
- elsif event[key].respond_to?(:to_a)
263
- converted[unescaped_key] = event[key].to_a
264
- elsif event[key].respond_to?(:force_encoding)
265
- converted[unescaped_key] = event[key].force_encoding('UTF-8')
266
- else
267
- converted[unescaped_key] = event[key]
268
- end
252
+ def type_convert(value)
253
+ if value.respond_to?(:getUnderlying)
254
+ value = value.getUnderlying
255
+ end
256
+
257
+ trace "converting", :value => value
258
+
259
+ if value.respond_to?(:to_a)
260
+ value.to_a.map{|v| type_convert(v) }
261
+ elsif value.respond_to?(:to_hash)
262
+ Hash[ value.to_hash.map{|k,v| [ Norikra::Field.unescape_name(k), type_convert(v)] } ]
263
+ elsif value.respond_to?(:force_encoding)
264
+ value.force_encoding('UTF-8')
265
+ else
266
+ value
269
267
  end
270
- converted
271
268
  end
272
269
 
273
270
  def update(new_events, old_events)
@@ -508,6 +505,7 @@ module Norikra
508
505
  epl = administrator.getStatement(query.statement_name)
509
506
  return unless epl
510
507
 
508
+ @output_pool.remove(query.name, query.group)
511
509
  epl.stop unless epl.isStopped
512
510
  epl.destroy unless epl.isDestroyed
513
511
  end
@@ -178,7 +178,7 @@ module Norikra
178
178
  return nil if value.nil? || value.is_a?(Hash) || value.is_a?(Array)
179
179
 
180
180
  case @type
181
- when 'string' then value.to_s
181
+ when 'string' then value.to_s.force_encoding('UTF-8')
182
182
  when 'boolean'
183
183
  if value.is_a?(TrueClass) || value.is_a?(FalseClass)
184
184
  value
@@ -14,6 +14,18 @@ module Norikra
14
14
  @pool.keys
15
15
  end
16
16
 
17
+ def remove(query_name, query_group)
18
+ @mutex.synchronize do
19
+ group = @groups[query_group]
20
+ if group
21
+ group.delete(query_name)
22
+ end
23
+ @groups.delete(query_name)
24
+ @pool.delete(query_name)
25
+ end
26
+ nil
27
+ end
28
+
17
29
  def push(query_name, query_group, events) # events must be [time(int), event_record]
18
30
  # called with blank events for window leavings (and/or other situations)
19
31
  return if events.size < 1
@@ -1,3 +1,3 @@
1
1
  module Norikra
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -150,6 +150,13 @@ describe Norikra::Field do
150
150
  expect(f.format({})).to be_nil
151
151
  expect(f.format([])).to be_nil
152
152
  end
153
+
154
+ it 'changes encoding of string values as UTF-8 forcely' do
155
+ f = Norikra::Field.new('x', 'string')
156
+ val = '乗鞍'
157
+ val.force_encoding('ASCII-8BIT')
158
+ expect(f.format(val).encoding.to_s).to eql("UTF-8")
159
+ end
153
160
  end
154
161
  end
155
162
 
@@ -45,6 +45,25 @@ describe Norikra::OutputPool do
45
45
  end
46
46
 
47
47
  context 'with events in pool' do
48
+ describe '#remove' do
49
+ it 'remove query from pool, and from group-query mapping' do
50
+ pool = Norikra::OutputPool.new
51
+ t = Time.now.to_i
52
+ pool.push('TestTable query1', 'group1', [[t,{'count'=>1}],[t,{'count'=>2}],[t,{'count'=>3}]])
53
+ pool.push('TestTable query2', 'group2', [[t,{'count'=>4}]])
54
+
55
+ pool.pop('TestTable query1')
56
+ pool.remove('TestTable query1', 'group1')
57
+
58
+ pool.push('TestTable query1', 'group3', [[t,{'count'=>1}],[t,{'count'=>2}],[t,{'count'=>3}]])
59
+
60
+ r1 = pool.sweep('group1') #=> {}
61
+ r3 = pool.sweep('group3')
62
+ expect(r1['TestTable query1']).to be_nil
63
+ expect(r3['TestTable query1'].size).to eql(3)
64
+ end
65
+ end
66
+
48
67
  describe '#pop' do
49
68
  it 'returns all events of specified query in pool' do
50
69
  pool = Norikra::OutputPool.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norikra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - TAGOMORI Satoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-21 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mizuno
@@ -204,6 +204,7 @@ files:
204
204
  - .gitignore
205
205
  - .ruby-version
206
206
  - .travis.yml
207
+ - Changes.md
207
208
  - Gemfile
208
209
  - LICENSE
209
210
  - README.md