You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by chunhui-shi <gi...@git.apache.org> on 2016/12/14 01:11:20 UTC

[GitHub] drill pull request #695: DRILL-4868: fix how hive function set DrillBuf.

GitHub user chunhui-shi opened a pull request:

    https://github.com/apache/drill/pull/695

    DRILL-4868: fix how hive function set DrillBuf.

    

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

    $ git pull https://github.com/chunhui-shi/drill DRILL-4868

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

    https://github.com/apache/drill/pull/695.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 #695
    
----
commit 54334558b63c4f15e66bbb88f639911d56e04cb9
Author: chunhui-shi <cs...@maprtech.com>
Date:   2016-12-13T23:16:40Z

    DRILL-4868: fix how hive function set DrillBuf.

----


---
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] drill pull request #695: DRILL-4868: fix how hive function set DrillBuf.

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

    https://github.com/apache/drill/pull/695#discussion_r93133495
  
    --- Diff: contrib/storage-hive/core/src/main/codegen/templates/ObjectInspectorHelper.java ---
    @@ -172,48 +172,35 @@ public static JBlock getDrillObject(JCodeModel m, ObjectInspector oi,
                 booleanJC._then().assign(returnValueHolder.ref("value"), JExpr.lit(1));
                 booleanJC._else().assign(returnValueHolder.ref("value"), JExpr.lit(0));
     
    -          <#elseif entry.hiveType == "VARCHAR">
    -            JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    -              castedOI.invoke("getPrimitiveJavaObject").arg(returnValue)
    +          <#elseif entry.hiveType == "VARCHAR" || entry.hiveType == "CHAR" || entry.hiveType == "STRING" || entry.hiveType == "BINARY">
    +            <#if entry.hiveType == "VARCHAR">
    +              JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    +                  castedOI.invoke("getPrimitiveJavaObject").arg(returnValue)
                           .invoke("getValue")
                           .invoke("getBytes"));
    -
    -            jc._else().add(returnValueHolder.ref("buffer")
    -              .invoke("setBytes").arg(JExpr.lit(0)).arg(data));
    -
    -
    -            jc._else().assign(returnValueHolder.ref("start"), JExpr.lit(0));
    -            jc._else().assign(returnValueHolder.ref("end"), data.ref("length"));
    -
                 <#elseif entry.hiveType == "CHAR">
                     JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    -                castedOI.invoke("getPrimitiveJavaObject").arg(returnValue)
    -                    .invoke("getStrippedValue")
    -                    .invoke("getBytes"));
    -
    -            jc._else().add(returnValueHolder.ref("buffer")
    -                .invoke("setBytes").arg(JExpr.lit(0)).arg(data));
    -
    -
    -            jc._else().assign(returnValueHolder.ref("start"), JExpr.lit(0));
    -            jc._else().assign(returnValueHolder.ref("end"), data.ref("length"));
    -
    -          <#elseif entry.hiveType == "STRING">
    -            JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    -              castedOI.invoke("getPrimitiveJavaObject").arg(returnValue)
    +                    castedOI.invoke("getPrimitiveJavaObject").arg(returnValue)
    +                        .invoke("getStrippedValue")
    +                        .invoke("getBytes"));
    +            <#elseif entry.hiveType == "STRING">
    +              JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    +                  castedOI.invoke("getPrimitiveJavaObject").arg(returnValue)
                           .invoke("getBytes"));
    -            jc._else().add(returnValueHolder.ref("buffer")
    -              .invoke("setBytes").arg(JExpr.lit(0)).arg(data));
    -            jc._else().assign(returnValueHolder.ref("start"), JExpr.lit(0));
    -            jc._else().assign(returnValueHolder.ref("end"), data.ref("length"));
    -          <#elseif entry.hiveType == "BINARY">
    +            <#elseif entry.hiveType == "BINARY">
    +                JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    +                    castedOI.invoke("getPrimitiveJavaObject").arg(returnValue));
    +            </#if>
     
    -            JVar data = jc._else().decl(m.directClass(byte[].class.getCanonicalName()), "data",
    -              castedOI.invoke("getPrimitiveJavaObject").arg(returnValue));
    -            jc._else().add(returnValueHolder.ref("buffer")
    +            JConditional jnullif = jc._else()._if(data.eq(JExpr._null()));
    +            jnullif._then().assign(returnValueHolder.ref("isSet"), JExpr.lit(0));
    --- End diff --
    
    Why is isSet set to 0 here ?


---
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] drill issue #695: DRILL-4868: fix how hive function set DrillBuf.

Posted by parthchandra <gi...@git.apache.org>.
Github user parthchandra commented on the issue:

    https://github.com/apache/drill/pull/695
  
    +1


---
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] drill pull request #695: DRILL-4868: fix how hive function set DrillBuf.

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

    https://github.com/apache/drill/pull/695


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