@Override
 public Partition[] getPartitions() {
   AnalyticsDataResponse resp;
   try {
     resp =
         ServiceHolder.getAnalyticsDataService()
             .get(
                 this.tenantId,
                 this.tableName,
                 computePartitions(),
                 this.allColumns,
                 timeFrom,
                 timeTo,
                 0,
                 -1);
   } catch (AnalyticsException e) {
     throw new RuntimeException(e.getMessage(), e);
   }
   RecordGroup[] rgs = resp.getRecordGroups();
   Partition[] result = new Partition[rgs.length];
   for (int i = 0; i < result.length; i++) {
     result[i] = new AnalyticsPartition(resp.getRecordStoreName(), rgs[i], i);
   }
   return result;
 }
 private void updateIncProcessingTS() {
   try {
     long existingIncTS =
         ServiceHolder.getIncrementalMetaStore()
             .getLastProcessedTimestamp(this.tenantId, this.incID, false);
     if (existingIncTS < this.incMaxTS) {
       ServiceHolder.getIncrementalMetaStore()
           .setLastProcessedTimestamp(this.tenantId, this.incID, this.incMaxTS, false);
     }
   } catch (AnalyticsException e) {
     throw new RuntimeException(e.getMessage(), e);
   }
 }
 @SuppressWarnings({"rawtypes", "unchecked"})
 @Override
 public scala.collection.Iterator<Row> compute(Partition split, TaskContext context) {
   AnalyticsPartition partition = (AnalyticsPartition) split;
   try {
     Iterator<Record> recordsItr =
         ServiceHolder.getAnalyticsDataService()
             .readRecords(partition.getRecordStoreName(), partition.getRecordGroup());
     return new InterruptibleIterator(
         context,
         asScalaIterator(
             new RowRecordIteratorAdaptor(recordsItr, this.tenantId, this.incEnable, this.incID)));
   } catch (AnalyticsException e) {
     throw new RuntimeException(e.getMessage(), e);
   }
 }
 @Override
 public Seq<String> getPreferredLocations(Partition split) {
   if (split instanceof AnalyticsPartition) {
     AnalyticsPartition ap = (AnalyticsPartition) split;
     try {
       return JavaConversions.asScalaBuffer(Arrays.asList(ap.getRecordGroup().getLocations()))
           .toList();
     } catch (AnalyticsException e) {
       log.error(
           "Error in getting preffered location: "
               + e.getMessage()
               + " falling back to default impl.",
           e);
       return super.getPreferredLocations(split);
     }
   } else {
     return super.getPreferredLocations(split);
   }
 }