iaorekhov-1980 commented on code in PR #62141:
URL: https://github.com/apache/doris/pull/62141#discussion_r3112079771


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterUserCommand.java:
##########
@@ -29,7 +29,7 @@
 /**
  * AlterUserCommand
  */
-public class AlterUserCommand extends AlterCommand {
+public class AlterUserCommand extends AlterCommand implements 
NeedAuditEncryption {

Review Comment:
   Hello, **all**
   
   I've checked the concerns of copilot on 
   
   If by some reason original statement will fail the parsing, but SQL command 
will be converted by some way and executed finally - the exception will occur 
and audit log will be lost.
   
https://github.com/apache/doris/blob/c3535180faddb56ee95000009a6164027334845c/fe/fe-core/src/main/java/org/apache/doris/qe/AuditLogHelper.java#L373
   
   But in general such behavior is not possible, because `AuditLogHelper` 
receives for audit parsed version of statement, not the original one.
   
   Please check this logic, which is mentioned by Copilot
   
https://github.com/apache/doris/blob/c3535180faddb56ee95000009a6164027334845c/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java#L281
   It means, that only if original statement was successfully parsed - it used 
for further processing, otherwise `convertedStmt` is used.
   This auditStmt is specified as "actual" originStmt in created `parsedStmt`
   
https://github.com/apache/doris/blob/c3535180faddb56ee95000009a6164027334845c/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java#L292
   
   And as you can see on next line - this 100% parsed **auditStmt** is also 
used for audit.
   
https://github.com/apache/doris/blob/c3535180faddb56ee95000009a6164027334845c/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java#L292
   
   And this audit statement is passed into corresponding method for audit
   
https://github.com/apache/doris/blob/c3535180faddb56ee95000009a6164027334845c/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java#L348
   
   And finally sent to `AuditLogHelper`
   
https://github.com/apache/doris/blob/c3535180faddb56ee95000009a6164027334845c/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java#L180
   
   So in any case - only successfully parsed instruction will be sent into 
AuditLogHelper and there is no need for extra changes in code :)



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