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

2017-01-13 Thread asfgit
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2016-12-19 Thread bitblender
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));
+
 
-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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


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

2016-12-13 Thread chunhui-shi
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 
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---