core/src/main/java/org/apache/carbondata/core/scan/executor/impl/AbstractQueryExecutor.java
/**
   * Below method will be used to finish the execution
   *
   * @throws QueryExecutionException
   */
Below method will be used to finish the execution
@throws QueryExecutionException
Below method will be used to finish the execution @throws QueryExecutionException
@Override public void finish() throws QueryExecutionException {
    CarbonUtil.clearBlockCache(queryProperties.dataBlocks);
    Throwable exceptionOccurred = null;
    if (null != queryIterator) {
      try {
        queryIterator.close();
      } catch (Throwable e) {
        exceptionOccurred = e;
      }
    }
    UnsafeMemoryManager.INSTANCE.freeMemoryAll(ThreadLocalTaskInfo.getCarbonTaskInfo().getTaskId());
    if (null != queryProperties.executorService) {
      queryProperties.executorService.shutdownNow();
    }
    if (null != exceptionOccurred) {
      throw new QueryExecutionException(exceptionOccurred);
    }
  }
@ Override public void finish ( ) throws QueryExecutionException { CarbonUtil . clearBlockCache ( queryProperties . dataBlocks ) ; Throwable exceptionOccurred = null ; if ( null != queryIterator ) { try { queryIterator . close ( ) ; } catch ( Throwable e ) { exceptionOccurred = e ; } } UnsafeMemoryManager . INSTANCE . freeMemoryAll ( ThreadLocalTaskInfo . getCarbonTaskInfo ( ) . getTaskId ( ) ) ; if ( null != queryProperties . executorService ) { queryProperties . executorService . shutdownNow ( ) ; } if ( null != exceptionOccurred ) { throw new QueryExecutionException ( exceptionOccurred ) ; } }
Below method will be used to finish the execution
 @throws QueryExecutionException
Below method will be used to finish the execution @throws QueryExecutionException
// catch if there is any exception so that it can be rethrown after clearing all the resources // else if any exception is thrown from this point executor service will not be terminated // clear all the unsafe memory used for the given task ID // In case of limit query when number of limit records is already found so executors // must stop all the running execution otherwise it will keep running and will hit // the query performance. // if there is any exception re throw the exception