This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
register 'maprfs:///user/rlankenau/moneyball-1.0-SNAPSHOT.jar'; | |
DEFINE RetrosheetLoader com.mapr.baseball.RetrosheetLoader(); | |
set default_parallel 20; | |
set job.name mapr_baseball_summary | |
raw = LOAD '/projects/baseball/*.EV?' USING RetrosheetLoader(); | |
describe raw; | |
-- This outputs a single record for each play, with all associated game information. | |
flattened = FOREACH raw GENERATE $0 .. $39, FLATTEN($40); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public InputFormat getInputFormat() throws IOException { | |
return new RetrosheetInputFormat(); | |
} | |
@Override | |
public Tuple getNext() throws IOException { | |
RetrosheetPlayer[] home_players = new RetrosheetPlayer[11]; | |
RetrosheetPlayer[] away_players = new RetrosheetPlayer[11]; | |
RetrosheetPlayer[] defense = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id,CHN200104020 | |
version,2 | |
info,visteam,MON | |
info,hometeam,CHN | |
info,site,CHI11 | |
info,date,2001/04/02 | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isStartLine(Text t) | |
{ | |
/* Find the end of the first field */ | |
int fieldTerm = t.find(","); | |
int idTerm = t.find("id"); | |
return (idTerm != -1 && fieldTerm != -1 && idTerm < fieldTerm); | |
} | |
public boolean nextKeyValue() throws IOException | |
{ |