yashmayya commented on code in PR #13746: URL: https://github.com/apache/pinot/pull/13746#discussion_r1771565589
########## pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotClientRequest.java: ########## @@ -236,6 +243,78 @@ public void processSqlWithMultiStageQueryEnginePost(String query, @Suspended Asy } } + @POST + @Produces(MediaType.APPLICATION_JSON) + @Path("query/compare") + @ApiOperation(value = "Query Pinot using both the single-stage query engine and the multi-stage query engine and " + + "compare the results. The 'sql' field should be set in the request JSON to run the same query on both the " + + "query engines. Set '" + Request.V1SQL + "' and '" + Request.V2SQL + "' if the query needs to be adapted for " + + "the two query engines.") + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Query result comparison response"), + @ApiResponse(code = 500, message = "Internal Server Error") + }) + @ManualAuthorization + public void processSqlQueryWithBothEnginesAndCompareResults(String query, @Suspended AsyncResponse asyncResponse, + @Context org.glassfish.grizzly.http.server.Request requestContext, + @Context HttpHeaders httpHeaders) { + try { + JsonNode requestJson = JsonUtils.stringToJsonNode(query); + String v1Query; + String v2Query; + if (requestJson.has(Request.SQL)) { + v1Query = requestJson.get(Request.SQL).asText(); + v2Query = v1Query; + } else if (requestJson.has(Request.V1SQL) && requestJson.has(Request.V2SQL)) { + v1Query = requestJson.get(Request.V1SQL).asText(); + v2Query = requestJson.get(Request.V2SQL).asText(); + } else { + throw new IllegalStateException("Payload should either contain the query string field '" + Request.SQL + "' " + + "or both of '" + Request.V1SQL + "' and '" + Request.V2SQL + "'"); + } Review Comment: Makes sense, I've added this fallback although I haven't updated the API doc in order to avoid making it too confusing. -- 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...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org