Changeset 19783
- Timestamp:
- 09/24/08 00:37:05 (5 years ago)
- Location:
- lang/perl/App-Hachero/trunk
- Files:
-
- 4 modified
-
lib/App/Hachero/Plugin/Parse/HadoopReduce.pm (modified) (2 diffs)
-
lib/App/Hachero/Result.pm (modified) (1 diff)
-
t/plugin/output_line/01_hadoop_map.t (modified) (2 diffs)
-
t/plugin/parse/03_hadoop_reduce.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Parse/HadoopReduce.pm
r19363 r19783 3 3 use warnings; 4 4 use base 'App::Hachero::Plugin::Base'; 5 use App::Hachero::Result; 5 6 6 7 sub parse : Hook { … … 12 13 my $record = $context->result->{$prime}->{$second}; 13 14 if ($record) { 14 $record-> {count} += $VAR1->{count};15 $record->count_up($VAR1->{count}); 15 16 } else { 16 17 $context->result->{$prime}->{$second} = $VAR1; -
lang/perl/App-Hachero/trunk/lib/App/Hachero/Result.pm
r19782 r19783 69 69 70 70 sub count_up { 71 shift->{count}++; 71 my ($self, $n) = @_; 72 $n ||= 1; 73 shift->{count} += $n; 72 74 } 73 75 -
lang/perl/App-Hachero/trunk/t/plugin/output_line/01_hadoop_map.t
r19768 r19783 1 1 use strict; 2 2 use warnings; 3 use Test::More tests => 3;3 use Test::More tests => 4; 4 4 use App::Hachero; 5 5 use App::Hachero::Result; … … 44 44 my $VAR1; 45 45 eval $value; 46 isa_ok $VAR1, 'App::Hachero::Result::Data'; 46 47 is_deeply $VAR1, {a => 1, count => 1}; -
lang/perl/App-Hachero/trunk/t/plugin/parse/03_hadoop_reduce.t
r19363 r19783 16 16 my $app = App::Hachero->new({config => $config}); 17 17 18 $app->currentline(qq(hoo-bar\t\$VAR1= {"a" => 1,"count" => 3}\n));18 $app->currentline(qq(hoo-bar\t\$VAR1=bless( {"a" => 1,"count" => 3}, 'App::Hachero::Result::Data' )\n)); 19 19 $app->run_hook('parse'); 20 20 is_deeply $app->result->{hoo}->{bar}, {a => 1, count => 3}; 21 $app->currentline(qq(hoo-bar\t\$VAR1= {"a" => 1,"count" => 7}\n));21 $app->currentline(qq(hoo-bar\t\$VAR1=bless( {"a" => 1,"count" => 7}, 'App::Hachero::Result::Data' )\n)); 22 22 $app->run_hook('parse'); 23 23 is_deeply $app->result->{hoo}->{bar}, {a => 1, count => 10};
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)