Commit fe1c7a3b by rdsolani Committed by Madhan Neethiraj

ATLAS-2592 Storm atlas hook fails with NPE

parent 57c7e85e
...@@ -199,6 +199,9 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook { ...@@ -199,6 +199,9 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
clusterName = getClusterName(stormConf); clusterName = getClusterName(stormConf);
if (topicName == null) {
LOG.error("Kafka topic name not found");
} else {
ret = new AtlasEntity(StormDataTypes.KAFKA_TOPIC.getName()); ret = new AtlasEntity(StormDataTypes.KAFKA_TOPIC.getName());
ret.setAttribute("topic", topicName); ret.setAttribute("topic", topicName);
...@@ -207,6 +210,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook { ...@@ -207,6 +210,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
ret.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, getKafkaTopicQualifiedName(clusterName, topicName)); ret.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, getKafkaTopicQualifiedName(clusterName, topicName));
ret.setAttribute(AtlasClient.NAME, topicName); ret.setAttribute(AtlasClient.NAME, topicName);
} }
}
break; break;
case "HBaseBolt": { case "HBaseBolt": {
...@@ -219,6 +223,9 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook { ...@@ -219,6 +223,9 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
clusterName = extractComponentClusterName(HBaseConfiguration.create(), stormConf); clusterName = extractComponentClusterName(HBaseConfiguration.create(), stormConf);
if (hbaseTableName == null) {
LOG.error("HBase table name not found");
} else {
ret = new AtlasEntity(StormDataTypes.HBASE_TABLE.getName()); ret = new AtlasEntity(StormDataTypes.HBASE_TABLE.getName());
ret.setAttribute("uri", hbaseTableName); ret.setAttribute("uri", hbaseTableName);
...@@ -227,6 +234,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook { ...@@ -227,6 +234,7 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
//TODO - Hbase Namespace is hardcoded to 'default'. need to check how to get this or is it already part of tableName //TODO - Hbase Namespace is hardcoded to 'default'. need to check how to get this or is it already part of tableName
ret.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, getHbaseTableQualifiedName(clusterName, HBASE_NAMESPACE_DEFAULT, hbaseTableName)); ret.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, getHbaseTableQualifiedName(clusterName, HBASE_NAMESPACE_DEFAULT, hbaseTableName));
} }
}
break; break;
case "HdfsBolt": { case "HdfsBolt": {
...@@ -261,8 +269,10 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook { ...@@ -261,8 +269,10 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
final String dbName = config.get("HiveBolt.options.databaseName"); final String dbName = config.get("HiveBolt.options.databaseName");
final String tblName = config.get("HiveBolt.options.tableName"); final String tblName = config.get("HiveBolt.options.tableName");
final String tblQualifiedName = HiveMetaStoreBridge.getTableQualifiedName(clusterName, dbName, tblName);
if (dbName == null || tblName ==null) {
LOG.error("Hive database or table name not found");
} else {
AtlasEntity dbEntity = new AtlasEntity("hive_db"); AtlasEntity dbEntity = new AtlasEntity("hive_db");
dbEntity.setAttribute(AtlasClient.NAME, dbName); dbEntity.setAttribute(AtlasClient.NAME, dbName);
...@@ -276,7 +286,8 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook { ...@@ -276,7 +286,8 @@ public class StormAtlasHook extends AtlasHook implements ISubmitterHook {
ret.setAttribute(AtlasClient.NAME, tblName); ret.setAttribute(AtlasClient.NAME, tblName);
ret.setAttribute(ATTRIBUTE_DB, AtlasTypeUtil.getAtlasObjectId(dbEntity)); ret.setAttribute(ATTRIBUTE_DB, AtlasTypeUtil.getAtlasObjectId(dbEntity));
ret.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tblQualifiedName); ret.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, HiveMetaStoreBridge.getTableQualifiedName(clusterName, dbName, tblName));
}
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment