tengqm commented on PR #6542:
URL: https://github.com/apache/gravitino/pull/6542#issuecomment-2688124903
> @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?
--
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]