unchecked cast in provenance code leads to cast exception
@@ -217,13 +217,21 @@ private static void log(long namenodeId, INode inode, TrackedProv type, INodeDir
if (PROV_PROJECTS.equals(aux.getLast().getLocalName())) { //part of a project - path - /Projects/
aux.removeLast(); //drop Projects path element
if(aux.isEmpty()) { //project
+ if(inode instanceof INodeDirectory) {
provDirs[ProvParents.PROJECT.ordinal()] = (INodeDirectory) inode;
return new Pair<>(TrackedProv.PROJECT, provDirs);
+ } else {
+ return new Pair<>(TrackedProv.OTHER, provDirs);
+ }
}
provDirs[ProvParents.PROJECT.ordinal()] = aux.removeLast();
if (aux.isEmpty()) { //dataset
+ if(inode instanceof INodeDirectory) {
provDirs[ProvParents.DATASET.ordinal()] = (INodeDirectory) inode;
return new Pair<>(TrackedProv.DATASET, provDirs);
+ } else {
+ return new Pair<>(TrackedProv.OTHER, provDirs);
+ }
} else { //part of a dataset
provDirs[ProvParents.DATASET.ordinal()] = aux.removeLast();
provDirs[ProvParents.PARENT_P1.ordinal()] = aux.isEmpty() ? null : aux.removeLast();
@@ -238,7 +246,11 @@ private static void log(long namenodeId, INode inode, TrackedProv type, INodeDir
provDirs[ProvParents.PROJECT.ordinal()] = null; //when in hive path we do not know the project
if(aux.isEmpty()) { //hive database
+ if(inode instanceof INodeDirectory) {
provDirs[ProvParents.DATASET.ordinal()] = (INodeDirectory) inode;
+ } else {
+ return new Pair<>(TrackedProv.OTHER, provDirs);
+ }
} else { //
provDirs[ProvParents.DATASET.ordinal()] = aux.removeLast();
}
