Skip to content

Commit 80b3e35

Browse files
authored
[fix](profile) Total time in profile should include parser costs (apache#55291)
1 parent b45981f commit 80b3e35

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public enum ConnectType {
184184
// Command this connection is processing.
185185
protected volatile MysqlCommand command;
186186
// Timestamp in millisecond last command starts at
187-
protected volatile long startTime;
187+
protected volatile long startTime = -1;
188188
// Cache thread info for this connection.
189189
protected volatile ThreadInfo threadInfo;
190190

@@ -690,8 +690,10 @@ public long getStartTime() {
690690
}
691691

692692
public void setStartTime() {
693-
startTime = System.currentTimeMillis();
694-
returnRows = 0;
693+
if (startTime == -1) {
694+
startTime = System.currentTimeMillis();
695+
returnRows = 0;
696+
}
695697
}
696698

697699
public void updateReturnRows(int returnRows) {

‎fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void testNormal() {
119119
Assert.assertEquals("", row.get(11));
120120

121121
// Start time
122-
Assert.assertEquals(0, ctx.getStartTime());
122+
Assert.assertEquals(-1, ctx.getStartTime());
123123
ctx.setStartTime();
124124
Assert.assertNotSame(0, ctx.getStartTime());
125125

0 commit comments

Comments
 (0)