Github user merrimanr commented on a diff in the pull request:
https://github.com/apache/metron/pull/824#discussion_r150866003
--- Diff:
metron-platform/metron-indexing/src/main/java/org/apache/metron/indexing/dao/HBaseDao.java
---
@@ -135,8 +138,9 @@ private Document getDocumentFromResult(Result result)
throws IOException {
Map.Entry<byte[], byte[]> entry= columns.lastEntry();
Long ts = Bytes.toLong(entry.getKey());
if(entry.getValue()!= null) {
- String json = new String(entry.getValue());
- return new Document(json, Bytes.toString(result.getRow()), null, ts);
+ Map<String, Object> json = JSONUtils.INSTANCE.load(new
String(entry.getValue()), new TypeReference<Map<String, Object>>() {
+ });
+ return new Document(json, Bytes.toString(result.getRow()), (String)
json.get(SOURCE_TYPE), ts);
--- End diff --
Option 1 is not possible the way things are now. This constant is already
in an ES specific class in metron-elasticsearch but metron-elasticsearch
depends on metron-indexing. To get access to that constant we would need to
add metron-elasticsearch as a dependency to metron-indexing thus creating a
circular dependency.
Option 2 would be my least favorite option and I would rather just change
the method signature of getAllLatest to include all guid/sensorType
relationships.
Since we currently have a PR in review for the ES 5 upgrade that will allow
us to just remove this constant, I don't feel like we should spend much time on
it. I would also argue that this was an issue long before this PR so anything
more than a simple workaround should be a follow-on.
---