-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support UnboundPartitionSpec #106
feat: support UnboundPartitionSpec #106
Conversation
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.
Thanks for the pr, it looks great. For now, the most important use case of UnboundPartitionSpec
is in the catalog api. We should replace the PartitionSpec
in TableCreation with UnboundPartitionSpec
since the spec id and field id should not be specified by user. Same should be applied to AddSpec
table update.
pub transform: Transform, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default, Builder)] |
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.
Use TypedBuilder
?
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 don't find a neat way to add #[builder(setter(each(name = "with_partition_field")))]
in TypedBuilder.
Accoding to this, it may need to use mutators?
Maybe we can try later?
crates/iceberg/src/spec/partition.rs
Outdated
} | ||
|
||
/// Bind unbound partition spec to a schema | ||
pub fn bind(&self, schema: SchemaRef) -> Result<PartitionSpec> { |
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 fact, I'm hesitating to implement bind
method for now since I don't know if it's really useful, maybe we should implement it later when necessary?
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'm also a little confused about the process. If there's a need, I can try it then. Thanks @liurenjie1024.
0a4a7ed
to
b85eb16
Compare
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. A minor suggestion is to add an unit test for it.
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!
cc @Fokko PTAL, I think this is ready to 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.
Mostly LGTM, only some comments for code reading.
48a4e63
to
4c044dc
Compare
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
"fields": [ | ||
{ | ||
"source-id": 4, | ||
"field-id": 1000, |
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.
Why remove these? They are part of the PartitionField
: https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.py#L131-L135
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 this field_id
in request is optional?
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.
The open-api spec is a bit unclear, but it isn't right now:
References:
References:
And there it is non-optional.
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.
On Java:
And there it is optional:
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.
It looks like it is for historical reasons. For old specs they can be missing, and they'll just auto-increment.
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.
BTW, cleaned up the spec a bit: apache/iceberg#9240
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.
Thanks for the reference, I saw the comments now. But I think in the rest api request, it's reasonable to make it optional, and ask the server to assign a meaningful field id to it?
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!
Thanks @my-vegetable-has-exploded for working on this, and @liurenjie1024 and @Xuanwo for reviewing this 👍 |
* Implement unbound partition spec. * little update * Update in tablecreate & addspec * fixup: add some tests. * Put comments before derive
close #98