drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #1026: DRILL-5919: Add non-numeric support for JSON proce...
Date Fri, 10 Nov 2017 23:48:07 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1026#discussion_r150359625
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertTo.java
---
    @@ -90,7 +91,71 @@ public void eval(){
     
           java.io.ByteArrayOutputStream stream = new java.io.ByteArrayOutputStream();
           try {
    -        org.apache.drill.exec.vector.complex.fn.JsonWriter jsonWriter = new org.apache.drill.exec.vector.complex.fn.JsonWriter(stream,
true, true);
    +        org.apache.drill.exec.vector.complex.fn.JsonWriter jsonWriter = new org.apache.drill.exec.vector.complex.fn.JsonWriter(stream,
true, true, false);
    +
    +        jsonWriter.write(input);
    +      } catch (Exception e) {
    +        throw new RuntimeException(e);
    +      }
    +
    +      byte [] bytea = stream.toByteArray();
    +
    +      out.buffer = buffer = buffer.reallocIfNeeded(bytea.length);
    +      out.buffer.setBytes(0, bytea);
    +      out.end = bytea.length;
    +    }
    +  }
    +
    +  @FunctionTemplate(names = { "convert_toJSON", "convert_toSIMPLEJSON" } , scope = FunctionScope.SIMPLE,
nulls = NullHandling.NULL_IF_NULL)
    +  public static class ConvertToJsonNonNumeric implements DrillSimpleFunc{
    +
    +    @Param FieldReader input;
    +    @Param BitHolder nonNumeric;
    +    @Output VarBinaryHolder out;
    +    @Inject DrillBuf buffer;
    +
    +    public void setup(){
    +    }
    +
    +    public void eval(){
    +      out.start = 0;
    +
    +      java.io.ByteArrayOutputStream stream = new java.io.ByteArrayOutputStream();
    +      try {
    +        org.apache.drill.exec.vector.complex.fn.JsonWriter jsonWriter = new org.apache.drill.exec.vector.complex.fn.JsonWriter(stream,
true, false,
    --- End diff --
    
    More copies.


---

Mime
View raw message