Skip to content
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

refactor: Refactor error in DataType #36

Merged
merged 6 commits into from
Aug 4, 2024

Conversation

XuQianJin-Stars
Copy link
Contributor

link: #32

@@ -38,3 +38,12 @@ pub enum Error {
source: opendal::Error,
},
}

#[derive(Debug, Snafu)]
pub enum DataTypeError {
Copy link
Member

Choose a reason for hiding this comment

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

Hi, we usually expose only one error in each crate to keep them user-friendly. I will suggest to add DataTypeInvalid as a new enum in Error directly. In this way, we can use paimon::Error everywhere.

Copy link
Contributor

@Aitozi Aitozi left a comment

Choose a reason for hiding this comment

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

Left a minor comment.

if !(Self::MIN_LENGTH..=Self::MAX_LENGTH).contains(&length) {
return Err("Character string length must be between 1 and 255 (both inclusive).");
return DataTypeInvalidSnafu {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we simplify this by ensure!(length < Self::MIN_LENGTH, DataTypeInvalidSnafu {message: "Binary string length must be at least 1."}); ?

The same as below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we simplify this by ensure!(length < Self::MIN_LENGTH, DataTypeInvalidSnafu {message: "Binary string length must be at least 1."}); ?

The same as below

This simplifies things a bit, but the readability of the code is reduced.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, make sense

Copy link
Contributor

@Aitozi Aitozi left a comment

Choose a reason for hiding this comment

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

LGTM

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.

THanks

@Aitozi Aitozi merged commit e86c828 into apache:main Aug 4, 2024
7 checks passed
@XuQianJin-Stars XuQianJin-Stars deleted the type-error branch September 6, 2024 10:46
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