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/06/29 07:56:54 UTC

[PR] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   <!--
   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 is the third part (totally 4 planned) of implementation to the following classes from Java to support Column and its default value, including:
   
   - FieldReferenceDTO
   - FuncExpressionDTO
   - UnparsedExpressionDTO
   
   ### Why are the changes needed?
   
   We need to support Column and its default value in python client.
   
   #5202
   
   ### 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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   OK, I see, 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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   > Is it possible that we can add some tests to cover the serialization (DTO -> JSON) and deserialization (JSON -> DTO)?
   
   @jerryshao Thanks for the comments. Before being able to implement the serdes of column default values, we need to implement the related DTO classes (such as LiteralDTO, FieldReferenceDTO, FuncExpressionDTO, and UnparsedExpressionDTO). The LiteralDTO has been created in [the previous PR](https://github.com/apache/gravitino/pull/7357) as it is not able to be separated from implementation of `FunctionArg` and of `ColumnDTO`. And the rest of DTO classes were included in this PR. After then, the serdes corresponding to the column default values will be implemented in the next PR. Then the unit tests will be added accordingly.


-- 
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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   @unknowntpo @jerryshao 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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   @jerryshao @tsungchih  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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   The change LGTM, @unknowntpo would you please also take a review?


-- 
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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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


-- 
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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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


##########
clients/client-python/gravitino/dto/rel/expressions/func_expression_dto.py:
##########
@@ -0,0 +1,59 @@
+# 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.
+
+from __future__ import annotations
+
+from typing import List
+
+from gravitino.api.expressions.expression import Expression
+from gravitino.api.expressions.function_expression import FunctionExpression
+from gravitino.dto.rel.expressions.function_arg import FunctionArg
+
+
+class FuncExpressionDTO(FunctionExpression, FunctionArg):
+    def __init__(self, function_name: str, function_args: List[FunctionArg]):

Review Comment:
   In `FuncExpressionDTO.java` we have Builder subclass. So I think we can have the builder here.



##########
clients/client-python/gravitino/dto/rel/expressions/field_reference_dto.py:
##########
@@ -0,0 +1,44 @@
+# 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.
+
+from __future__ import annotations
+
+from typing import List
+
+from gravitino.api.expressions.named_reference import NamedReference
+from gravitino.dto.rel.expressions.function_arg import FunctionArg
+
+
+class FieldReferenceDTO(NamedReference, FunctionArg):

Review Comment:
   In `FieldReferenceDTO.java` we have Builder subclass. So I think we can have the builder here.



##########
clients/client-python/gravitino/dto/rel/expressions/unparsed_expression_dto.py:
##########
@@ -0,0 +1,50 @@
+# 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.
+
+from gravitino.api.expressions.unparsed_expression import UnparsedExpression
+from gravitino.dto.rel.expressions.function_arg import FunctionArg
+
+
+class UnparsedExpressionDTO(UnparsedExpression, FunctionArg):
+    """Data transfer object representing an unparsed expression."""
+
+    def __init__(self, unparsed_expression: str):

Review Comment:
   In `UnparsedExpressionDTO.java` we have Builder subclass. So I think we can have the builder here.



-- 
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] [#5202] feat(client-python): add dto classes for default values [gravitino]

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

   Is it possible that we can add some tests to cover the serialization (DTO -> JSON) and deserialization (JSON -> DTO)?


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