streamingly 0.0.5 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/streamingly/kv.rb +1 -1
- data/lib/streamingly/reducer.rb +4 -1
- data/lib/streamingly/version.rb +1 -1
- data/spec/streamingly/reducer_spec.rb +23 -0
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f507114d8202daadc401f6de1d18054035a7c557
|
4
|
+
data.tar.gz: 4cab496f8fb9940b12aca0eab8735ef00344e124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a33cace50cfb7ebf35723738474b0026f415228366df9385b63abc645f0c046017c174aa633fd2bf1953f358ec4c31be6d3577741c7bb83c4286abeb0002d91
|
7
|
+
data.tar.gz: a3f0251f7359e1ada162f7cf5378ecdd458fae05eb3bff8dde27e1d9f26e0cc68210de99e01ce25313555cbec1c58050fcb4476bcb76a73a8013a7d50a31546a
|
data/lib/streamingly/kv.rb
CHANGED
data/lib/streamingly/reducer.rb
CHANGED
@@ -25,7 +25,10 @@ module Streamingly
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def reduce(line)
|
28
|
-
|
28
|
+
# Streaming Hadoop only treats the first tab as the delimiter between
|
29
|
+
# the key and value. Additional tabs are grouped into the value:
|
30
|
+
# http://hadoop.apache.org/docs/r0.18.3/streaming.html#How+Does+Streaming+Work
|
31
|
+
key, value = line.split("\t", 2)
|
29
32
|
|
30
33
|
if @prev_key != key
|
31
34
|
results = flush
|
data/lib/streamingly/version.rb
CHANGED
@@ -62,6 +62,29 @@ describe Streamingly::Reducer do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
context "given a record with multiple tabs" do
|
66
|
+
let(:key) { 'key1' }
|
67
|
+
let(:value) { "asdf\tqwerty" }
|
68
|
+
|
69
|
+
let(:records) {
|
70
|
+
[
|
71
|
+
[key, value].join("\t"),
|
72
|
+
]
|
73
|
+
}
|
74
|
+
|
75
|
+
let(:accumulator) { double(:accumulator, :flush => []) }
|
76
|
+
|
77
|
+
before do
|
78
|
+
accumulator_class.stub(:new).with(key) { accumulator }
|
79
|
+
end
|
80
|
+
|
81
|
+
it "treats only the first tab as the key/value delimiter and leaves the value untouched" do
|
82
|
+
accumulator.should_receive(:apply_value).with(value)
|
83
|
+
|
84
|
+
subject.reduce_over(records)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
65
88
|
context "when supplied with accumulator options" do
|
66
89
|
let(:accumulator_options) { { foo: 'bar' } }
|
67
90
|
subject { described_class.new(accumulator_class, accumulator_options) }
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamingly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Gillooly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.11'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.11'
|
55
55
|
description: Helpful classes for writing streaming Hadoop jobs in Ruby
|
@@ -59,8 +59,8 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
64
|
- Gemfile
|
65
65
|
- LICENSE.txt
|
66
66
|
- README.md
|
@@ -85,17 +85,17 @@ require_paths:
|
|
85
85
|
- lib
|
86
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.0
|
98
|
+
rubygems_version: 2.2.0
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Helpful classes for writing streaming Hadoop jobs in Ruby
|