Skip to content

Commit

Permalink
[BugFix] reset context start time for each hyper query job's sql (#56196
Browse files Browse the repository at this point in the history
)

Signed-off-by: stephen <stephen5217@163.com>
  • Loading branch information
stephen-shelby authored Feb 24, 2025
1 parent b358399 commit 6a6102b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ protected List<TStatisticData> executeStatisticsQuery(String sql, ConnectContext
LOG.error(message, e);
lastFailure = new RuntimeException(message, e);
return Collections.emptyList();
} finally {
context.setStartTime();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,26 @@ public List<TabletStats> sample() {
Assert.assertEquals(5550000, sampler.getSampleInfo(pid).getSampleRowCount());
}

@Test
public void testHyperQueryJobContextStartTime() {
Pair<List<String>, List<Type>> pair = initColumn(List.of("c1", "c2", "c3"));

new MockUp<SampleInfo>() {
@Mock
public List<TabletStats> getMediumHighWeightTablets() {
return List.of(new TabletStats(1, pid, 5000000));
}
};

List<HyperQueryJob> jobs = HyperQueryJob.createSampleQueryJobs(connectContext, db, table, pair.first,
pair.second, List.of(pid), 1, sampler);
long startTime = connectContext.getStartTime();
for (HyperQueryJob job : jobs) {
job.queryStatistics();
Assert.assertNotEquals(startTime, connectContext.getStartTime());
}
}

@AfterClass
public static void afterClass() {
FeConstants.runningUnitTest = false;
Expand Down

0 comments on commit 6a6102b

Please sign in to comment.