drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chunhui-shi <...@git.apache.org>
Subject [GitHub] drill pull request #604: DRILL-4862: binary_string should use another buffer...
Date Fri, 07 Oct 2016 01:09:05 GMT
Github user chunhui-shi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/604#discussion_r82315506
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
---
    @@ -1540,15 +1540,16 @@ public void eval() {
       public static class BinaryString implements DrillSimpleFunc {
         @Param  VarCharHolder in;
         @Output VarBinaryHolder out;
    +    @Inject DrillBuf buffer;
     
         @Override
         public void setup() {}
     
         @Override
         public void eval() {
    -      out.buffer = in.buffer;
    -      out.start = in.start;
    -      out.end = org.apache.drill.common.util.DrillStringUtils.parseBinaryString(in.buffer,
in.start, in.end);
    +      out.buffer = buffer.reallocIfNeeded(in.end - in.start);
    +      out.start = out.end = 0;
    +      out.end = org.apache.drill.common.util.DrillStringUtils.parseBinaryString(in.buffer,
in.start, in.end, out.buffer);
           out.buffer.setIndex(out.start, out.end);
    --- End diff --
    
    Yes, we need to set readerIndex and writerIndex. Otherwise if there is another function
consume the output of this function, it will hit error.


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