You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by ravipesala <gi...@git.apache.org> on 2016/10/17 18:09:22 UTC

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

GitHub user ravipesala opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/247

    [CARBONDATA-301] Added Sort processor step for data loading.

    Add SortProcessorStep which sorts the data as per dimension order and write the sorted files to temp location and merge sort it.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ravipesala/incubator-carbondata sort-step

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-carbondata/pull/247.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #247
    
----
commit f3d5137b23e2dd0336a5d39bbd79f3c0996bc402
Author: ravipesala <ra...@gmail.com>
Date:   2016-10-17T18:06:37Z

    Added Sort processor step for dataloading.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84492901
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/sortandgroupby/sortdata/SortDataRows.java ---
    @@ -334,24 +151,24 @@ public void startSorting() throws CarbonSortKeyAndGroupByException {
           toSort = new Object[entryCount][];
           System.arraycopy(recordHolderList, 0, toSort, 0, entryCount);
     
    -      if (noDictionaryCount > 0) {
    -        Arrays.sort(toSort, new RowComparator(noDictionaryDimnesionColumn, noDictionaryCount));
    +      if (parameters.getNoDictionaryCount() > 0) {
    +        Arrays.sort(toSort, new RowComparator(parameters.getNoDictionaryDimnesionColumn(),
    +            parameters.getNoDictionaryCount()));
           } else {
     
    -        Arrays.sort(toSort, new RowComparatorForNormalDims(this.dimColCount));
    +        Arrays.sort(toSort, new RowComparatorForNormalDims(parameters.getDimColCount()));
           }
           recordHolderList = toSort;
     
           // create new file
    -      File file =
    -          new File(this.tempFileLocation + File.separator + this.tableName + System.nanoTime() +
    -              CarbonCommonConstants.SORT_TEMP_FILE_EXT);
    +      File file = new File(
    +          parameters.getTempFileLocation() + File.separator + parameters.getTableName() + System
    --- End diff --
    
    move System to next line


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84510340
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/sort/impl/CarbonParallelReadMergeSorterImpl.java ---
    @@ -0,0 +1,223 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.sort.impl;
    +
    +import java.io.File;
    +import java.util.Iterator;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.carbondata.common.CarbonIterator;
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.util.CarbonTimeStatisticsFactory;
    +import org.apache.carbondata.processing.newflow.DataField;
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRow;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.newflow.sort.CarbonSorter;
    +import org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortDataRows;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortIntermediateFileMerger;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +import org.apache.carbondata.processing.store.SingleThreadFinalSortFilesMerger;
    +import org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException;
    +import org.apache.carbondata.processing.util.CarbonDataProcessorUtil;
    +
    +/**
    + * It parallely reads data from array of iterates and do merge sort.
    + * First it sorts the data and write to temp files. These temp files will be merge sorted to get
    + * final merge sort result.
    + */
    +public class CarbonParallelReadMergeSorterImpl implements CarbonSorter {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(CarbonParallelReadMergeSorterImpl.class.getName());
    +
    +  private SortParameters sortParameters;
    +
    +  private SortIntermediateFileMerger intermediateFileMerger;
    +
    +  private ExecutorService executorService;
    +
    +  private SingleThreadFinalSortFilesMerger finalMerger;
    +
    +  private DataField[] inputDataFields;
    +
    +  public CarbonParallelReadMergeSorterImpl(DataField[] inputDataFields) {
    +    this.inputDataFields = inputDataFields;
    +  }
    +
    +  @Override
    +  public void initialize(SortParameters sortParameters) {
    +    this.sortParameters = sortParameters;
    +    intermediateFileMerger = new SortIntermediateFileMerger(sortParameters);
    +    String storeLocation = CarbonDataProcessorUtil
    --- End diff --
    
    I guess PR 217 is not merged and once it is merged those changes would be reflected here. And jira 287 would be sufficient for it.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84491864
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/sortandgroupby/sortdata/SortDataRows.java ---
    @@ -334,24 +151,24 @@ public void startSorting() throws CarbonSortKeyAndGroupByException {
           toSort = new Object[entryCount][];
           System.arraycopy(recordHolderList, 0, toSort, 0, entryCount);
     
    -      if (noDictionaryCount > 0) {
    -        Arrays.sort(toSort, new RowComparator(noDictionaryDimnesionColumn, noDictionaryCount));
    +      if (parameters.getNoDictionaryCount() > 0) {
    +        Arrays.sort(toSort, new RowComparator(parameters.getNoDictionaryDimnesionColumn(),
    +            parameters.getNoDictionaryCount()));
           } else {
     
    --- End diff --
    
    remove empty line


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84490086
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/sort/impl/CarbonParallelReadMergeSorterImpl.java ---
    @@ -0,0 +1,223 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.sort.impl;
    +
    +import java.io.File;
    +import java.util.Iterator;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.carbondata.common.CarbonIterator;
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.util.CarbonTimeStatisticsFactory;
    +import org.apache.carbondata.processing.newflow.DataField;
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRow;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.newflow.sort.CarbonSorter;
    +import org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortDataRows;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortIntermediateFileMerger;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +import org.apache.carbondata.processing.store.SingleThreadFinalSortFilesMerger;
    +import org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException;
    +import org.apache.carbondata.processing.util.CarbonDataProcessorUtil;
    +
    +/**
    + * It parallely reads data from array of iterates and do merge sort.
    + * First it sorts the data and write to temp files. These temp files will be merge sorted to get
    + * final merge sort result.
    + */
    +public class CarbonParallelReadMergeSorterImpl implements CarbonSorter {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(CarbonParallelReadMergeSorterImpl.class.getName());
    +
    +  private SortParameters sortParameters;
    +
    +  private SortIntermediateFileMerger intermediateFileMerger;
    +
    +  private ExecutorService executorService;
    +
    +  private SingleThreadFinalSortFilesMerger finalMerger;
    +
    +  private DataField[] inputDataFields;
    +
    +  public CarbonParallelReadMergeSorterImpl(DataField[] inputDataFields) {
    +    this.inputDataFields = inputDataFields;
    +  }
    +
    +  @Override
    +  public void initialize(SortParameters sortParameters) {
    +    this.sortParameters = sortParameters;
    +    intermediateFileMerger = new SortIntermediateFileMerger(sortParameters);
    +    String storeLocation = CarbonDataProcessorUtil
    --- End diff --
    
    similar feature like #217 should be done. @ravipesala can you create a Jira issue for this?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84510589
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/steps/SortProcessorStepImpl.java ---
    @@ -0,0 +1,79 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.steps;
    +
    +import java.util.Iterator;
    +
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.processing.newflow.AbstractDataLoadProcessorStep;
    +import org.apache.carbondata.processing.newflow.CarbonDataLoadConfiguration;
    +import org.apache.carbondata.processing.newflow.DataField;
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRow;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.newflow.sort.CarbonSorter;
    +import org.apache.carbondata.processing.newflow.sort.impl.CarbonParallelReadMergeSorterImpl;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +
    +/**
    + * It sorts the data and write them to intermediate temp files. These files will be further read
    + * by next step for writing to carbondata files.
    + */
    +public class SortProcessorStepImpl extends AbstractDataLoadProcessorStep {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(SortProcessorStepImpl.class.getName());
    +
    +  private CarbonSorter carbonSorter;
    +
    +  public SortProcessorStepImpl(CarbonDataLoadConfiguration configuration,
    +      AbstractDataLoadProcessorStep child) {
    +    super(configuration, child);
    +  }
    +
    +  @Override public DataField[] getOutput() {
    --- End diff --
    
    ok


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84517789
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/util/RemoveDictionaryUtil.java ---
    @@ -123,6 +123,60 @@ private static int calculateTotalBytes(ByteBuffer[] byteBufferArr) {
       }
     
       /**
    +   * This method will form one single byte [] for all the high card dims.
    --- End diff --
    
    Added description.
    This is just duplicate function to take `byte[][]` instead `ByteBuffer[]'. The other method would be removed at the time of removing kettle.
    The reverse function for this is `splitNoDictionaryKey` method


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-carbondata/pull/247


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84491588
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/steps/SortProcessorStepImpl.java ---
    @@ -0,0 +1,79 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.steps;
    +
    +import java.util.Iterator;
    +
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.processing.newflow.AbstractDataLoadProcessorStep;
    +import org.apache.carbondata.processing.newflow.CarbonDataLoadConfiguration;
    +import org.apache.carbondata.processing.newflow.DataField;
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRow;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.newflow.sort.CarbonSorter;
    +import org.apache.carbondata.processing.newflow.sort.impl.CarbonParallelReadMergeSorterImpl;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +
    +/**
    + * It sorts the data and write them to intermediate temp files. These files will be further read
    + * by next step for writing to carbondata files.
    + */
    +public class SortProcessorStepImpl extends AbstractDataLoadProcessorStep {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(SortProcessorStepImpl.class.getName());
    +
    +  private CarbonSorter carbonSorter;
    +
    +  public SortProcessorStepImpl(CarbonDataLoadConfiguration configuration,
    +      AbstractDataLoadProcessorStep child) {
    +    super(configuration, child);
    +  }
    +
    +  @Override public DataField[] getOutput() {
    --- End diff --
    
    move override to previous line


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84489680
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/sort/impl/CarbonParallelReadMergeSorterImpl.java ---
    @@ -0,0 +1,223 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.sort.impl;
    +
    +import java.io.File;
    +import java.util.Iterator;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.carbondata.common.CarbonIterator;
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.util.CarbonTimeStatisticsFactory;
    +import org.apache.carbondata.processing.newflow.DataField;
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRow;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.newflow.sort.CarbonSorter;
    +import org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortDataRows;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortIntermediateFileMerger;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +import org.apache.carbondata.processing.store.SingleThreadFinalSortFilesMerger;
    +import org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException;
    +import org.apache.carbondata.processing.util.CarbonDataProcessorUtil;
    +
    +/**
    + * It parallely reads data from array of iterates and do merge sort.
    + * First it sorts the data and write to temp files. These temp files will be merge sorted to get
    + * final merge sort result.
    + */
    +public class CarbonParallelReadMergeSorterImpl implements CarbonSorter {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(CarbonParallelReadMergeSorterImpl.class.getName());
    +
    +  private SortParameters sortParameters;
    +
    +  private SortIntermediateFileMerger intermediateFileMerger;
    +
    +  private ExecutorService executorService;
    +
    +  private SingleThreadFinalSortFilesMerger finalMerger;
    +
    +  private DataField[] inputDataFields;
    +
    +  public CarbonParallelReadMergeSorterImpl(DataField[] inputDataFields) {
    +    this.inputDataFields = inputDataFields;
    +  }
    +
    +  @Override
    +  public void initialize(SortParameters sortParameters) {
    +    this.sortParameters = sortParameters;
    +    intermediateFileMerger = new SortIntermediateFileMerger(sortParameters);
    +    String storeLocation = CarbonDataProcessorUtil
    --- End diff --
    
    move `CarbonDataProcessorUtil` to next line and break line in parameters 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84510901
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/util/RemoveDictionaryUtil.java ---
    @@ -123,6 +123,60 @@ private static int calculateTotalBytes(ByteBuffer[] byteBufferArr) {
       }
     
       /**
    +   * This method will form one single byte [] for all the high card dims.
    +   *
    +   * @param byteBufferArr
    +   * @return
    +   */
    --- End diff --
    
    It is named like this long time back. We can remove it at the time of removing kettle based code. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84510667
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/sortandgroupby/sortdata/SortDataRows.java ---
    @@ -334,24 +151,24 @@ public void startSorting() throws CarbonSortKeyAndGroupByException {
           toSort = new Object[entryCount][];
           System.arraycopy(recordHolderList, 0, toSort, 0, entryCount);
     
    -      if (noDictionaryCount > 0) {
    -        Arrays.sort(toSort, new RowComparator(noDictionaryDimnesionColumn, noDictionaryCount));
    +      if (parameters.getNoDictionaryCount() > 0) {
    +        Arrays.sort(toSort, new RowComparator(parameters.getNoDictionaryDimnesionColumn(),
    +            parameters.getNoDictionaryCount()));
           } else {
     
    -        Arrays.sort(toSort, new RowComparatorForNormalDims(this.dimColCount));
    +        Arrays.sort(toSort, new RowComparatorForNormalDims(parameters.getDimColCount()));
           }
           recordHolderList = toSort;
     
           // create new file
    -      File file =
    -          new File(this.tempFileLocation + File.separator + this.tableName + System.nanoTime() +
    -              CarbonCommonConstants.SORT_TEMP_FILE_EXT);
    +      File file = new File(
    +          parameters.getTempFileLocation() + File.separator + parameters.getTableName() + System
    --- End diff --
    
    ok


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84510002
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/sort/CarbonSorter.java ---
    @@ -0,0 +1,56 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.sort;
    +
    +import java.util.Iterator;
    +
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +
    +/**
    + * This interface sorts all the data of iterators.
    + * The life cycle of this interface is initialize -> sort -> close
    + */
    +public interface CarbonSorter {
    --- End diff --
    
    Ok, I will update the name.
    `insertRow` type of interface may not satisfy our need as we required parallel read and sort. Even in current interface also we can sort it on fly. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84515278
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/sort/CarbonSorter.java ---
    @@ -0,0 +1,56 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.sort;
    +
    +import java.util.Iterator;
    +
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +
    +/**
    + * This interface sorts all the data of iterators.
    + * The life cycle of this interface is initialize -> sort -> close
    + */
    +public interface CarbonSorter {
    --- End diff --
    
    a thread-safe insertRow should work right?
    I think it is not good to couple the pulling logic of CarbonRow and sorting logic. The execution of `Iterator<CarbonRowBatch>[]` should be in `SortProcessorStepImpl.execute()`, while sorting logic should be in Sorter. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84245645
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/newflow/steps/sort/SortProcessorStepImpl.java ---
    @@ -0,0 +1,237 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.carbondata.processing.newflow.steps.sort;
    +
    +import java.io.File;
    +import java.util.Iterator;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.carbondata.common.CarbonIterator;
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.util.CarbonTimeStatisticsFactory;
    +import org.apache.carbondata.processing.newflow.AbstractDataLoadProcessorStep;
    +import org.apache.carbondata.processing.newflow.CarbonDataLoadConfiguration;
    +import org.apache.carbondata.processing.newflow.DataField;
    +import org.apache.carbondata.processing.newflow.constants.DataLoadProcessorConstants;
    +import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;
    +import org.apache.carbondata.processing.newflow.row.CarbonRow;
    +import org.apache.carbondata.processing.newflow.row.CarbonRowBatch;
    +import org.apache.carbondata.processing.sortandgroupby.exception.CarbonSortKeyAndGroupByException;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortDataRows;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortIntermediateFileMerger;
    +import org.apache.carbondata.processing.sortandgroupby.sortdata.SortParameters;
    +import org.apache.carbondata.processing.store.SingleThreadFinalSortFilesMerger;
    +import org.apache.carbondata.processing.store.writer.exception.CarbonDataWriterException;
    +import org.apache.carbondata.processing.util.CarbonDataProcessorUtil;
    +
    +/**
    + * It sorts the data and write them to intermediate temp files. These files will be further read
    + * by next step for writing to carbondata files.
    + */
    +public class SortProcessorStepImpl extends AbstractDataLoadProcessorStep {
    --- End diff --
    
    In this step, better to abstract an interface called `Sorter`. We can move current sort implementation (SortDataRows/SortIntermediateFileMerger) into `MergeSortSorter` which implements `Sorter`, and we can add `ExternalSorter` later for in memory sort
    
    So in this class, there will be an member variable called sorter.
    
    Or, we can create another PR to do it if hard to do in one PR


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by ravipesala <gi...@git.apache.org>.
Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84510612
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/sortandgroupby/sortdata/SortDataRows.java ---
    @@ -334,24 +151,24 @@ public void startSorting() throws CarbonSortKeyAndGroupByException {
           toSort = new Object[entryCount][];
           System.arraycopy(recordHolderList, 0, toSort, 0, entryCount);
     
    -      if (noDictionaryCount > 0) {
    -        Arrays.sort(toSort, new RowComparator(noDictionaryDimnesionColumn, noDictionaryCount));
    +      if (parameters.getNoDictionaryCount() > 0) {
    +        Arrays.sort(toSort, new RowComparator(parameters.getNoDictionaryDimnesionColumn(),
    +            parameters.getNoDictionaryCount()));
           } else {
     
    --- End diff --
    
    ok


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84495043
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/util/RemoveDictionaryUtil.java ---
    @@ -123,6 +123,60 @@ private static int calculateTotalBytes(ByteBuffer[] byteBufferArr) {
       }
     
       /**
    +   * This method will form one single byte [] for all the high card dims.
    --- End diff --
    
    Can you describe the format of output byte array?
    It is LV like right? Length in short, then byte array?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-carbondata pull request #247: [CARBONDATA-301] Added Sort processo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/247#discussion_r84494016
  
    --- Diff: processing/src/main/java/org/apache/carbondata/processing/util/RemoveDictionaryUtil.java ---
    @@ -123,6 +123,60 @@ private static int calculateTotalBytes(ByteBuffer[] byteBufferArr) {
       }
     
       /**
    +   * This method will form one single byte [] for all the high card dims.
    +   *
    +   * @param byteBufferArr
    +   * @return
    +   */
    --- End diff --
    
    Why this class is called RemoveDictionaryUtil?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---