public DelimitedSplit() { // dummy constructor for Reflection used in deserialization super(null, 0, 0, null); header = new TextArrayWritable(); }
/** * Return the host from the host array based on a random fashion * @param hosts a WritableArray of host names * @return the host name * @throws IOException */ public static String getHost(TextArrayWritable hosts) throws IOException { String [] hostStrings = hosts.toStrings(); if(hostStrings == null || hostStrings.length==0) throw new IOException("Number of forests is 0: " + "check forests in database"); int count = hostStrings.length; int position = (int)(Math.random() * count); return hostStrings[position]; }
@Override public void readFields(DataInput in) throws IOException { header.readFields(in); super.readFields(in); }
@Override public void write(DataOutput out) throws IOException { header.write(out); super.write(out); }
for (Writable host : hosts.get()) { String hostStr = host.toString(); try {
DelimitedSplit ds = new DelimitedSplit(new TextArrayWritable( hlist.toArray(new Text[hlist.size()])), path, fsplit.getStart(), fsplit.getLength(),
fields = taw.toStrings(); try { docBuilder.configFields(conf, fields);
+ "check forests in database"); return new TextArrayWritable(hosts.toArray(new Text[hosts.size()])); } catch (RequestException e) { LOG.error(e.getMessage(), e);
if (restrictHosts) { String[] outputHosts = conf.getStrings(OUTPUT_HOST); hostArray = new TextArrayWritable(outputHosts); } else { String outputHost = cs.getConnectionProvider().getHostName();