You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2015/06/22 17:34:08 UTC
[2/3] incubator-streams git commit: peer review feedback,
edit for readability
peer review feedback, edit for readability
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/929b6891
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/929b6891
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/929b6891
Branch: refs/heads/master
Commit: 929b68913faf654533540c25614ab8a305bdd0e9
Parents: 766a3cb
Author: Steve Blackmon (@steveblackmon) <sb...@apache.org>
Authored: Mon Jun 22 10:32:06 2015 -0500
Committer: Steve Blackmon (@steveblackmon) <sb...@apache.org>
Committed: Mon Jun 22 10:32:06 2015 -0500
----------------------------------------------------------------------
.../streams/hdfs/WebHdfsPersistReader.java | 27 ++++++++++----------
1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/929b6891/streams-contrib/streams-persist-hdfs/src/main/java/org/apache/streams/hdfs/WebHdfsPersistReader.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-persist-hdfs/src/main/java/org/apache/streams/hdfs/WebHdfsPersistReader.java b/streams-contrib/streams-persist-hdfs/src/main/java/org/apache/streams/hdfs/WebHdfsPersistReader.java
index 7094aab..14660ed 100644
--- a/streams-contrib/streams-persist-hdfs/src/main/java/org/apache/streams/hdfs/WebHdfsPersistReader.java
+++ b/streams-contrib/streams-persist-hdfs/src/main/java/org/apache/streams/hdfs/WebHdfsPersistReader.java
@@ -214,7 +214,8 @@ public class WebHdfsPersistReader implements StreamsPersistReader, DatumStatusCo
public StreamsDatum processLine(String line) {
- String[] fields = line.split(hdfsConfiguration.getFieldDelimiter());
+ String[] expectedFields = hdfsConfiguration.getFields();
+ String[] parsedFields = line.split(hdfsConfiguration.getFieldDelimiter());
if( fields.length == 0)
return null;
@@ -224,22 +225,22 @@ public class WebHdfsPersistReader implements StreamsPersistReader, DatumStatusCo
Map<String, Object> metadata = null;
String json = null;
- if( hdfsConfiguration.getFields().contains( HdfsConstants.DOC )
- && fields.length > hdfsConfiguration.getFields().indexOf(HdfsConstants.DOC)) {
- json = fields[hdfsConfiguration.getFields().indexOf(HdfsConstants.DOC)];
+ if( expectedFields.contains( HdfsConstants.DOC )
+ && parsedFields.length > expectedFields.indexOf(HdfsConstants.DOC)) {
+ json = parsedFields[expectedFields.indexOf(HdfsConstants.DOC)];
}
- if( hdfsConfiguration.getFields().contains( HdfsConstants.ID )
- && fields.length > hdfsConfiguration.getFields().indexOf(HdfsConstants.ID)) {
- id = fields[hdfsConfiguration.getFields().indexOf(HdfsConstants.ID)];
+ if( expectedFields.contains( HdfsConstants.ID )
+ && parsedFields.length > expectedFields.indexOf(HdfsConstants.ID)) {
+ id = parsedFields[expectedFields.indexOf(HdfsConstants.ID)];
}
- if( hdfsConfiguration.getFields().contains( HdfsConstants.TS )
- && fields.length > hdfsConfiguration.getFields().indexOf(HdfsConstants.TS)) {
- ts = parseTs(fields[hdfsConfiguration.getFields().indexOf(HdfsConstants.TS)]);
+ if( expectedFields.contains( HdfsConstants.TS )
+ && parsedFields.length > expectedFields.indexOf(HdfsConstants.TS)) {
+ ts = parseTs(parsedFields[expectedFields.indexOf(HdfsConstants.TS)]);
}
- if( hdfsConfiguration.getFields().contains( HdfsConstants.META )
- && fields.length > hdfsConfiguration.getFields().indexOf(HdfsConstants.META)) {
- metadata = parseMap(fields[hdfsConfiguration.getFields().indexOf(HdfsConstants.META)]);
+ if( expectedFields.contains( HdfsConstants.META )
+ && parsedFields.length > expectedFields.indexOf(HdfsConstants.META)) {
+ metadata = parseMap(parsedFields[expectedFields.indexOf(HdfsConstants.META)]);
}
StreamsDatum datum = new StreamsDatum(json);