qidaye commented on code in PR #9895: URL: https://github.com/apache/doris/pull/9895#discussion_r910727643
########## fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/QueryBuilders.java: ########## @@ -172,19 +183,65 @@ abstract static class QueryBuilder { * @throws IOException if IO error occurred */ abstract void toJson(JsonGenerator out) throws IOException; + + /** + * Convert query to JSON format and catch error. + **/ + public String toJson() { + StringWriter writer = new StringWriter(); + try { + JsonGenerator gen = mapper.getFactory().createGenerator(writer); + this.toJson(gen); + gen.flush(); + gen.close(); + } catch (IOException e) { + LOG.warn("QueryBuilder toJson error"); Review Comment: The error should print to warn log. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org