private SplitLocationInfo[] makeLocationHints(TaskLocationHint hint) { Set<String> hosts = hint.getHosts(); if (hosts.size() != 1) { LOG.warn("Bad # of locations: " + hosts.size()); } SplitLocationInfo[] locations = new SplitLocationInfo[hosts.size()]; int j = 0; for (String host : hosts) { locations[j++] = new SplitLocationInfo(host, false); } return locations; }
private SplitLocationInfo[] makeLocationHints(TaskLocationHint hint) { Set<String> hosts = hint.getHosts(); if (hosts == null) { LOG.warn("No hosts"); return new SplitLocationInfo[0]; } if (hosts.size() != 1) { LOG.warn("Bad # of locations: " + hosts.size()); } SplitLocationInfo[] locations = new SplitLocationInfo[hosts.size()]; int j = 0; for (String host : hosts) { locations[j++] = new SplitLocationInfo(host, false); } return locations; }
@Override public void readFields(DataInput in) throws IOException { splitNum = in.readInt(); int length = in.readInt(); planBytes = new byte[length]; in.readFully(planBytes); length = in.readInt(); fragmentBytes = new byte[length]; in.readFully(fragmentBytes); length = in.readInt(); if (length > 0) { fragmentBytesSignature = new byte[length]; in.readFully(fragmentBytesSignature); } length = in.readInt(); locations = new SplitLocationInfo[length]; for (int i = 0; i < length; ++i) { locations[i] = new SplitLocationInfo(in.readUTF(), false); } schema = new Schema(); schema.readFields(in); llapUser = in.readUTF(); length = in.readInt(); if (length > 0) { tokenBytes = new byte[length]; in.readFully(tokenBytes); } }
/** Constructs a split with host and cached-blocks information * * @param file the file name * @param start the position of the first byte in the file to process * @param length the number of bytes in the file to process * @param hosts the list of hosts containing the block * @param inMemoryHosts the list of hosts containing the block in memory */ public FileSplit(Path file, long start, long length, String[] hosts, String[] inMemoryHosts) { this(file, start, length, hosts); hostInfos = new SplitLocationInfo[hosts.length]; for (int i = 0; i < hosts.length; i++) { // because N will be tiny, scanning is probably faster than a HashSet boolean inMemory = false; for (String inMemoryHost : inMemoryHosts) { if (inMemoryHost.equals(hosts[i])) { inMemory = true; break; } } hostInfos[i] = new SplitLocationInfo(hosts[i], inMemory); } }
/** Constructs a split with host and cached-blocks information * * @param file the file name * @param start the position of the first byte in the file to process * @param length the number of bytes in the file to process * @param hosts the list of hosts containing the block * @param inMemoryHosts the list of hosts containing the block in memory */ public FileSplit(Path file, long start, long length, String[] hosts, String[] inMemoryHosts) { this(file, start, length, hosts); hostInfos = new SplitLocationInfo[hosts.length]; for (int i = 0; i < hosts.length; i++) { // because N will be tiny, scanning is probably faster than a HashSet boolean inMemory = false; for (String inMemoryHost : inMemoryHosts) { if (inMemoryHost.equals(hosts[i])) { inMemory = true; break; } } hostInfos[i] = new SplitLocationInfo(hosts[i], inMemory); } }
/** Constructs a split with host and cached-blocks information * * @param file the file name * @param start the position of the first byte in the file to process * @param length the number of bytes in the file to process * @param hosts the list of hosts containing the block * @param inMemoryHosts the list of hosts containing the block in memory */ public FileSplit(Path file, long start, long length, String[] hosts, String[] inMemoryHosts) { this(file, start, length, hosts); hostInfos = new SplitLocationInfo[hosts.length]; for (int i = 0; i < hosts.length; i++) { // because N will be tiny, scanning is probably faster than a HashSet boolean inMemory = false; for (String inMemoryHost : inMemoryHosts) { if (inMemoryHost.equals(hosts[i])) { inMemory = true; break; } } hostInfos[i] = new SplitLocationInfo(hosts[i], inMemory); } }
/** Constructs a split with host and cached-blocks information * * @param file the file name * @param start the position of the first byte in the file to process * @param length the number of bytes in the file to process * @param hosts the list of hosts containing the block * @param inMemoryHosts the list of hosts containing the block in memory */ public FileSplit(Path file, long start, long length, String[] hosts, String[] inMemoryHosts) { this(file, start, length, hosts); hostInfos = new SplitLocationInfo[hosts.length]; for (int i = 0; i < hosts.length; i++) { // because N will be tiny, scanning is probably faster than a HashSet boolean inMemory = false; for (String inMemoryHost : inMemoryHosts) { if (inMemoryHost.equals(hosts[i])) { inMemory = true; break; } } hostInfos[i] = new SplitLocationInfo(hosts[i], inMemory); } }
@Override public void readFields(DataInput in) throws IOException { splitNum = in.readInt(); int length = in.readInt(); planBytes = new byte[length]; in.readFully(planBytes); length = in.readInt(); fragmentBytes = new byte[length]; in.readFully(fragmentBytes); length = in.readInt(); if (length > 0) { fragmentBytesSignature = new byte[length]; in.readFully(fragmentBytesSignature); } length = in.readInt(); locations = new SplitLocationInfo[length]; for (int i = 0; i < length; ++i) { locations[i] = new SplitLocationInfo(in.readUTF(), false); } schema = new Schema(); schema.readFields(in); llapUser = in.readUTF(); length = in.readInt(); if (length > 0) { tokenBytes = new byte[length]; in.readFully(tokenBytes); } }