-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Implement load table api. #89
Conversation
"Creating table not supported yet!", | ||
)) | ||
async fn load_table(&self, table: &TableIdent) -> Result<Table> { | ||
let request = self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the typical pattern here in Rust? I would split this out into a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the construction of http request? I think they are simple enough, and moving them to another method doesn't help much in avoid duplication, how do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Python we split it out, because we're also doing some additional things: https://github.com/apache/iceberg-python/blob/main/pyiceberg/catalog/rest.py#L209-L240 But we can refactor this later as well 👍
|
||
let resp = self | ||
.client | ||
.query::<LoadTableResponse, ErrorResponse, OK>(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we handle the different error codes?
https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml#L626-L649
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at the error response and they all same schema: ErrorModel
.
They are all converted to iceberg
, and left to user. All necessary information are kept, such as type, code, message, event stacktrace. You can refer to :
impl From<ErrorModel> for Error { |
} | ||
|
||
impl Table { | ||
/// Returns table identifier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for context, in PyIceberg we also keep a reference to the config, in case you want to refresh the table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's already kept in TableMetadata
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you mean reference to Catalog
? If so, this may not be desirable since it add life time of Catalog
instance to Table
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Python this makes a few things easier, but we can also defer that. Easier to add later on, than removing it :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @liurenjie1024 and @Xuanwo for the review 👍
This pr implements load table in rest catalog, also add accesses to table metadata.
related: #60