cgivre commented on code in PR #2567: URL: https://github.com/apache/drill/pull/2567#discussion_r891318837
########## exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/conv/JsonConvertFrom.java: ########## @@ -32,37 +30,45 @@ import org.apache.drill.exec.expr.holders.NullableVarCharHolder; import org.apache.drill.exec.expr.holders.VarBinaryHolder; import org.apache.drill.exec.expr.holders.VarCharHolder; +import org.apache.drill.exec.physical.resultSet.ResultSetLoader; +import org.apache.drill.exec.server.options.OptionManager; import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter; public class JsonConvertFrom { - static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JsonConvertFrom.class); - private JsonConvertFrom() { } @FunctionTemplate(name = "convert_fromJSON", scope = FunctionScope.SIMPLE, isRandom = true) public static class ConvertFromJson implements DrillSimpleFunc { @Param VarBinaryHolder in; - @Inject DrillBuf buffer; - @Workspace org.apache.drill.exec.vector.complex.fn.JsonReader jsonReader; + @Inject + ResultSetLoader loader; + @Workspace + org.apache.drill.exec.store.easy.json.loader.JsonLoaderImpl.JsonLoaderBuilder jsonLoaderBuilder; + + @Inject + OptionManager options; @Output ComplexWriter writer; @Override public void setup() { - jsonReader = new org.apache.drill.exec.vector.complex.fn.JsonReader.Builder(buffer) - .defaultSchemaPathColumns() - .build(); + jsonLoaderBuilder = new org.apache.drill.exec.store.easy.json.loader.JsonLoaderImpl.JsonLoaderBuilder() + .resultSetLoader(loader) + .standardOptions(options); } @Override public void eval() { try { - jsonReader.setSource(in.start, in.end, in.buffer); - jsonReader.write(writer); - buffer = jsonReader.getWorkBuf(); + jsonLoaderBuilder.fromStream(in.start, in.end, in.buffer); + org.apache.drill.exec.store.easy.json.loader.JsonLoader jsonLoader = jsonLoaderBuilder.build(); + loader.startBatch(); + jsonLoader.readBatch(); + loader.close(); Review Comment: Thanks @vdiravka ! I addressed your change. Once #2568 is merged, I will rebase and hopefully we won't run into any issues. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@drill.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org