Skip to content

Commit

Permalink
[HUDI-8596] Fix Hudi Spark SQL cancelling issue (#12358)
Browse files Browse the repository at this point in the history
  • Loading branch information
Davis-Zhang-Onehouse authored Jan 3, 2025
1 parent 4af4454 commit d6d4e88
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public Option<String> getProperty(EngineProperty key) {

@Override
public void setJobStatus(String activeModule, String activityDescription) {
javaSparkContext.setJobGroup(activeModule, activityDescription);
javaSparkContext.setJobDescription(String.format("%s:%s", activeModule, activityDescription));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,23 @@ void testAddRemoveCachedDataIds() {
assertEquals(Arrays.asList(1, 2, 3), context.removeCachedDataIds(HoodieDataCacheKey.of(basePath, instantTime)));
assertTrue(context.getCachedDataIds(HoodieDataCacheKey.of(basePath, instantTime)).isEmpty());
}

@Test
void testSetJobStatus() {
// Test data
String jobGroupId = "jobGroupId";
String initialJobDescription = "initialJobDescription";
String activeModule = "TestModule";
String activityDescription = "Running test operation";
String expectedJobDescription = String.format("%s:%s", activeModule, activityDescription);
context.getJavaSparkContext().setJobGroup(jobGroupId, initialJobDescription);
assertEquals(jobGroupId, context.getJavaSparkContext().getLocalProperty("spark.jobGroup.id"));
assertEquals(initialJobDescription, context.getJavaSparkContext().getLocalProperty("spark.job.description"));

// Set the job status
context.setJobStatus(activeModule, activityDescription);
assertEquals(expectedJobDescription, context.getJavaSparkContext().getLocalProperty("spark.job.description"));
// Assert jobGroupId does not change
assertEquals(jobGroupId, context.getJavaSparkContext().getLocalProperty("spark.jobGroup.id"));
}
}

0 comments on commit d6d4e88

Please sign in to comment.