You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/06/30 08:10:57 UTC

[GitHub] [doris] qidaye commented on a diff in pull request #9895: [Enhancement](DOE) Step1: Fe generates the DSL and is used to explain

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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org