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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45d8a9c657e19d5c57d2ac76e894b1c5507fbbe2
4
- data.tar.gz: 7189cc2394882efacc17854af55ad164d15dc397
3
+ metadata.gz: f507114d8202daadc401f6de1d18054035a7c557
4
+ data.tar.gz: 4cab496f8fb9940b12aca0eab8735ef00344e124
5
5
  SHA512:
6
- metadata.gz: ea3e8af5b941d4b24686d25674bc36e6777f37995b422590466e6b6d7edaa73f744fc2f281e02466db54b05fa5a6cd163b6e0a0b16fb3ae8ea54b4387217130e
7
- data.tar.gz: caa7454fd12f4c5724e6488bbe93dfb567f270e840b4e5772be0382051a4f4016bd780c47190c043008aa4f4732ee10ef41e260086f87dc3c4e1897e67124db5
6
+ metadata.gz: 7a33cace50cfb7ebf35723738474b0026f415228366df9385b63abc645f0c046017c174aa633fd2bf1953f358ec4c31be6d3577741c7bb83c4286abeb0002d91
7
+ data.tar.gz: a3f0251f7359e1ada162f7cf5378ecdd458fae05eb3bff8dde27e1d9f26e0cc68210de99e01ce25313555cbec1c58050fcb4476bcb76a73a8013a7d50a31546a
@@ -11,7 +11,7 @@ module Streamingly
11
11
  end
12
12
 
13
13
  # TODO: remove .split from https://github.com/swipely/streamingly/blob/master/lib/streamingly/reducer.rb#L28
14
- def split(char="\t")
14
+ def split(char="\t", limit=1)
15
15
  [key, value]
16
16
  end
17
17
  end
@@ -25,7 +25,10 @@ module Streamingly
25
25
  end
26
26
 
27
27
  def reduce(line)
28
- key, value = line.split("\t")
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
@@ -1,3 +1,3 @@
1
1
  module Streamingly
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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.5
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-02-24 00:00:00.000000000 Z
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.14
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