jerryshao commented on code in PR #8841:
URL: https://github.com/apache/gravitino/pull/8841#discussion_r2443711476


##########
clients/client-python/gravitino/dto/util/dto_converters.py:
##########
@@ -76,3 +94,219 @@ def from_function_args(args: list[FunctionArg]) -> 
list[Expression]:
         if not args:
             return Expression.EMPTY_EXPRESSION
         return [DTOConverters.from_function_arg(arg) for arg in args]
+
+    @singledispatchmethod
+    @staticmethod
+    def from_dto(dto) -> object:
+        raise IllegalArgumentException(f"Unsupported DTO type: {type(dto)}")
+
+    @from_dto.register
+    @staticmethod
+    def _(dto: DistributionDTO) -> Distribution:
+        """Converts a DistributionDTO to a Distribution.
+
+        Args:
+            dto (DistributionDTO): The distribution DTO.
+
+        Returns:
+            Distribution: The distribution.
+        """
+        if dto is None or DistributionDTO.NONE.equals(dto):
+            return Distributions.NONE
+
+        return Distributions.of(
+            dto.strategy(),
+            dto.number(),
+            *DTOConverters.from_function_args(dto.args()),
+        )
+
+    @from_dto.register
+    @staticmethod
+    def _(dto: IndexDTO) -> Index:

Review Comment:
   What is the purpose of using `_` for the method?



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