Skip to content

Conversation

@gty404
Copy link
Contributor

@gty404 gty404 commented Apr 9, 2025

No description provided.

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

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

Generally LGTM.

@lidavidm @zhjwpku @yingcai-cy WDYT?

@gty404 gty404 force-pushed the to_json_sort_order branch from 97a2b14 to 4ab5529 Compare April 10, 2025 03:53
kDescending,
};
/// \brief Get the relative sort direction name
ICEBERG_EXPORT constexpr std::string_view SortDirectionToString(SortDirection direction) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we should probably only declare these functions here and put all implementation in the .cc file.

Copy link
Collaborator

@zhjwpku zhjwpku left a comment

Choose a reason for hiding this comment

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

LGTM

auto json_value = std::move(_tmp_##json_value.value());
} // namespace

nlohmann::json ToJson(const SortField& sort_field) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking about adding ToJson and FromJson member functions to each Spec classes, but your way might be better, users don't need to touch the json ser/der functions, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is no need to introduce json either.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, in this way we don't need to expose our internal json dependency.

.message = "IdentityTransformFunction::Transform"});
}

expected<std::unique_ptr<TransformFunction>, Error> TransformFunctionFromString(
Copy link
Member

Choose a reason for hiding this comment

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

Not related, but should we do something like define iceberg::Result<T> = expected<T, iceberg::Error>?

}
}

#define TRY_ASSIGN(json_value, expr) \
Copy link
Member

Choose a reason for hiding this comment

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

We'll probably want to make a broader version of this macro. (Not necessarily in this PR)

FWIW, you could steal the Arrow version, which uses a counter to autogenerate the name, so it can be used like ARROW_ASSIGN_OR_RAISE(auto value, ...) or ARROW_ASSIGN_OR_RAISE(foo.bar, ...) too

Copy link
Member

Choose a reason for hiding this comment

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

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.

Thank you for working on this! There is no other concern from the community, I'm going to merge this one now.

@Xuanwo Xuanwo merged commit 4a5fe91 into apache:main Apr 10, 2025
6 checks passed
@wgtmac
Copy link
Member

wgtmac commented Apr 10, 2025

Thank you @Xuanwo!

@gty404 gty404 deleted the to_json_sort_order branch April 10, 2025 09:45
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.

5 participants