[GitHub] incubator-carbondata pull request #338: [WIP]Implement BigInt value compress...

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [WIP]Implement BigInt value compress...

qiuchenjian-2
GitHub user ashokblend opened a pull request:

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

    [WIP]Implement BigInt value compression

    Be sure to do all of the following to help us incorporate your contribution
    quickly and easily:
   
     - [ ] Make sure the PR title is formatted like:
       `[CARBONDATA-<Jira issue #>] Description of pull request`
     - [ ] Make sure tests pass via `mvn clean verify`. (Even better, enable
           Travis-CI on your fork and ensure the whole test matrix passes).
     - [ ] Replace `<Jira issue #>` in the title with the actual Jira issue
           number, if there is one.
     - [ ] If this contribution is large, please file an Apache
           [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.txt).
     - [ ] Testing done
     
            Please provide details on
            - Whether new unit test cases have been added or why no new tests are required?
            - What manual testing you have done?
            - Any additional information to help reviewers in testing this change.
             
     - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
                     
    ---
   


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

    $ git pull https://github.com/ashokblend/incubator-carbondata bigintcompression

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

    https://github.com/apache/incubator-carbondata/pull/338.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 #338
   
----
commit 32f7a4c2a4d3a7b864121030505e7ee90c039372
Author: Ashok Kumar <[hidden email]>
Date:   2016-07-23T19:13:58Z

    Implement BigInt value compression

----


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [WIP]Implement BigInt value compression

qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    @ashokblend please correct PR title like : [CARBONDATA-<Jira issue #>] Description of pull request.
   
    The below checklist is for your reference,don't need copy it as description content, please remove it.
    ----------------------------------------------------------
    Be sure to do all of the following to help us incorporate your contribution
    quickly and easily:
   
     Make sure the PR title is formatted like:
    [CARBONDATA-<Jira issue #>] Description of pull request
   
     Make sure tests pass via mvn clean verify. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
   
     Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
   
     If this contribution is large, please file an Apache
    Individual Contributor License Agreement.
   
     Testing done
   
     Please provide details on
     - Whether new unit test cases have been added or why no new tests are required?
     - What manual testing you have done?
     - Any additional information to help reviewers in testing this change.
     For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [CARBONDATA-100]Implement BigInt val...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/338#discussion_r90393993
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/compression/BigIntCompressor.java ---
    @@ -0,0 +1,134 @@
    +/*
    + * 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.core.compression;
    +
    +import org.apache.carbondata.core.datastorage.store.dataholder.CarbonWriteDataHolder;
    +import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
    +
    +/**
    + * It compresses big int data
    + */
    +public class BigIntCompressor extends ValueCompressor {
    +
    +  @Override protected Object compressNonDecimalMaxMin(DataType changedDataType,
    +      CarbonWriteDataHolder dataHolder, int decimal, Object max) {
    +    // in case if bigint, decimal will be 0
    +    return compressMaxMin(changedDataType, dataHolder, max);
    +  }
    +
    +  @Override
    +  protected Object compressNonDecimal(DataType changedDataType, CarbonWriteDataHolder dataHolder,
    +      int decimal) {
    +    // in case if bigint, decimal will be 0
    +    return compressNone(changedDataType, dataHolder);
    +  }
    +
    +  @Override
    +  protected Object compressMaxMin(DataType changedDataType, CarbonWriteDataHolder dataHolder,
    +      Object max) {
    +    long maxValue = (long) max;
    +    long[] value = dataHolder.getWritableLongValues();
    +    int i = 0;
    +    switch (changedDataType) {
    +      case DATA_BYTE:
    +
    +        byte[] result = new byte[value.length];
    +        for (long a : value) {
    +          result[i] = (byte) (maxValue - a);
    +          i++;
    +        }
    +        return result;
    +
    +      case DATA_SHORT:
    +
    +        short[] shortResult = new short[value.length];
    +
    +        for (long a : value) {
    +          shortResult[i] = (short) (maxValue - a);
    +          i++;
    +        }
    +        return shortResult;
    +
    +      case DATA_INT:
    +
    +        int[] intResult = new int[value.length];
    +
    +        for (long a : value) {
    +          intResult[i] = (int) (maxValue - a);
    +          i++;
    +        }
    +        return intResult;
    +
    +      default:
    +
    --- End diff --
   
    remove all empty lines in this function, like after `case` there should not have 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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [CARBONDATA-100]Implement BigInt val...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/338#discussion_r90394339
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/compression/BigIntCompressor.java ---
    @@ -0,0 +1,134 @@
    +/*
    + * 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.core.compression;
    +
    +import org.apache.carbondata.core.datastorage.store.dataholder.CarbonWriteDataHolder;
    +import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
    +
    +/**
    + * It compresses big int data
    + */
    +public class BigIntCompressor extends ValueCompressor {
    +
    +  @Override protected Object compressNonDecimalMaxMin(DataType changedDataType,
    +      CarbonWriteDataHolder dataHolder, int decimal, Object max) {
    +    // in case if bigint, decimal will be 0
    +    return compressMaxMin(changedDataType, dataHolder, max);
    +  }
    +
    +  @Override
    +  protected Object compressNonDecimal(DataType changedDataType, CarbonWriteDataHolder dataHolder,
    +      int decimal) {
    +    // in case if bigint, decimal will be 0
    +    return compressNone(changedDataType, dataHolder);
    +  }
    +
    +  @Override
    +  protected Object compressMaxMin(DataType changedDataType, CarbonWriteDataHolder dataHolder,
    +      Object max) {
    +    long maxValue = (long) max;
    +    long[] value = dataHolder.getWritableLongValues();
    +    int i = 0;
    +    switch (changedDataType) {
    +      case DATA_BYTE:
    --- End diff --
   
    can we use the data type enum defined by `org.apache.carbondata.core.carbon.metadata.datatype.DataType`
    do not create another one


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [CARBONDATA-100]Implement BigInt val...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/338#discussion_r90397522
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/compression/BigIntCompressor.java ---
    @@ -0,0 +1,134 @@
    +/*
    + * 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.core.compression;
    +
    +import org.apache.carbondata.core.datastorage.store.dataholder.CarbonWriteDataHolder;
    +import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
    +
    +/**
    + * It compresses big int data
    + */
    +public class BigIntCompressor extends ValueCompressor {
    +
    +  @Override protected Object compressNonDecimalMaxMin(DataType changedDataType,
    +      CarbonWriteDataHolder dataHolder, int decimal, Object max) {
    +    // in case if bigint, decimal will be 0
    +    return compressMaxMin(changedDataType, dataHolder, max);
    +  }
    +
    +  @Override
    +  protected Object compressNonDecimal(DataType changedDataType, CarbonWriteDataHolder dataHolder,
    +      int decimal) {
    +    // in case if bigint, decimal will be 0
    +    return compressNone(changedDataType, dataHolder);
    +  }
    +
    +  @Override
    +  protected Object compressMaxMin(DataType changedDataType, CarbonWriteDataHolder dataHolder,
    +      Object max) {
    +    long maxValue = (long) max;
    +    long[] value = dataHolder.getWritableLongValues();
    +    int i = 0;
    +    switch (changedDataType) {
    +      case DATA_BYTE:
    +
    +        byte[] result = new byte[value.length];
    +        for (long a : value) {
    +          result[i] = (byte) (maxValue - a);
    +          i++;
    +        }
    +        return result;
    +
    +      case DATA_SHORT:
    +
    +        short[] shortResult = new short[value.length];
    +
    +        for (long a : value) {
    +          shortResult[i] = (short) (maxValue - a);
    +          i++;
    +        }
    +        return shortResult;
    +
    +      case DATA_INT:
    +
    +        int[] intResult = new int[value.length];
    +
    +        for (long a : value) {
    +          intResult[i] = (int) (maxValue - a);
    +          i++;
    +        }
    +        return intResult;
    +
    +      default:
    +
    +        long[] defaultResult = new long[value.length];
    +
    +        for (long a : value) {
    +          defaultResult[i] = (long) (maxValue - a);
    +          i++;
    +        }
    +        return defaultResult;
    +
    +    }
    +  }
    +
    +  @Override
    +  protected Object compressNone(DataType changedDataType, CarbonWriteDataHolder dataHolder) {
    +    long[] value = dataHolder.getWritableLongValues();
    +    int i = 0;
    +    switch (changedDataType) {
    +
    +      case DATA_BYTE:
    +
    +        byte[] result = new byte[value.length];
    +
    +        for (long a : value) {
    --- End diff --
   
    This value array maybe big, so better to use
    ` int length = value.length
       byte[] result = new byte[length]
       for (int i = 0; i < length; i++} {
          result[i] = (byte)a;
      }
    `


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [CARBONDATA-100]Implement BigInt val...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/338#discussion_r90397726
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/compression/DoubleCompressor.java ---
    @@ -0,0 +1,307 @@
    +/*
    + * 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.core.compression;
    +
    +import java.math.BigDecimal;
    +
    +import org.apache.carbondata.core.datastorage.store.dataholder.CarbonWriteDataHolder;
    +import org.apache.carbondata.core.util.ValueCompressionUtil.DataType;
    +
    +/**
    + * Double compressor
    + */
    +public class DoubleCompressor extends ValueCompressor {
    +
    +  @Override protected Object compressNonDecimalMaxMin(DataType changedDataType,
    +      CarbonWriteDataHolder dataHolder, int decimal, Object maxValue) {
    +    int i = 0;
    +    BigDecimal max = BigDecimal.valueOf((double)maxValue);
    +    double[] value = dataHolder.getWritableDoubleValues();
    +    switch (changedDataType) {
    +      case DATA_BYTE:
    +        byte[] result = new byte[value.length];
    +
    --- 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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [CARBONDATA-100]Implement BigInt val...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/338#discussion_r90398660
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/ValueCompressionUtil.java ---
    @@ -243,6 +261,20 @@ public static Object getCompressedValues(COMPRESSION_TYPE compType, long[] value
         }
       }
     
    +  /**
    +   *
    --- End diff --
   
    please describe this function


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [CARBONDATA-100]Implement BigInt value comp...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ashokblend commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    all review comments are fixed. Please check.
    CI Build url
    http://136.243.101.176:8080/job/ApacheCarbonManualPRBuilder/722/


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [CARBONDATA-100]Implement BigInt value comp...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    Thanks for working 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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [CARBONDATA-100]Implement BigInt value comp...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    LGTM


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [CARBONDATA-100]Implement BigInt value comp...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    LGTM


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [CARBONDATA-100]Implement BigInt value comp...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    LGTM


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata issue #338: [CARBONDATA-100]Implement BigInt value comp...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/338
 
    LGTM


---
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.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] incubator-carbondata pull request #338: [CARBONDATA-100]Implement BigInt val...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user asfgit closed the pull request at:

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


---
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.
---