drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bitblender <...@git.apache.org>
Subject [GitHub] drill pull request #695: DRILL-4868: fix how hive function set DrillBuf.
Date Mon, 19 Dec 2016 22:26:48 GMT
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.
---

Mime
View raw message