clintropolis commented on code in PR #12709:
URL: https://github.com/apache/druid/pull/12709#discussion_r922450740


##########
sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java:
##########
@@ -229,26 +235,19 @@ public StatementHandle prepare(
   )
   {
     try {
-      final StatementHandle statement = createStatement(ch);
-      final DruidStatement druidStatement;
-      try {
-        druidStatement = getDruidStatement(statement);
-      }
-      catch (NoSuchStatementException e) {
-        throw logFailure(new ISE(e, e.getMessage()));
-      }
-      final DruidConnection druidConnection = 
getDruidConnection(statement.connectionId);
-      AuthenticationResult authenticationResult = 
authenticateConnection(druidConnection);
-      if (authenticationResult == null) {
-        throw logFailure(
-            new ForbiddenException("Authentication failed."),
-            "Authentication failed for statement[%s]",
-            druidStatement.getStatementId()
-        );
-      }
-      statement.signature = druidStatement.prepare(sql, maxRowCount, 
authenticationResult).getSignature();
-      LOG.debug("Successfully prepared statement[%s] for execution", 
druidStatement.getStatementId());
-      return statement;
+      final DruidConnection druidConnection = getDruidConnection(ch.id);
+      SqlQueryPlus sqlReq = new SqlQueryPlus(
+          sql,
+          null, // Context provided by connection
+          null, // No parameters in this path
+          doAuthenticate(druidConnection)
+      );
+      DruidJdbcPreparedStatement stmt = 
getDruidConnection(ch.id).createPreparedStatement(

Review Comment:
   use `druidConnection` instead of calling `getDruidConnection` again?



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