[GitHub] incubator-carbondata pull request #278: [CARBONDATA-368]Imporve performance ...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #278: [CARBONDATA-368]Imporve performance ...

qiuchenjian-2
Github user QiangCai commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/278#discussion_r89950862
 
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/csvreaderstep/CsvInput.java ---
    @@ -384,21 +383,75 @@ public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws K
           CarbonTimeStatisticsFactory.getLoadStatisticsInstance().recordCsvInputStepTime(
                   meta.getPartitionID(), System.currentTimeMillis());
         } else {
    -      scanRddIterator();
    +      scanRddIterator(numberOfNodes);
         }
         setOutputDone();
         return false;
       }
     
    -  private void scanRddIterator() throws RuntimeException {
    -    Iterator<String[]> iterator = RddInputUtils.getAndRemove(rddIteratorKey);
    -    if (iterator != null) {
    -      try{
    -        while(iterator.hasNext()){
    -          putRow(data.outputRowMeta, iterator.next());
    +  class RddScanCallable implements Callable<Void> {
    +    List<JavaRddIterator<String[]>> iterList;
    +
    +    RddScanCallable() {
    +      this.iterList = new ArrayList<JavaRddIterator<String[]>>(1000);
    +    }
    +
    +    public void addJavaRddIterator(JavaRddIterator<String[]> iter) {
    +      this.iterList.add(iter);
    +    }
    +
    +    @Override
    +    public Void call() throws Exception {
    +      StandardLogService.setThreadName(("PROCESS_DataFrame_PARTITIONS"),
    +          Thread.currentThread().getName());
    +      try {
    +        String[] values = null;
    +        for (JavaRddIterator<String[]> iter: iterList) {
    +          iter.initialize();
    +          while (iter.hasNext()) {
    +            values = iter.next();
    +            synchronized (putRowLock) {
    +              putRow(data.outputRowMeta, values);
    +            }
    +          }
    +        }
    +      } catch (Exception e) {
    +        LOGGER.error(e, "Scan rdd during data load is terminated due to error.");
    +        throw e;
    +      }
    +      return null;
    +    }
    +  };
    --- End diff --
   
    fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [hidden email] or file a JIRA ticket
with INFRA.
---