FrankChen021 commented on code in PR #19231:
URL: https://github.com/apache/druid/pull/19231#discussion_r3241287714


##########
sql/src/main/java/org/apache/druid/sql/PreparedStatement.java:
##########
@@ -31,14 +31,25 @@
 public class PreparedStatement extends AbstractStatement
 {
   private final SqlQueryPlus originalRequest;
+  private final String remoteAddress;
 
   public PreparedStatement(
       final SqlToolbox lifecycleToolbox,
       final SqlQueryPlus queryPlus
   )
+  {
+    this(lifecycleToolbox, queryPlus, null);
+  }
+
+  public PreparedStatement(
+      final SqlToolbox lifecycleToolbox,
+      final SqlQueryPlus queryPlus,
+      final String remoteAddress
+  )
   {
     super(lifecycleToolbox, queryPlus, null);

Review Comment:
   [P2] Pass remoteAddress into the PreparedStatement reporter
   
   The Avatica path now passes remoteAddress into the PreparedStatement 
constructor, but the constructor still calls super(lifecycleToolbox, queryPlus, 
null), so the PreparedStatement own SqlExecutionReporter is created without the 
address. DruidJdbcPreparedStatement.close() later calls sqlStatement.close(), 
which emits the prepare-phase SQL log and metrics, so prepared-statement 
prepare logs still contain an empty remoteAddress even though execution logs 
have it. Pass remoteAddress to super here and tighten the prepared-statement 
test to assert the relevant log entries all carry a remote address.



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