Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1026#discussion_r150359565
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertFrom.java
 ---
    @@ -91,4 +92,60 @@ public void eval(){
         }
       }
     
    +  @FunctionTemplate(name = "convert_fromJSON", scope = 
FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL, isRandom = true)
    +  public static class ConvertFromJsonVarcharNonNumerics implements 
DrillSimpleFunc{
    +
    +    @Param VarCharHolder in;
    +    @Param BitHolder enableNonNumeric;
    +    @Inject DrillBuf buffer;
    +    @Workspace org.apache.drill.exec.vector.complex.fn.JsonReader 
jsonReader;
    +
    +    @Output ComplexWriter writer;
    +
    +    public void setup(){
    +      jsonReader = new 
org.apache.drill.exec.vector.complex.fn.JsonReader(buffer, false, false, 
false,/* do not read numbers as doubles */
    +          enableNonNumeric.value == 1);
    +    }
    +
    +    public void eval(){
    +      try {
    +        jsonReader.setSource(in.start, in.end, in.buffer);
    +        jsonReader.write(writer);
    +        buffer = jsonReader.getWorkBuf();
    +
    +      } catch (Exception e) {
    +        throw new 
org.apache.drill.common.exceptions.DrillRuntimeException("Error while 
converting from JSON. ", e);
    +      }
    +    }
    +  }
    +
    +  @FunctionTemplate(name = "convert_fromJSON", scope = 
FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL, isRandom = true)
    +  public static class ConvertFromJsonNonNumerics implements 
DrillSimpleFunc{
    +
    +    @Param VarBinaryHolder in;
    +    @Param BitHolder enableNonNumeric;
    +    @Inject DrillBuf buffer;
    +    @Workspace org.apache.drill.exec.vector.complex.fn.JsonReader 
jsonReader;
    +
    +    @Output ComplexWriter writer;
    +
    +    public void setup(){
    +      jsonReader = new 
org.apache.drill.exec.vector.complex.fn.JsonReader(buffer, false, false, false, 
/* do not read numbers as doubles */
    --- End diff --
    
    See above. We really don't want all these duplicate copies.


---

Reply via email to