cecemei commented on code in PR #18366:
URL: https://github.com/apache/druid/pull/18366#discussion_r2257810303


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/resources/SqlStatementResource.java:
##########
@@ -179,18 +178,23 @@ public Response doPost(@Context final HttpServletRequest 
req,
 
   @VisibleForTesting
   Response doPost(
-      SqlQuery sqlQuery, // Not final: reassigned using createModifiedSqlQuery
+      final SqlQuery sqlQuery,
       final HttpServletRequest req
   )
   {
-    final SqlQueryPlus sqlQueryPlus;
+    SqlQueryPlus sqlQueryPlus;
     final HttpStatement stmt;
-    final QueryContext queryContext;
 
     try {
-      sqlQuery = createModifiedSqlQuery(sqlQuery);
-      sqlQueryPlus = SqlResource.makeSqlQueryPlus(sqlQuery, req, 
defaultQueryConfig);
-      queryContext = QueryContext.of(sqlQueryPlus.context());
+      if (sqlQuery.getContext().containsKey(RESULT_FORMAT)) {
+        throw InvalidInput.exception("Query context parameter [%s] is not 
allowed", RESULT_FORMAT);
+      }
+      sqlQueryPlus = SqlResource.makeSqlQueryPlus(sqlQuery, req, 
DefaultQueryConfig.NIL);
+      // Attach system default query config and result format to the context.
+      sqlQueryPlus = sqlQueryPlus.withContext(
+          ImmutableMap.<String, 
Object>builder().putAll(defaultQueryConfig.getContext()).put(RESULT_FORMAT, 
sqlQuery.getResultFormat()).build(),
+          sqlQueryPlus.context()
+      );

Review Comment:
   true, updated the `makeSqlQueryPlus` and make `sqlQueryPlus` final



-- 
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