List of usage examples for org.apache.hadoop.fs BlockLocation toString
@Override
public String toString()
From source file:org.apache.impala.catalog.HdfsTable.java
License:Apache License
/** * Loads the disk IDs for BlockLocation 'location' and its corresponding file block. * HDFS API for BlockLocation returns a storageID UUID string for each disk * hosting the block, which is then mapped to a 0-based integer id called disk ID. * Returns the number of unknown disk IDs encountered in this process. *//*from ww w.j a va 2 s. c om*/ private int loadDiskIds(BlockLocation location, THdfsFileBlock fileBlock) { int unknownDiskIdCount = 0; String[] storageIds = location.getStorageIds(); String[] hosts; try { hosts = location.getHosts(); } catch (IOException e) { LOG.error("Couldn't get hosts for block: " + location.toString(), e); return unknownDiskIdCount; } if (storageIds.length != hosts.length) { LOG.error("Number of storage IDs and number of hosts for block: " + location.toString() + " mismatch. Skipping disk ID loading for this block."); return unknownDiskIdCount; } int[] diskIDs = new int[storageIds.length]; for (int i = 0; i < storageIds.length; ++i) { if (Strings.isNullOrEmpty(storageIds[i])) { diskIDs[i] = -1; ++unknownDiskIdCount; } else { diskIDs[i] = DiskIdMapper.INSTANCE.getDiskId(hosts[i], storageIds[i]); } } FileBlock.setDiskIds(diskIDs, fileBlock); return unknownDiskIdCount; }