@Test public void testGetApproxSubmitTime() throws IOException, MissingColumnInResultException { JobHistoryRawService rawService = new JobHistoryRawService(hbaseConnection); Cell[] cells = new Cell[1]; long modts = 1396550668000L; cells[0] = CellUtil.createCell(Bytes.toBytes("someRowKey"), Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES, HConstants.LATEST_TIMESTAMP, KeyValue.Type.Put.getCode(), Bytes.toBytes(modts)); Result result = Result.create(cells); long st = rawService.getApproxSubmitTime(result); long expts = modts - Constants.AVERGAE_JOB_DURATION; assertEquals(expts, st); }
public long getApproxSubmitTime(Result value) throws MissingColumnInResultException { if (value == null) { throw new IllegalArgumentException( "Cannot get last modification time from " + "a null hbase result"); } Cell cell = value.getColumnLatestCell(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); if (cell == null) { throw new MissingColumnInResultException(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); } byte[] lastModTimeBytes = CellUtil.cloneValue(cell); long lastModTime = Bytes.toLong(lastModTimeBytes); long jobSubmitTimeMillis = lastModTime - Constants.AVERGAE_JOB_DURATION; LOG.debug("Approximate job submit time is " + jobSubmitTimeMillis + " based on " + lastModTime); return jobSubmitTimeMillis; }
JobHistoryRawService { public long getApproxSubmitTime(Result value) throws MissingColumnInResultException { if (value == null) { throw new IllegalArgumentException( "Cannot get last modification time from " + "a null hbase result"); } Cell cell = value.getColumnLatestCell(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); if (cell == null) { throw new MissingColumnInResultException(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); } byte[] lastModTimeBytes = CellUtil.cloneValue(cell); long lastModTime = Bytes.toLong(lastModTimeBytes); long jobSubmitTimeMillis = lastModTime - Constants.AVERGAE_JOB_DURATION; LOG.debug("Approximate job submit time is " + jobSubmitTimeMillis + " based on " + lastModTime); return jobSubmitTimeMillis; } }
JobHistoryRawService { public long getApproxSubmitTime(Result value) throws MissingColumnInResultException { if (value == null) { throw new IllegalArgumentException( "Cannot get last modification time from " + "a null hbase result"); } Cell cell = value.getColumnLatestCell(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); if (cell == null) { throw new MissingColumnInResultException(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); } byte[] lastModTimeBytes = CellUtil.cloneValue(cell); long lastModTime = Bytes.toLong(lastModTimeBytes); long jobSubmitTimeMillis = lastModTime - Constants.AVERGAE_JOB_DURATION; LOG.debug("Approximate job submit time is " + jobSubmitTimeMillis + " based on " + lastModTime); return jobSubmitTimeMillis; } JobHistoryRawService(Connection hbaseConnection); }
JobHistoryRawService { public long getApproxSubmitTime(Result value) throws MissingColumnInResultException { if (value == null) { throw new IllegalArgumentException( "Cannot get last modification time from " + "a null hbase result"); } Cell cell = value.getColumnLatestCell(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); if (cell == null) { throw new MissingColumnInResultException(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); } byte[] lastModTimeBytes = CellUtil.cloneValue(cell); long lastModTime = Bytes.toLong(lastModTimeBytes); long jobSubmitTimeMillis = lastModTime - Constants.AVERGAE_JOB_DURATION; LOG.debug("Approximate job submit time is " + jobSubmitTimeMillis + " based on " + lastModTime); return jobSubmitTimeMillis; } JobHistoryRawService(Connection hbaseConnection); List<Scan> getHistoryRawTableScans(String cluster, String minJobId,
      String maxJobId, boolean reprocess, int batchSize); Scan getHistoryRawTableScan(String cluster, String minJobId,
      String maxJobId, boolean reprocess, boolean includeRaw); Configuration getRawJobConfiguration(QualifiedJobId jobId); String getRawJobHistory(QualifiedJobId jobId); byte[] getRawJobHistoryBytes(QualifiedJobId jobId); Configuration createConfigurationFromResult(Result result); byte[] getRowKey(String cluster, String jobId); QualifiedJobId getQualifiedJobIdFromResult(Result result); InputStream getJobHistoryInputStreamFromResult(Result result); Put getJobProcessedSuccessPut(byte[] row, boolean success); long getApproxSubmitTime(Result value); Put getJobSubmitTimePut(byte[] row, long submitTimeMillis); void markJobForReprocesssing(QualifiedJobId jobId); byte[] getJobHistoryRawFromResult(Result value); Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status); boolean getStatusAgg(byte[] row, byte[] col); }
JobHistoryRawService { public long getApproxSubmitTime(Result value) throws MissingColumnInResultException { if (value == null) { throw new IllegalArgumentException( "Cannot get last modification time from " + "a null hbase result"); } Cell cell = value.getColumnLatestCell(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); if (cell == null) { throw new MissingColumnInResultException(Constants.INFO_FAM_BYTES, Constants.JOBHISTORY_LAST_MODIFIED_COL_BYTES); } byte[] lastModTimeBytes = CellUtil.cloneValue(cell); long lastModTime = Bytes.toLong(lastModTimeBytes); long jobSubmitTimeMillis = lastModTime - Constants.AVERGAE_JOB_DURATION; LOG.debug("Approximate job submit time is " + jobSubmitTimeMillis + " based on " + lastModTime); return jobSubmitTimeMillis; } JobHistoryRawService(Connection hbaseConnection); List<Scan> getHistoryRawTableScans(String cluster, String minJobId,
      String maxJobId, boolean reprocess, int batchSize); Scan getHistoryRawTableScan(String cluster, String minJobId,
      String maxJobId, boolean reprocess, boolean includeRaw); Configuration getRawJobConfiguration(QualifiedJobId jobId); String getRawJobHistory(QualifiedJobId jobId); byte[] getRawJobHistoryBytes(QualifiedJobId jobId); Configuration createConfigurationFromResult(Result result); byte[] getRowKey(String cluster, String jobId); QualifiedJobId getQualifiedJobIdFromResult(Result result); InputStream getJobHistoryInputStreamFromResult(Result result); Put getJobProcessedSuccessPut(byte[] row, boolean success); long getApproxSubmitTime(Result value); Put getJobSubmitTimePut(byte[] row, long submitTimeMillis); void markJobForReprocesssing(QualifiedJobId jobId); byte[] getJobHistoryRawFromResult(Result value); Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status); boolean getStatusAgg(byte[] row, byte[] col);  }