tsungchih commented on PR #6542:
URL: https://github.com/apache/gravitino/pull/6542#issuecomment-2689471930
> Yes. There are two extremes here. Either you are auto-generating the
Python code from Java, you only care about the correctness of the generator,
you don't care if the code is complicated because they will be overwritten next
time when you run the generator.
>
> Or you may want to focus on producing usable, useful, working and
MAINTAINABLE code with the least lines of code. One rule of thumb for me is
that it is always easy to add something to an existing code base, but it is
never so easy to get rid of them once they are merged.
>
> My overall suggestion is to drastically simplify the code without
sacrificing the its functionality. It helps save our lives for something else
more interesting/challenging.
>
> WDYT?
Yes, totally agree with you as to producing usable, useful, working and
MAINTAINABLE code. Therefore, based on your rule of thumb, we will have the
following class `Column` rather than interface `Column` and its implementation
`ColumnImpl` in `column.py`.
```python
class Column:
"""The `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
```
How do you think of this way?
--
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]