Skip to content

Commit dad2c9f

Browse files
authored
[Hotfix][ams] Fix ResourceMapper.selectResourcesByGroup result mapping (#4194)
The @Result property names did not match the fields on Resource: - group -> groupName - container -> containerName - totalMemory -> memoryMb The start_time column and its @Result mapping were removed because Resource has no startTime field; MyBatis would silently drop it anyway. This method is currently only declared/implemented via DefaultOptimizerManager.listResourcesByGroup with no caller on master, so no behavioral change is observable. Fixing it now unblocks any future caller (e.g. auto-restart feature) from getting back empty-field Resource objects.
1 parent d6b2cda commit dad2c9f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

amoro-ams/src/main/java/org/apache/amoro/server/persistence/mapper/ResourceMapper.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ public interface ResourceMapper {
5959
ResourceGroup selectResourceGroup(@Param("resourceGroup") String groupName);
6060

6161
@Select(
62-
"SELECT resource_id, group_name, container_name, start_time, thread_count, total_memory, properties"
62+
"SELECT resource_id, group_name, container_name, thread_count, total_memory, properties"
6363
+ " FROM resource WHERE group_name = #{resourceGroup}")
6464
@Results({
6565
@Result(property = "resourceId", column = "resource_id"),
66-
@Result(property = "group", column = "group_name"),
67-
@Result(property = "container", column = "container_name"),
68-
@Result(property = "startTime", column = "start_time", typeHandler = Long2TsConverter.class),
66+
@Result(property = "groupName", column = "group_name"),
67+
@Result(property = "containerName", column = "container_name"),
6968
@Result(property = "threadCount", column = "thread_count"),
70-
@Result(property = "totalMemory", column = "total_memory"),
69+
@Result(property = "memoryMb", column = "total_memory"),
7170
@Result(property = "properties", column = "properties", typeHandler = Map2StringConverter.class)
7271
})
7372
List<Resource> selectResourcesByGroup(@Param("resourceGroup") String groupName);

0 commit comments

Comments
 (0)