zhjwpku commented on code in PR #61:
URL: https://github.com/apache/iceberg-cpp/pull/61#discussion_r2036495200
##########
src/iceberg/transform.cc:
##########
@@ -21,55 +21,26 @@
#include <format>
-namespace iceberg {
+#include "iceberg/type.h"
-namespace {
-/// \brief Get the relative transform name
-constexpr std::string_view ToString(TransformType type) {
- switch (type) {
- case TransformType::kUnknown:
- return "unknown";
- case TransformType::kIdentity:
- return "identity";
- case TransformType::kBucket:
- return "bucket";
- case TransformType::kTruncate:
- return "truncate";
- case TransformType::kYear:
- return "year";
- case TransformType::kMonth:
- return "month";
- case TransformType::kDay:
- return "day";
- case TransformType::kHour:
- return "hour";
- case TransformType::kVoid:
- return "void";
- default:
- return "invalid";
- }
-}
-} // namespace
+namespace iceberg {
-TransformFunction::TransformFunction(TransformType type) :
transform_type_(type) {}
+TransformFunction::TransformFunction(TransformType transform_type,
+ std::shared_ptr<Type> source_type)
+ : transform_type_(transform_type), source_type_(std::move(source_type)) {}
TransformType TransformFunction::transform_type() const { return
transform_type_; }
-std::string TransformFunction::ToString() const {
- return std::format("{}", iceberg::ToString(transform_type_));
+std::shared_ptr<Type> const& TransformFunction::source_type() const {
Review Comment:
It seems we have two different styles for const placement: `const
std::shared_ptr<Type>&` vs `std::shared_ptr<Type> const&`. Do we want to stick
to one style?
You don’t need to make changes in this PR; I’m just curious if this is
something we should pay attention to. @wgtmac @lidavidm WDYT
##########
src/iceberg/type_fwd.h:
##########
@@ -101,6 +101,7 @@ class StructLike;
class TableMetadata;
enum class TransformType;
class TransformFunction;
+struct TransformSpec;
Review Comment:
I don't see this struct elsewhere, do we need this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]