walterddr commented on code in PR #10336:
URL: https://github.com/apache/pinot/pull/10336#discussion_r1131945053


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java:
##########
@@ -48,6 +48,14 @@ public class RequestUtils {
   private RequestUtils() {
   }
 
+  public static SqlNodeAndOptions parseQuery(String query)
+          throws SqlCompilationException {
+    long parserStartTimeNs = System.nanoTime();
+    SqlNodeAndOptions sqlNodeAndOptions = 
CalciteSqlParser.compileToSqlNodeAndOptions(query);
+    sqlNodeAndOptions.setParseTimeNs(System.nanoTime() - parserStartTimeNs);
+    return sqlNodeAndOptions;
+  }

Review Comment:
   use a `private static final JsonNode EMPTY_OBJECT_NODE = new 
ObjectMapper().createObjectNode();`
   and reuse the parserQuery API to avoid code copy
   ```suggestion
       return parserQuery(query, EMPTY_OBJECT_NODE);
     }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to