Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2850#discussion_r229183179
  
    --- Diff: 
store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReader.java ---
    @@ -114,6 +117,43 @@ public static CarbonReaderBuilder builder(String 
tablePath) {
         return builder(tablePath, tableName);
       }
     
    +  /**
    +   * Return a new list of {@link CarbonReader} objects
    +   *
    +   * @param maxSplits
    +   */
    +  public List<CarbonReader> split(int maxSplits) throws IOException {
    +    validateReader();
    +    if (maxSplits < 1) {
    +      throw new RuntimeException(
    +          this.getClass().getSimpleName() + ".split: maxSplits must be 
positive");
    +    }
    +
    +    List<CarbonReader> carbonReaders = new ArrayList<>();
    +
    +    // If maxSplits < readers.size
    +    // Split the reader into maxSplits splits with each
    +    // element contains >= 1 CarbonRecordReader objects
    +    if (maxSplits < this.readers.size()) {
    +      for (int i = 0; i < maxSplits; ++i) {
    +        carbonReaders.add(new CarbonReader<>(this.readers
    +            .subList((int) Math.ceil((float) (i * this.readers.size()) / 
maxSplits),
    --- End diff --
    
    this is constant, do this outside loop and use it each time


---

Reply via email to