yangyichao-mango commented on a change in pull request #3184:
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/3184#discussion_r453192334
##########
File path:
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
##########
@@ -37,6 +37,16 @@
order by id asc
</select>
+ <select id="queryTopNProcessInstance"
resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
+ select *
+ from t_ds_process_instance
+ where state = 7
+ and start_time between
+ #{startTime} and #{endTime}
+ order by end_time-start_time desc
+ limit #{size}
+ </select>
Review comment:
> I have 2 questions:
> 1.if we only want to query SUCCESS process instance,do we need a state
parameter ? If we need it,how do we put the parameter into the mapper function?
> 2.why do we need **`** in this case since other cases don't use them?
Hi,
Thx a lot for your answer and your contribution.
For the first question, what I consider is to avoid changing the status code
of `ExecutionStatus.SUCCESS`, for example, if you pass the code throw
`ExecutionStatus.SUCCESS.getCode()`, it will avoid the error scene from
changing the code of `ExecutionStatus.SUCCESS` from 7 to 6.
You can refer to [1] to look over the example of passing the parameter.
For the second question, using ` is actually a good programming habit, which
can avoid conflicts between SQL field parsing and keywords in SQL Engine, and
avoid some unforeseen mistakes.
If you have any questions and suggestions, please put forward.
[1]
https://github.com/apache/incubator-dolphinscheduler/blob/dev/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapMapper.java
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]