processing/src/main/java/org/apache/carbondata/processing/loading/sort/unsafe/UnsafeSortDataRows.java
/**
   * This method will be used to add new row
   */
This method will be used to add new row
This method will be used to add new row
public void addRow(Object[] row) throws CarbonSortKeyAndGroupByException {
    if (rowPage.canAdd()) {
      rowPage.addRow(row);
    } else {
      try {
        if (enableInMemoryIntermediateMerge) {
          unsafeInMemoryIntermediateFileMerger.startInmemoryMergingIfPossible();
        }
        unsafeInMemoryIntermediateFileMerger.startFileMergingIfPossible();
        semaphore.acquire();
        dataSorterAndWriterExecutorService.submit(new DataSorterAndWriter(rowPage));
        MemoryBlock memoryBlock =
            UnsafeMemoryManager.allocateMemoryWithRetry(this.taskId, inMemoryChunkSize);
        boolean saveToDisk = UnsafeSortMemoryManager.INSTANCE.isMemoryAvailable(memoryBlock.size());
        if (!saveToDisk) {
          UnsafeSortMemoryManager.INSTANCE.allocateDummyMemory(memoryBlock.size());
        }
        rowPage = new UnsafeCarbonRowPage(
            parameters.getNoDictionaryDimnesionColumn(),
            parameters.getNoDictionarySortColumn(),
            parameters.getDimColCount(), parameters.getMeasureColCount(),
            parameters.getMeasureDataType(), memoryBlock,
            saveToDisk, taskId);
        rowPage.addRow(row);
      } catch (Exception e) {
        LOGGER.error(
            "exception occurred while trying to acquire a semaphore lock: " + e.getMessage());
        throw new CarbonSortKeyAndGroupByException(e);
      }
    }
  }
public void addRow ( Object [ ] row ) throws CarbonSortKeyAndGroupByException { if ( rowPage . canAdd ( ) ) { rowPage . addRow ( row ) ; } else { try { if ( enableInMemoryIntermediateMerge ) { unsafeInMemoryIntermediateFileMerger . startInmemoryMergingIfPossible ( ) ; } unsafeInMemoryIntermediateFileMerger . startFileMergingIfPossible ( ) ; semaphore . acquire ( ) ; dataSorterAndWriterExecutorService . submit ( new DataSorterAndWriter ( rowPage ) ) ; MemoryBlock memoryBlock = UnsafeMemoryManager . allocateMemoryWithRetry ( this . taskId , inMemoryChunkSize ) ; boolean saveToDisk = UnsafeSortMemoryManager . INSTANCE . isMemoryAvailable ( memoryBlock . size ( ) ) ; if ( ! saveToDisk ) { UnsafeSortMemoryManager . INSTANCE . allocateDummyMemory ( memoryBlock . size ( ) ) ; } rowPage = new UnsafeCarbonRowPage ( parameters . getNoDictionaryDimnesionColumn ( ) , parameters . getNoDictionarySortColumn ( ) , parameters . getDimColCount ( ) , parameters . getMeasureColCount ( ) , parameters . getMeasureDataType ( ) , memoryBlock , saveToDisk , taskId ) ; rowPage . addRow ( row ) ; } catch ( Exception e ) { LOGGER . error ( "exception occurred while trying to acquire a semaphore lock: " + e . getMessage ( ) ) ; throw new CarbonSortKeyAndGroupByException ( e ) ; } } }
This method will be used to add new row
This method will be used to add new row
// if record holder list size is equal to sort buffer size then it will // sort the list and then write current list data to file