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

The following examples show how to use org.apache.hadoop.io.WritableUtils#readEnum() . 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: HiveKuduWritable.java    From HiveKudu-Handler with Apache License 2.0 6 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    if (size == -1) {
        return;
    }
    if (columnValues == null) {
        this.columnValues = new Object[size];
        this.columnTypes = new Type[size];
    } else {
        clear();
    }
    for (int i = 0; i < size; i++) {
        Type kuduType = WritableUtils.readEnum(in, Type.class);
        columnTypes[i] = kuduType;
        Object v = HiveKuduBridgeUtils.readObject(in, kuduType);
        columnValues[i] = v;
    }
}
 
Example 2
Source File: HeartbeatResponse.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  this.responseId = in.readShort();
  this.heartbeatInterval = in.readInt();
  int length = WritableUtils.readVInt(in);
  if (length > 0) {
    actions = new TaskTrackerAction[length];
    for (int i=0; i < length; ++i) {
      TaskTrackerAction.ActionType actionType = 
        WritableUtils.readEnum(in, TaskTrackerAction.ActionType.class);
      actions[i] = TaskTrackerAction.createAction(actionType);
      actions[i].readFields(in);
    }
  } else {
    actions = null;
  }
  // Read the job ids of the jobs that were recovered
  int size = in.readInt();
  for (int i = 0; i < size; ++i) {
    JobID id = new JobID();
    id.readFields(in);
    recoveredJobs.add(id);
  }
}
 
Example 3
Source File: HeartbeatResponse.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  this.responseId = in.readShort();
  this.heartbeatInterval = in.readInt();
  int length = WritableUtils.readVInt(in);
  if (length > 0) {
    actions = new TaskTrackerAction[length];
    for (int i=0; i < length; ++i) {
      TaskTrackerAction.ActionType actionType = 
        WritableUtils.readEnum(in, TaskTrackerAction.ActionType.class);
      actions[i] = TaskTrackerAction.createAction(actionType);
      actions[i].readFields(in);
    }
  } else {
    actions = null;
  }
  // Read the job ids of the jobs that were recovered
  int size = in.readInt();
  for (int i = 0; i < size; ++i) {
    JobID id = new JobID();
    id.readFields(in);
    recoveredJobs.add(id);
  }
}
 
Example 4
Source File: TaskReport.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  this.taskid.readFields(in);
  this.progress = in.readFloat();
  this.state = Text.readString(in);
  this.startTime = in.readLong(); 
  this.finishTime = in.readLong();
  
  diagnostics = WritableUtils.readStringArray(in);
  counters = new Counters();
  counters.readFields(in);
  currentStatus = WritableUtils.readEnum(in, TIPStatus.class);
  if (currentStatus == TIPStatus.RUNNING) {
    int num = WritableUtils.readVInt(in);    
    for (int i = 0; i < num; i++) {
      TaskAttemptID t = new TaskAttemptID();
      t.readFields(in);
      runningAttempts.add(t);
    }
  } else if (currentStatus == TIPStatus.COMPLETE) {
    successfulAttempt.readFields(in);
  }
}
 
Example 5
Source File: TaskStatus.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  this.taskid.readFields(in);
  setProgress(in.readFloat());
  this.numSlots = in.readInt();
  this.runState = WritableUtils.readEnum(in, State.class);
  this.diagnosticInfo = Text.readString(in);
  this.stateString = Text.readString(in);
  this.phase = WritableUtils.readEnum(in, Phase.class); 
  this.startTime = in.readLong(); 
  this.finishTime = in.readLong(); 
  counters = new Counters();
  this.includeCounters = in.readBoolean();
  this.outputSize = in.readLong();
  if (includeCounters) {
    counters.readFields(in);
  }
  nextRecordRange.readFields(in);
}
 
Example 6
Source File: QueueInfo.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  queueName = StringInterner.weakIntern(Text.readString(in));
  queueState = WritableUtils.readEnum(in, QueueState.class);
  schedulingInfo = StringInterner.weakIntern(Text.readString(in));
  int length = in.readInt();
  stats = new JobStatus[length];
  for (int i = 0; i < length; i++) {
    stats[i] = new JobStatus();
    stats[i].readFields(in);
  }
  int count = in.readInt();
  children.clear();
  for (int i = 0; i < count; i++) {
    QueueInfo childQueueInfo = new QueueInfo();
    childQueueInfo.readFields(in);
    children.add(childQueueInfo);
  }
}
 
Example 7
Source File: TaskStatus.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  this.taskid.readFields(in);
  setProgress(in.readFloat());
  this.numSlots = in.readInt();
  this.runState = WritableUtils.readEnum(in, State.class);
  setDiagnosticInfo(StringInterner.weakIntern(Text.readString(in)));
  setStateString(StringInterner.weakIntern(Text.readString(in)));
  this.phase = WritableUtils.readEnum(in, Phase.class); 
  this.startTime = in.readLong(); 
  this.finishTime = in.readLong(); 
  counters = new Counters();
  this.includeAllCounters = in.readBoolean();
  this.outputSize = in.readLong();
  counters.readFields(in);
  nextRecordRange.readFields(in);
}
 
Example 8
Source File: ToCharFunction.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);
    formatter = type.getFormatter(formatString);
}
 
Example 9
Source File: TaskCompletionEvent.java    From hadoop 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 10
Source File: JobStatus.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public synchronized void readFields(DataInput in) throws IOException {
  this.jobid = new JobID();
  this.jobid.readFields(in);
  this.setupProgress = in.readFloat();
  this.mapProgress = in.readFloat();
  this.reduceProgress = in.readFloat();
  this.cleanupProgress = in.readFloat();
  this.runState = WritableUtils.readEnum(in, State.class);
  this.startTime = in.readLong();
  this.user = StringInterner.weakIntern(Text.readString(in));
  this.priority = WritableUtils.readEnum(in, JobPriority.class);
  this.schedulingInfo = StringInterner.weakIntern(Text.readString(in));
  this.finishTime = in.readLong();
  this.isRetired = in.readBoolean();
  this.historyFile = StringInterner.weakIntern(Text.readString(in));
  this.jobName = StringInterner.weakIntern(Text.readString(in));
  this.trackingUrl = StringInterner.weakIntern(Text.readString(in));
  this.jobFile = StringInterner.weakIntern(Text.readString(in));
  this.isUber = in.readBoolean();

  // De-serialize the job's ACLs
  int numACLs = in.readInt();
  for (int i = 0; i < numACLs; i++) {
    JobACL aclType = WritableUtils.readEnum(in, JobACL.class);
    AccessControlList acl = new AccessControlList(" ");
    acl.readFields(in);
    this.jobACLs.put(aclType, acl);
  }
}
 
Example 11
Source File: ToCharFunction.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);
    formatter = type.getFormatter(formatString);
}
 
Example 12
Source File: ClusterStatus.java    From big-c with Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  numActiveTrackers = in.readInt();
  int numTrackerNames = in.readInt();
  if (numTrackerNames > 0) {
    for (int i = 0; i < numTrackerNames; i++) {
      String name = StringInterner.weakIntern(Text.readString(in));
      activeTrackers.add(name);
    }
  }
  numBlacklistedTrackers = in.readInt();
  int blackListTrackerInfoSize = in.readInt();
  if(blackListTrackerInfoSize > 0) {
    for (int i = 0; i < blackListTrackerInfoSize; i++) {
      BlackListInfo info = new BlackListInfo();
      info.readFields(in);
      blacklistedTrackersInfo.add(info);
    }
  }
  numExcludedNodes = in.readInt();
  ttExpiryInterval = in.readLong();
  map_tasks = in.readInt();
  reduce_tasks = in.readInt();
  max_map_tasks = in.readInt();
  max_reduce_tasks = in.readInt();
  status = WritableUtils.readEnum(in, JobTrackerStatus.class);
  grayListedTrackers = in.readInt();
}
 
Example 13
Source File: FsServerDefaults.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
@InterfaceAudience.Private
public void readFields(DataInput in) throws IOException {
  blockSize = in.readLong();
  bytesPerChecksum = in.readInt();
  writePacketSize = in.readInt();
  replication = in.readShort();
  fileBufferSize = in.readInt();
  checksumType = WritableUtils.readEnum(in, DataChecksum.Type.class);
}
 
Example 14
Source File: Task.java    From big-c with Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  jobFile = StringInterner.weakIntern(Text.readString(in));
  taskId = TaskAttemptID.read(in);
  partition = in.readInt();
  numSlotsRequired = in.readInt();
  taskStatus.readFields(in);
  skipRanges.readFields(in);
  currentRecIndexIterator = skipRanges.skipRangeIterator();
  currentRecStartIndex = currentRecIndexIterator.next();
  skipping = in.readBoolean();
  jobCleanup = in.readBoolean();
  if (jobCleanup) {
    jobRunStateForCleanup = 
      WritableUtils.readEnum(in, JobStatus.State.class);
  }
  jobSetup = in.readBoolean();
  writeSkipRecs = in.readBoolean();
  taskCleanup = in.readBoolean();
  if (taskCleanup) {
    setPhase(TaskStatus.Phase.CLEANUP);
  }
  user = StringInterner.weakIntern(Text.readString(in));
  int len = in.readInt();
  encryptedSpillKey = new byte[len];
  extraData.readFields(in);
  in.readFully(encryptedSpillKey);
}
 
Example 15
Source File: LocationReducerOutputValue.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void readFields(DataInput dataInput) throws IOException {
  this.uvs  = dataInput.readInt();
  this.visits = dataInput.readInt();
  this.bounceNumber = dataInput.readInt();
  this.kpi = WritableUtils.readEnum(dataInput, KpiType.class);
}
 
Example 16
Source File: FsServerDefaults.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
@InterfaceAudience.Private
public void readFields(DataInput in) throws IOException {
  blockSize = in.readLong();
  bytesPerChecksum = in.readInt();
  writePacketSize = in.readInt();
  replication = in.readShort();
  fileBufferSize = in.readInt();
  checksumType = WritableUtils.readEnum(in, DataChecksum.Type.class);
}
 
Example 17
Source File: ImageLoaderCurrent.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * Process the INodes under construction section of the fsimage.
 *
 * @param in DataInputStream to process
 * @param v Visitor to walk over inodes
 * @param skipBlocks Walk over each block?
 */
private void processINodesUC(DataInputStream in, ImageVisitor v,
    boolean skipBlocks) throws IOException {
  int numINUC = in.readInt();

  v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                         ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

  for(int i = 0; i < numINUC; i++) {
    v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
    byte [] name = FSImageSerialization.readBytes(in);
    String n = new String(name, "UTF8");
    v.visit(ImageElement.INODE_PATH, n);
    
    if (NameNodeLayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
      long inodeId = in.readLong();
      v.visit(ImageElement.INODE_ID, inodeId);
    }
    
    v.visit(ImageElement.REPLICATION, in.readShort());
    v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

    v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
    int numBlocks = in.readInt();
    processBlocks(in, v, numBlocks, skipBlocks);

    processPermission(in, v);
    v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
    v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

    // Skip over the datanode descriptors, which are still stored in the
    // file but are not used by the datanode or loaded into memory
    int numLocs = in.readInt();
    for(int j = 0; j < numLocs; j++) {
      in.readShort();
      in.readLong();
      in.readLong();
      in.readLong();
      in.readInt();
      FSImageSerialization.readString(in);
      FSImageSerialization.readString(in);
      WritableUtils.readEnum(in, AdminStates.class);
    }

    v.leaveEnclosingElement(); // INodeUnderConstruction
  }

  v.leaveEnclosingElement(); // INodesUnderConstruction
}
 
Example 18
Source File: InboundBounceReduceValue.java    From BigDataArchitect with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    this.bounceNumber = in.readInt();
    this.kpi = WritableUtils.readEnum(in, KpiType.class);
}
 
Example 19
Source File: TaskID.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  super.readFields(in);
  jobId.readFields(in);
  type = WritableUtils.readEnum(in, TaskType.class);
}
 
Example 20
Source File: TaskID.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  super.readFields(in);
  jobId.readFields(in);
  type = WritableUtils.readEnum(in, TaskType.class);
}