tsungchih commented on PR #6542:
URL: https://github.com/apache/gravitino/pull/6542#issuecomment-2688345631

   > > @tengqm The Python code is manually written according to the 
corresponding Java code. Only the unit tests were auto-generated and revised by 
myself. Are there concerns with the auto-generated unit tests?
   > 
   > No. I don't have concerns about the unit tests. The reason I asked this 
question is that I am (still) wondering whether we can write the code in a more 
Python way. If, however, we have an automation to generate these Python files 
out of Java source, it should be fine. Otherwise, we don't need to copy them.
   > 
   > For example, in `class ColumnImpl`, we can write the code as:
   > 
   > ```python
   > class ColumnImpl(Column):
   >   """The implementation of `Column` for users to use API."""
   >   def __init__(
   >       self, name: str, data_type: Type, comment: Optional[str],
   >       nullable: bool, auto_increment: bool,
   >       default_value: Optional[Expression]):
   > 
   >       Precondition.check_string_not_empty(name, "Column name cannot be 
null")
   >       Precondition.check_argument(
   >           data_type is not None, "Column data type cannot be null")
   >       self.name = name
   >       self.data_type = data_type
   >       self.comment = comment
   >       self.nullable = nullable
   >       self.auto_increment = auto_increment
   >       self.default_value = default_value
   > ```
   > 
   > Isn't this pretty straightforward?
   
   Allow me to clarify myself. In the above example you demonstrated, we don't 
have to mimic how Java makes the data members, like `name`, `comment`, etc., 
private/protected and creates getter/setter to access them. Just make them 
public for direct access would be more straightforward. Is that correct?


-- 
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-unsubscr...@gravitino.apache.org

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

Reply via email to