zhangwl9 commented on PR #4238:
URL: https://github.com/apache/amoro/pull/4238#issuecomment-4647234992

   > The current design introduces two static methods (`resolveCategoryTypes` 
and `matchProcessCategory`) in `FormatTableDescriptor`, where each descriptor 
implementation maintains its own type lists and passes them as arguments. This 
is a bit awkward — the routing logic is split between the caller and the 
interface.
   > 
   > A cleaner approach would be to add an instance method to the interface:
   > 
   > ```java
   > /**
   >  * Returns the list of process type names belonging to the given category.
   >  * Used internally to filter processes by category.
   >  */
   > default List<String> getProcessTypesByCategory(String processCategory) {
   >     return Collections.emptyList();
   > }
   > ```
   > 
   > Each descriptor overrides this to return its own category-to-types mapping:
   > 
   > ```java
   > // MixedAndIcebergTableDescriptor
   > @Override
   > public List<String> getProcessTypesByCategory(String processCategory) {
   >     return FormatTableDescriptor.resolveCategoryTypes(
   >         processCategory, OPTIMIZING_TYPE_LIST, CLEANUP_TYPE_LIST, 
PROFILING_TYPE_LIST);
   > }
   > 
   > // HudiTableDescriptor / PaimonTableDescriptor
   > @Override
   > public List<String> getProcessTypesByCategory(String processCategory) {
   >     if 
(ProcessCategory.OPTIMIZING.getName().equalsIgnoreCase(processCategory)) {
   >         return OPTIMIZING_TYPES;
   >     }
   >     return Collections.emptyList();
   > }
   > ```
   > 
   > Then `getOptimizingProcessesInfo` just calls 
`descriptor.getProcessTypesByCategory(processCategory)` without needing to know 
about the three separate lists. The two static helpers can be removed or made 
private.
   > 
   > This keeps the "what types belong to my category" knowledge encapsulated 
in each descriptor, and makes the interface easier to extend when new 
categories are added.
   
   Thank you very much. The new commit has been fixed it.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to