Skip to content

Conversation

@liurenjie1024
Copy link
Contributor

@liurenjie1024 liurenjie1024 commented Oct 31, 2023

This pr implements load table in rest catalog, also add accesses to table metadata.

related: #60

"Creating table not supported yet!",
))
async fn load_table(&self, table: &TableIdent) -> Result<Table> {
let request = self
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

@liurenjie1024
Copy link
Contributor Author

CC @Xuanwo @Fokko Any other comments?

Copy link
Member

@Xuanwo Xuanwo left a 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!

Copy link
Contributor

@Fokko Fokko left a 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 👍

@Fokko Fokko merged commit e26bda3 into apache:main Nov 8, 2023
@liurenjie1024 liurenjie1024 deleted the renjie/issue-60-2 branch November 8, 2023 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants