Java Code Examples for org.apache.hadoop.io.WritableUtils#readString()

The following examples show how to use org.apache.hadoop.io.WritableUtils#readString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TabletSplitSplit.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * @throws IOException
 *             If the child InputSplit cannot be read, typically for failing access checks.
 */
@SuppressWarnings("unchecked")
// Generic array assignment
public void readFields(DataInput in) throws IOException {
    table = WritableUtils.readString(in);
    int card = WritableUtils.readVInt(in);
    if (splits == null || splits.length != card) {
        splits = new InputSplit[card];
    }
    Class<? extends InputSplit>[] cls = new Class[card];
    try {
        for (int i = 0; i < card; ++i) {
            cls[i] = Class.forName(Text.readString(in)).asSubclass(InputSplit.class);
        }
        for (int i = 0; i < card; ++i) {
            splits[i] = ReflectionUtils.newInstance(cls[i], null);
            if (splits[i] instanceof Writable) {
                ((Writable) splits[i]).readFields(in);
            }
        }
    } catch (ClassNotFoundException e) {
        throw (IOException) new IOException("Failed split init").initCause(e);
    }
}
 
Example 2
Source File: TaskCompletionEvent.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  taskId.readFields(in); 
  idWithinJob = WritableUtils.readVInt(in);
  isMap = in.readBoolean();
  status = WritableUtils.readEnum(in, Status.class);
  taskTrackerHttp = WritableUtils.readString(in);
  taskRunTime = WritableUtils.readVInt(in);
  eventId = WritableUtils.readVInt(in);
}
 
Example 3
Source File: ToNumberFunction.java    From phoenix with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void readFields(DataInput input) throws IOException {
    super.readFields(input);
    formatString = WritableUtils.readString(input);
    type = WritableUtils.readEnum(input, FunctionArgumentType.class);
    if (formatString != null) {
    	format = type.getFormatter(formatString);
    }
}
 
Example 4
Source File: AegCombinedSplit.java    From aegisthus with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    try {
        int cnt = in.readInt();
        for (int i = 0; i < cnt; i++) {
            String className = WritableUtils.readString(in);
            AegSplit split = AEG_SPLIT_LOADING_CACHE.get(className).newInstance();
            split.readFields(in);
            splits.add(split);
        }
    } catch (Throwable t) {
        Throwables.propagateIfPossible(t, IOException.class);
        throw new IOException("Unexpected exception", t);
    }
}
 
Example 5
Source File: CoronaSessionInfo.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  this.sessionHandle = WritableUtils.readString(in);
  String hostName = WritableUtils.readString(in);
  int port = WritableUtils.readVInt(in);
  this.jobTrackerAddr = new InetSocketAddress(hostName, port);
}
 
Example 6
Source File: UDFExpression.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput input) throws IOException {
    super.readFields(input);
    this.tenantId = PNameFactory.newName(WritableUtils.readString(input));
    this.functionClassName = WritableUtils.readString(input);
    String str = WritableUtils.readString(input);
    this.jarPath = str.length() == 0 ? null: str;
    constructUDFFunction();
}
 
Example 7
Source File: ToNumberFunction.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput input) throws IOException {
    super.readFields(input);
    formatString = WritableUtils.readString(input);
    type = WritableUtils.readEnum(input, FunctionArgumentType.class);
    if (formatString != null) {
    	format = type.getFormatter(formatString);
    }
}
 
Example 8
Source File: IpAddress.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    readMetadata(in);
    String ipString = WritableUtils.readString(in);
    setValue(ipString);
    setNormalizedValue(ipString);
    validate();
}
 
Example 9
Source File: LogBeanWritable.java    From 163-bigdate-note with GNU General Public License v3.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    activeName = WritableUtils.readString(in);
    sessionID = WritableUtils.readString(in);
    timeTag = in.readLong();
    ip = WritableUtils.readString(in);
    deviceID = WritableUtils.readString(in);
    reqUrl = WritableUtils.readString(in);
    userID = WritableUtils.readString(in);
    productID = WritableUtils.readString(in);
    orderID = WritableUtils.readString(in);
}
 
Example 10
Source File: FileSystemCounterGroup.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  int numSchemes = WritableUtils.readVInt(in);    // #scheme
  FileSystemCounter[] enums = FileSystemCounter.values();
  for (int i = 0; i < numSchemes; ++i) {
    String scheme = WritableUtils.readString(in); // scheme
    int numCounters = WritableUtils.readVInt(in); // #counter
    for (int j = 0; j < numCounters; ++j) {
      findCounter(scheme, enums[WritableUtils.readVInt(in)])  // key
          .setValue(WritableUtils.readVLong(in)); // value
    }
  }
}
 
Example 11
Source File: WikipediaPage.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    this.id = in.readInt();
    this.title = WritableUtils.readString(in);
    this.timestamp = in.readLong();
    this.comments = WritableUtils.readString(in);
    this.text = WritableUtils.readString(in);
}
 
Example 12
Source File: LogBeanWritable.java    From 163-bigdate-note with GNU General Public License v3.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    activeName = WritableUtils.readString(in);
    sessionID = WritableUtils.readString(in);
    timeTag = in.readLong();
    ip = WritableUtils.readString(in);
    deviceID = WritableUtils.readString(in);
    reqUrl = WritableUtils.readString(in);
    userID = WritableUtils.readString(in);
    productID = WritableUtils.readString(in);
    orderID = WritableUtils.readString(in);
}
 
Example 13
Source File: LogBeanWritable.java    From 163-bigdate-note with GNU General Public License v3.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
    activeName = WritableUtils.readString(in);
    sessionID = WritableUtils.readString(in);
    timeTag = in.readLong();
    ip = WritableUtils.readString(in);
    deviceID = WritableUtils.readString(in);
    reqUrl = WritableUtils.readString(in);
    userID = WritableUtils.readString(in);
    productID = WritableUtils.readString(in);
    orderID = WritableUtils.readString(in);
}
 
Example 14
Source File: IpTimestampKey.java    From clickstream-tutorial with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput dataInput) throws IOException {
    ip = WritableUtils.readString(dataInput);
    unixTimestamp = dataInput.readLong();

}
 
Example 15
Source File: IpTimestampKey.java    From hadoop-arch-book with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput dataInput) throws IOException {
    ip = WritableUtils.readString(dataInput);
    unixTimestamp = dataInput.readLong();

}
 
Example 16
Source File: TableRowkeyPair.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
 public void readFields(DataInput input) throws IOException {
     tableName = WritableUtils.readString(input);
     rowkey = new ImmutableBytesWritable();
     rowkey.readFields(input);
}
 
Example 17
Source File: ToDateFunction.java    From phoenix with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void readFields(DataInput input) throws IOException {
    super.readFields(input);
    dateFormat = WritableUtils.readString(input);
    dateParser = DateUtil.getDateParser(dateFormat);
}
 
Example 18
Source File: GenericMRLoadGenerator.java    From big-c with Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  file = new Path(WritableUtils.readString(in));
  len = WritableUtils.readVLong(in);
}
 
Example 19
Source File: PreNormalizedAttribute.java    From datawave with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput input) throws IOException {
    super.readMetadata(input);
    
    this.value = WritableUtils.readString(input);
}
 
Example 20
Source File: GenericMRLoadGenerator.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  file = new Path(WritableUtils.readString(in));
  len = WritableUtils.readVLong(in);
}