You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "tsungchih (via GitHub)" <gi...@apache.org> on 2025/08/03 02:28:23 UTC

[PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

tsungchih opened a new pull request, #7904:
URL: https://github.com/apache/gravitino/pull/7904

   <!--
   1. Title: [#<issue>] <type>(<scope>): <subject>
      Examples:
        - "[#123] feat(operator): support xxx"
        - "[#233] fix: check null before access result in xxx"
        - "[MINOR] refactor: fix typo in variable name"
        - "[MINOR] docs: fix typo in README"
        - "[#255] test: fix flaky test NameOfTheTest"
      Reference: https://www.conventionalcommits.org/en/v1.0.0/
   2. If the PR is unfinished, please mark this PR as draft.
   -->
   
   ### What changes were proposed in this pull request?
   
   This PR is aimed at introducing a `SerdesUtilsBase` class to accommodate shared class variables so that they could be shared across all its sub-classes like `SerdesUtils`. In doing so, we could
   
   - achieve single source of truth against shared class variables,
   - facilitate maintenance effort.
   
   ### Why are the changes needed?
   
   The current implementation of `SerdesUtils` in client-python tries to split `JsonUtils` in Java client into various classes listed as follows.
   
   - [gravitino.api.types.json_serdes._helper.serdes_utils.SerdesUtils](https://github.com/apache/gravitino/blob/main/clients/client-python/gravitino/api/types/json_serdes/_helper/serdes_utils.py)
   - [gravitino.dto.rel.expressions.json_serdes._helper.serdes_utils.SerdesUtils](https://github.com/apache/gravitino/blob/main/clients/client-python/gravitino/dto/rel/expressions/json_serdes/_helper/serdes_utils.py)
   
   Many class variables (as serialized keys) are shared and therefore defined more than once in the `SerdesUtils` class. In the end, we will define these shared class variables in multiple `SerdesUtils`. This could introduce issues of breaking single source of truth against these class variables (serialized keys) and could be difficult to achieve consistency.
   
   #5199
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   Unit tests
   


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "unknowntpo (via GitHub)" <gi...@apache.org>.
unknowntpo commented on PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#issuecomment-3148906653

   > @unknowntpo Before proceeding the next PR (`PartitionDTOSerializer`, `PartitionDTODeserializer`) for 5199, I may need to do a refactor as to the `SerdesUtils` proposed here. Could you please help with reviewing this PR when you are available? I would greatly appreciate any feedback from you. Thanks.
   
   Okay. 


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "unknowntpo (via GitHub)" <gi...@apache.org>.
unknowntpo commented on PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#issuecomment-3168372958

   @xunliu LGTM.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao merged PR #7904:
URL: https://github.com/apache/gravitino/pull/7904


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#discussion_r2252852269


##########
clients/client-python/gravitino/utils/serdes.py:
##########
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import re
+from collections.abc import Mapping
+from types import MappingProxyType
+from typing import Final, Pattern, Set
+
+from gravitino.api.types.types import Name, Types
+
+
+class SerdesUtilsBase:
+    EXPRESSION_TYPE: Final[str] = "type"
+    DATA_TYPE: Final[str] = "dataType"
+    LITERAL_VALUE: Final[str] = "value"
+    FIELD_NAME: Final[str] = "fieldName"
+    FUNCTION_NAME: Final[str] = "funcName"
+    FUNCTION_ARGS: Final[str] = "funcArgs"
+    UNPARSED_EXPRESSION: Final[str] = "unparsedExpression"
+    TYPE: Final[str] = "type"
+    STRUCT: Final[str] = "struct"
+    FIELDS: Final[str] = "fields"
+    STRUCT_FIELD_NAME: Final[str] = "name"
+    STRUCT_FIELD_NULLABLE: Final[str] = "nullable"
+    STRUCT_FIELD_COMMENT: Final[str] = "comment"
+    LIST: Final[str] = "list"
+    LIST_ELEMENT_TYPE: Final[str] = "elementType"
+    LIST_ELEMENT_NULLABLE: Final[str] = "containsNull"
+    MAP: Final[str] = "map"
+    MAP_KEY_TYPE: Final[str] = "keyType"
+    MAP_VALUE_TYPE: Final[str] = "valueType"
+    MAP_VALUE_NULLABLE: Final[str] = "valueContainsNull"
+    UNION: Final[str] = "union"
+    UNION_TYPES: Final[str] = "types"
+    UNPARSED: Final[str] = "unparsed"
+    UNPARSED_TYPE: Final[str] = "unparsedType"
+    EXTERNAL: Final[str] = "external"
+    CATALOG_STRING: Final[str] = "catalogString"
+
+    PARTITION_TYPE: Final[str] = "type"
+    PARTITION_NAME: Final[str] = "name"
+    FIELD_NAMES: Final[str] = "fieldNames"
+    IDENTITY_PARTITION_VALUES: Final[str] = "values"
+    LIST_PARTITION_LISTS: Final[str] = "lists"
+    RANGE_PARTITION_UPPER: Final[str] = "upper"
+    RANGE_PARTITION_LOWER: Final[str] = "lower"
+
+    NON_PRIMITIVE_TYPES: Final[Set[Name]] = {
+        Name.STRUCT,
+        Name.LIST,
+        Name.MAP,
+        Name.UNION,
+        Name.UNPARSED,
+        Name.EXTERNAL,
+    }
+    PRIMITIVE_AND_NULL_TYPES: Final[Set[Name]] = set(list(Name)) - NON_PRIMITIVE_TYPES
+
+    DECIMAL_PATTERN: Final[Pattern[str]] = re.compile(
+        r"decimal\(\s*(\d+)\s*,\s*(\d+)\s*\)"
+    )
+    FIXED_PATTERN: Final[Pattern[str]] = re.compile(r"fixed\(\s*(\d+)\s*\)")
+    FIXEDCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"char\(\s*(\d+)\s*\)")
+    VARCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"varchar\(\s*(\d+)\s*\)")
+    TYPES: Final[Mapping] = MappingProxyType(
+        {
+            type_instance.simple_string(): type_instance
+            for type_instance in (

Review Comment:
   The TYPES mapping is created from a tuple instead of a set, which could lead to duplicate keys being overwritten. The original code in the existing SerdesUtils uses a set comprehension, but this uses a tuple comprehension. This could cause type instances with the same simple_string() to overwrite each other silently.
   ```suggestion
               for type_instance in {
   ```



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "unknowntpo (via GitHub)" <gi...@apache.org>.
unknowntpo commented on code in PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#discussion_r2256890444


##########
clients/client-python/gravitino/utils/serdes.py:
##########
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import re
+from collections.abc import Mapping
+from types import MappingProxyType
+from typing import Final, Pattern, Set
+
+from gravitino.api.types.types import Name, Types
+
+
+class SerdesUtilsBase:
+    EXPRESSION_TYPE: Final[str] = "type"
+    DATA_TYPE: Final[str] = "dataType"
+    LITERAL_VALUE: Final[str] = "value"
+    FIELD_NAME: Final[str] = "fieldName"
+    FUNCTION_NAME: Final[str] = "funcName"
+    FUNCTION_ARGS: Final[str] = "funcArgs"
+    UNPARSED_EXPRESSION: Final[str] = "unparsedExpression"
+    TYPE: Final[str] = "type"
+    STRUCT: Final[str] = "struct"
+    FIELDS: Final[str] = "fields"
+    STRUCT_FIELD_NAME: Final[str] = "name"
+    STRUCT_FIELD_NULLABLE: Final[str] = "nullable"
+    STRUCT_FIELD_COMMENT: Final[str] = "comment"
+    LIST: Final[str] = "list"
+    LIST_ELEMENT_TYPE: Final[str] = "elementType"
+    LIST_ELEMENT_NULLABLE: Final[str] = "containsNull"
+    MAP: Final[str] = "map"
+    MAP_KEY_TYPE: Final[str] = "keyType"
+    MAP_VALUE_TYPE: Final[str] = "valueType"
+    MAP_VALUE_NULLABLE: Final[str] = "valueContainsNull"
+    UNION: Final[str] = "union"
+    UNION_TYPES: Final[str] = "types"
+    UNPARSED: Final[str] = "unparsed"
+    UNPARSED_TYPE: Final[str] = "unparsedType"
+    EXTERNAL: Final[str] = "external"
+    CATALOG_STRING: Final[str] = "catalogString"
+
+    PARTITION_TYPE: Final[str] = "type"
+    PARTITION_NAME: Final[str] = "name"
+    FIELD_NAMES: Final[str] = "fieldNames"
+    IDENTITY_PARTITION_VALUES: Final[str] = "values"
+    LIST_PARTITION_LISTS: Final[str] = "lists"
+    RANGE_PARTITION_UPPER: Final[str] = "upper"
+    RANGE_PARTITION_LOWER: Final[str] = "lower"
+
+    NON_PRIMITIVE_TYPES: Final[Set[Name]] = {
+        Name.STRUCT,
+        Name.LIST,
+        Name.MAP,
+        Name.UNION,
+        Name.UNPARSED,
+        Name.EXTERNAL,
+    }
+    PRIMITIVE_AND_NULL_TYPES: Final[Set[Name]] = set(list(Name)) - NON_PRIMITIVE_TYPES
+
+    DECIMAL_PATTERN: Final[Pattern[str]] = re.compile(
+        r"decimal\(\s*(\d+)\s*,\s*(\d+)\s*\)"
+    )
+    FIXED_PATTERN: Final[Pattern[str]] = re.compile(r"fixed\(\s*(\d+)\s*\)")
+    FIXEDCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"char\(\s*(\d+)\s*\)")
+    VARCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"varchar\(\s*(\d+)\s*\)")
+    TYPES: Final[Mapping] = MappingProxyType(
+        {
+            type_instance.simple_string(): type_instance
+            for type_instance in (

Review Comment:
   @tsungchih What about this ?



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "unknowntpo (via GitHub)" <gi...@apache.org>.
unknowntpo commented on code in PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#discussion_r2262573694


##########
clients/client-python/gravitino/utils/serdes.py:
##########
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import re
+from collections.abc import Mapping
+from types import MappingProxyType
+from typing import Final, Pattern, Set
+
+from gravitino.api.types.types import Name, Types
+
+
+class SerdesUtilsBase:
+    EXPRESSION_TYPE: Final[str] = "type"
+    DATA_TYPE: Final[str] = "dataType"
+    LITERAL_VALUE: Final[str] = "value"
+    FIELD_NAME: Final[str] = "fieldName"
+    FUNCTION_NAME: Final[str] = "funcName"
+    FUNCTION_ARGS: Final[str] = "funcArgs"
+    UNPARSED_EXPRESSION: Final[str] = "unparsedExpression"
+    TYPE: Final[str] = "type"
+    STRUCT: Final[str] = "struct"
+    FIELDS: Final[str] = "fields"
+    STRUCT_FIELD_NAME: Final[str] = "name"
+    STRUCT_FIELD_NULLABLE: Final[str] = "nullable"
+    STRUCT_FIELD_COMMENT: Final[str] = "comment"
+    LIST: Final[str] = "list"
+    LIST_ELEMENT_TYPE: Final[str] = "elementType"
+    LIST_ELEMENT_NULLABLE: Final[str] = "containsNull"
+    MAP: Final[str] = "map"
+    MAP_KEY_TYPE: Final[str] = "keyType"
+    MAP_VALUE_TYPE: Final[str] = "valueType"
+    MAP_VALUE_NULLABLE: Final[str] = "valueContainsNull"
+    UNION: Final[str] = "union"
+    UNION_TYPES: Final[str] = "types"
+    UNPARSED: Final[str] = "unparsed"
+    UNPARSED_TYPE: Final[str] = "unparsedType"
+    EXTERNAL: Final[str] = "external"
+    CATALOG_STRING: Final[str] = "catalogString"
+
+    PARTITION_TYPE: Final[str] = "type"
+    PARTITION_NAME: Final[str] = "name"
+    FIELD_NAMES: Final[str] = "fieldNames"
+    IDENTITY_PARTITION_VALUES: Final[str] = "values"
+    LIST_PARTITION_LISTS: Final[str] = "lists"
+    RANGE_PARTITION_UPPER: Final[str] = "upper"
+    RANGE_PARTITION_LOWER: Final[str] = "lower"
+
+    NON_PRIMITIVE_TYPES: Final[Set[Name]] = {
+        Name.STRUCT,
+        Name.LIST,
+        Name.MAP,
+        Name.UNION,
+        Name.UNPARSED,
+        Name.EXTERNAL,
+    }
+    PRIMITIVE_AND_NULL_TYPES: Final[Set[Name]] = set(list(Name)) - NON_PRIMITIVE_TYPES
+
+    DECIMAL_PATTERN: Final[Pattern[str]] = re.compile(
+        r"decimal\(\s*(\d+)\s*,\s*(\d+)\s*\)"
+    )
+    FIXED_PATTERN: Final[Pattern[str]] = re.compile(r"fixed\(\s*(\d+)\s*\)")
+    FIXEDCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"char\(\s*(\d+)\s*\)")
+    VARCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"varchar\(\s*(\d+)\s*\)")
+    TYPES: Final[Mapping] = MappingProxyType(
+        {
+            type_instance.simple_string(): type_instance
+            for type_instance in (

Review Comment:
   @tsungchih I think we can just ignore suggestion from copilot.



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "tsungchih (via GitHub)" <gi...@apache.org>.
tsungchih commented on PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#issuecomment-3146927091

   @unknowntpo Before proceeding the next PR (`PartitionDTOSerializer`, `PartitionDTODeserializer`) for 5199, I may need to do a refactor as to the `SerdesUtils` proposed here. Could you please help with reviewing this PR when you are available? I would greatly appreciate any feedback from you. Thanks.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#5199] refactor(client-python): refactor of serdes utils [gravitino]

Posted by "tsungchih (via GitHub)" <gi...@apache.org>.
tsungchih commented on code in PR #7904:
URL: https://github.com/apache/gravitino/pull/7904#discussion_r2257495997


##########
clients/client-python/gravitino/utils/serdes.py:
##########
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import re
+from collections.abc import Mapping
+from types import MappingProxyType
+from typing import Final, Pattern, Set
+
+from gravitino.api.types.types import Name, Types
+
+
+class SerdesUtilsBase:
+    EXPRESSION_TYPE: Final[str] = "type"
+    DATA_TYPE: Final[str] = "dataType"
+    LITERAL_VALUE: Final[str] = "value"
+    FIELD_NAME: Final[str] = "fieldName"
+    FUNCTION_NAME: Final[str] = "funcName"
+    FUNCTION_ARGS: Final[str] = "funcArgs"
+    UNPARSED_EXPRESSION: Final[str] = "unparsedExpression"
+    TYPE: Final[str] = "type"
+    STRUCT: Final[str] = "struct"
+    FIELDS: Final[str] = "fields"
+    STRUCT_FIELD_NAME: Final[str] = "name"
+    STRUCT_FIELD_NULLABLE: Final[str] = "nullable"
+    STRUCT_FIELD_COMMENT: Final[str] = "comment"
+    LIST: Final[str] = "list"
+    LIST_ELEMENT_TYPE: Final[str] = "elementType"
+    LIST_ELEMENT_NULLABLE: Final[str] = "containsNull"
+    MAP: Final[str] = "map"
+    MAP_KEY_TYPE: Final[str] = "keyType"
+    MAP_VALUE_TYPE: Final[str] = "valueType"
+    MAP_VALUE_NULLABLE: Final[str] = "valueContainsNull"
+    UNION: Final[str] = "union"
+    UNION_TYPES: Final[str] = "types"
+    UNPARSED: Final[str] = "unparsed"
+    UNPARSED_TYPE: Final[str] = "unparsedType"
+    EXTERNAL: Final[str] = "external"
+    CATALOG_STRING: Final[str] = "catalogString"
+
+    PARTITION_TYPE: Final[str] = "type"
+    PARTITION_NAME: Final[str] = "name"
+    FIELD_NAMES: Final[str] = "fieldNames"
+    IDENTITY_PARTITION_VALUES: Final[str] = "values"
+    LIST_PARTITION_LISTS: Final[str] = "lists"
+    RANGE_PARTITION_UPPER: Final[str] = "upper"
+    RANGE_PARTITION_LOWER: Final[str] = "lower"
+
+    NON_PRIMITIVE_TYPES: Final[Set[Name]] = {
+        Name.STRUCT,
+        Name.LIST,
+        Name.MAP,
+        Name.UNION,
+        Name.UNPARSED,
+        Name.EXTERNAL,
+    }
+    PRIMITIVE_AND_NULL_TYPES: Final[Set[Name]] = set(list(Name)) - NON_PRIMITIVE_TYPES
+
+    DECIMAL_PATTERN: Final[Pattern[str]] = re.compile(
+        r"decimal\(\s*(\d+)\s*,\s*(\d+)\s*\)"
+    )
+    FIXED_PATTERN: Final[Pattern[str]] = re.compile(r"fixed\(\s*(\d+)\s*\)")
+    FIXEDCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"char\(\s*(\d+)\s*\)")
+    VARCHAR_PATTERN: Final[Pattern[str]] = re.compile(r"varchar\(\s*(\d+)\s*\)")
+    TYPES: Final[Mapping] = MappingProxyType(
+        {
+            type_instance.simple_string(): type_instance
+            for type_instance in (

Review Comment:
   @unknowntpo After having tried the suggestion from Copilot to use `set` instead, the build process failed at `pylint` with the following error messages.
   
   ```shell
   ************* Module gravitino.utils.serdes
   gravitino/utils/serdes.py:81:33: C0208: Use a sequence type when iterating over values (use-sequence-for-iteration)
   
   --------------------------------------------------------------------
   Your code has been rated at 10.00/10 (previous run: 10.00/10, -0.00)
   
   
   > Task :clients:client-python:pylint FAILED
   
   Build gravitino FAILURE reason:
       Execution failed for task ':clients:client-python:pylint':
           org.gradle.process.internal.ExecException: Process 'command 'sh'' finished with non-zero exit value 16
   ``` 
   
   We can decide which one of the following we are going to go for:
   1. Accept Copilot's suggestion to use `set` and ignore the pylint warning.
   2. Ignore Copilot's suggestion and accept the code as-is.
   
   I'm fine with either one proposed above since we intent to construct an immutable `Mapping` to embrace all valid `Type` instances as the values and their string expressions (`simple_string()`) as keys that are hashable. And the `dictionary` is characterized by its use of unique keys, in our case - the string expression of `Type` instances. Even if we iterate over a `tuple` of `Type` instances with duplicate elements, we can get equivalent outcome. Here's the experiment results.
   
   ```python
   >>> from gravitino.api.types.types import Types
   >>> t = (Types.NullType.get(), Types.BooleanType.get(), Types.BooleanType.get())
   >>> d = {instance.simple_string(): instance for instance in t}
   >>> len(d)
   2
   >>> print(d.keys())
   dict_keys(['null', 'boolean'])
   ```



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org