dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Improvement-11291][sql] Improvement the log output while executing multiple sql statements

Open rickchengx opened this issue 2 years ago • 2 comments

Purpose of the pull request

Currently, the log does not output the currently executing sql statement while executing multiple sql statements.

Also, the log output in the prepareStatementAndBind() is kind of odd:

For example, as for multiple mysql statements, it outputs

[INFO] 2022-08-04 05:56:57.774 +0000 [taskAppId=TASK-20220804-6410011658368_11-73-78] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.sql.SqlTask:[367] - prepare statement replace sql : HikariProxyPreparedStatement@1694477678 wrapping com.mysql.cj.jdbc.ClientPreparedStatement: 
insert into student values ('Ton', 18); 

which can output the sql statement.

However, as for multiple hive statements, it outputs

[INFO] 2022-08-04 05:41:58.610 +0000 [taskAppId=TASK-20220804-6418931330048_7-72-77] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.sql.SqlTask:[367] - prepare statement replace sql : HikariProxyPreparedStatement@894649176 wrapping org.apache.hive.jdbc.HivePreparedStatement@4041a5d6

which can not output the current sql statement since toString() is not implemented in the class HivePreparedStatement.

So why don't we just delete the log output in the prepareStatementAndBind() and add the log output in the executeUpdate()

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

rickchengx avatar Aug 04 '22 06:08 rickchengx

Codecov Report

Merging #11292 (61db48a) into dev (aef2fbf) will decrease coverage by 0.32%. The diff coverage is 29.07%.

:exclamation: Current head 61db48a differs from pull request most recent head 5d52227. Consider uploading reports for the commit 5d52227 to get more accurate results

@@             Coverage Diff              @@
##                dev   #11292      +/-   ##
============================================
- Coverage     40.25%   39.93%   -0.33%     
+ Complexity     4843     4598     -245     
============================================
  Files           974      967       -7     
  Lines         37311    36643     -668     
  Branches       4140     4091      -49     
============================================
- Hits          15020    14632     -388     
+ Misses        20745    20500     -245     
+ Partials       1546     1511      -35     
Impacted Files Coverage Δ
...heduler/api/controller/TaskInstanceController.java 55.55% <ø> (ø)
...duler/api/security/impl/AbstractAuthenticator.java 100.00% <ø> (ø)
...r/api/security/impl/pwd/PasswordAuthenticator.java 100.00% <ø> (ø)
.../dolphinscheduler/common/utils/ParameterUtils.java 58.53% <ø> (ø)
...e/dolphinscheduler/dao/entity/ProcessInstance.java 0.00% <ø> (-65.57%) :arrow_down:
...he/dolphinscheduler/dao/entity/TaskGroupQueue.java 66.03% <ø> (ø)
...ver/master/consumer/TaskPriorityQueueConsumer.java 0.00% <0.00%> (ø)
...ler/server/master/event/TaskDelayEventHandler.java 0.00% <0.00%> (ø)
.../server/master/event/TaskDispatchEventHandler.java 0.00% <0.00%> (ø)
...r/master/event/TaskRejectByWorkerEventHandler.java 0.00% <0.00%> (ø)
... and 99 more

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov-commenter avatar Aug 04 '22 06:08 codecov-commenter