コード例 #1
0
 @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);
   }
 }
コード例 #2
0
 @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);
   }
 }