You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by lion-x <gi...@git.apache.org> on 2016/08/24 06:47:53 UTC

[GitHub] incubator-carbondata pull request #90: [WIP]Fix Bug: Load Decimal Data to Bi...

GitHub user lion-x opened a pull request:

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

    [WIP]Fix Bug: Load Decimal Data to BigInt Column, query is NULL

    

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

    $ git pull https://github.com/lion-x/incubator-carbondata Lionx0824

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

    https://github.com/apache/incubator-carbondata/pull/90.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 #90
    
----
commit 769f79a98c90c3e47227113b4ff6f700d7f2dca5
Author: lion-x <xl...@gmail.com>
Date:   2016-08-24T06:37:22Z

    Fix Bug: Load Decimal Data to BigInt Column, query is NULL

----


---
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 #90: [CARBONDATA-175]Fix Bug: Load Decimal...

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

    https://github.com/apache/incubator-carbondata/pull/90#discussion_r76357638
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -62,7 +62,12 @@ public static Object getMeasureValueBasedOnDataType(String msrValue, DataType da
           case INT:
             return Double.valueOf(msrValue).longValue();
           case LONG:
    -        return Long.valueOf(msrValue);
    +        int index = msrValue.indexOf(".");
    +        if (index != -1) {
    +          return Long.valueOf(msrValue.substring(0,index));
    +        } else {
    +          return Long.valueOf(msrValue);
    +        }
    --- End diff --
    
    @lion-x @manishgupta88 What about hive's behavior for this issue?


---
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 #90: [CARBONDATA-175]Fix Bug: Load Decimal...

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

    https://github.com/apache/incubator-carbondata/pull/90#discussion_r76195202
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -62,7 +62,12 @@ public static Object getMeasureValueBasedOnDataType(String msrValue, DataType da
           case INT:
             return Double.valueOf(msrValue).longValue();
           case LONG:
    -        return Long.valueOf(msrValue);
    +        int index = msrValue.indexOf(".");
    +        if (index != -1) {
    +          return Long.valueOf(msrValue.substring(0,index));
    +        } else {
    +          return Long.valueOf(msrValue);
    +        }
    --- End diff --
    
    @manishgupta88 Hi, in this PR, I want to solve the problem described as below:
    
    when the Loding msrValue is decimal like "3.1415926" and the column type is Long, the original flow will not work well. It will return us a null value.


---
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 #90: [CARBONDATA-175]Fix Bug: Load Decimal...

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

    https://github.com/apache/incubator-carbondata/pull/90#discussion_r76028231
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -62,7 +62,12 @@ public static Object getMeasureValueBasedOnDataType(String msrValue, DataType da
           case INT:
             return Double.valueOf(msrValue).longValue();
           case LONG:
    -        return Long.valueOf(msrValue);
    +        int index = msrValue.indexOf(".");
    +        if (index != -1) {
    +          return Long.valueOf(msrValue.substring(0,index));
    +        } else {
    +          return Long.valueOf(msrValue);
    +        }
    --- End diff --
    
    @lion-x ...keep the code same for INT and LONG datatype case...i think instead of writing this code, that would be better. Sample code as below
    case INT:
    case LONG:
      return Double.valueOf(msrValue).longValue();


---
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 #90: [CARBONDATA-175]Fix Bug: Load Decimal...

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

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


---
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 #90: [CARBONDATA-175]Fix Bug: Load Decimal...

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

    https://github.com/apache/incubator-carbondata/pull/90#discussion_r76257293
  
    --- Diff: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java ---
    @@ -62,7 +62,12 @@ public static Object getMeasureValueBasedOnDataType(String msrValue, DataType da
           case INT:
             return Double.valueOf(msrValue).longValue();
           case LONG:
    -        return Long.valueOf(msrValue);
    +        int index = msrValue.indexOf(".");
    +        if (index != -1) {
    +          return Long.valueOf(msrValue.substring(0,index));
    +        } else {
    +          return Long.valueOf(msrValue);
    +        }
    --- End diff --
    
    @lion-x ...It is a correct behavior to return null value in this case as our validation is strict. If any column which has BigInt datatype is included as dimension then also we make decimal value as null because of strict validation. 
    That is why I suggested that dont change the behavior for Long parsing, instead change the parsing logic for Int datatype to keep the strict validation behavior.


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