WZhuo commented on code in PR #488:
URL: https://github.com/apache/iceberg-cpp/pull/488#discussion_r2674950651


##########
src/iceberg/metrics_config.h:
##########
@@ -22,24 +22,120 @@
 /// \file iceberg/metrics_config.h
 /// \brief Metrics configuration for Iceberg tables
 
+#include <memory>
 #include <string>
 #include <unordered_map>
+#include <unordered_set>
 
 #include "iceberg/iceberg_export.h"
 #include "iceberg/result.h"
 #include "iceberg/type_fwd.h"
+#include "iceberg/util/formattable.h"
 
 namespace iceberg {
 
+class ICEBERG_EXPORT MetricsMode : public util::Formattable {
+ public:
+  enum class Kind : uint8_t {
+    kNone,
+    kCounts,
+    kTruncate,
+    kFull,
+  };
+
+  static Result<std::shared_ptr<MetricsMode>> FromString(const std::string& 
mode);
+
+  static const std::shared_ptr<MetricsMode>& None();
+  static const std::shared_ptr<MetricsMode>& Counts();
+  static const std::shared_ptr<MetricsMode>& Truncate();

Review Comment:
   no used, remove it



##########
src/iceberg/metrics_config.h:
##########
@@ -22,24 +22,120 @@
 /// \file iceberg/metrics_config.h
 /// \brief Metrics configuration for Iceberg tables
 
+#include <memory>
 #include <string>
 #include <unordered_map>
+#include <unordered_set>
 
 #include "iceberg/iceberg_export.h"
 #include "iceberg/result.h"
 #include "iceberg/type_fwd.h"
+#include "iceberg/util/formattable.h"
 
 namespace iceberg {
 
+class ICEBERG_EXPORT MetricsMode : public util::Formattable {

Review Comment:
   looks good



##########
src/iceberg/metrics_config.h:
##########
@@ -22,24 +22,120 @@
 /// \file iceberg/metrics_config.h
 /// \brief Metrics configuration for Iceberg tables
 
+#include <memory>
 #include <string>
 #include <unordered_map>
+#include <unordered_set>
 
 #include "iceberg/iceberg_export.h"
 #include "iceberg/result.h"
 #include "iceberg/type_fwd.h"
+#include "iceberg/util/formattable.h"
 
 namespace iceberg {
 
+class ICEBERG_EXPORT MetricsMode : public util::Formattable {
+ public:
+  enum class Kind : uint8_t {
+    kNone,
+    kCounts,
+    kTruncate,
+    kFull,
+  };
+
+  static Result<std::shared_ptr<MetricsMode>> FromString(const std::string& 
mode);
+
+  static const std::shared_ptr<MetricsMode>& None();
+  static const std::shared_ptr<MetricsMode>& Counts();
+  static const std::shared_ptr<MetricsMode>& Truncate();
+  static const std::shared_ptr<MetricsMode>& Full();
+
+  /// \brief Return the kind of this metrics mode.
+  virtual Kind kind() const = 0;
+
+  std::string ToString() const override = 0;
+};
+
+class ICEBERG_EXPORT NoneMetricsMode : public MetricsMode {
+ public:
+  constexpr Kind kind() const override { return Kind::kNone; }
+
+  std::string ToString() const override;
+};
+
+class ICEBERG_EXPORT CountsMetricsMode : public MetricsMode {
+ public:
+  constexpr Kind kind() const override { return Kind::kCounts; }
+
+  std::string ToString() const override;
+};
+
+class ICEBERG_EXPORT TruncateMetricsMode : public MetricsMode {
+ public:
+  explicit TruncateMetricsMode(int32_t length) : length_(length) {}
+
+  constexpr Kind kind() const override { return Kind::kTruncate; }
+
+  std::string ToString() const override;
+
+  static Result<std::shared_ptr<MetricsMode>> Make(int32_t length);
+
+ private:
+  const int32_t length_;
+};
+
+class ICEBERG_EXPORT FullMetricsMode : public MetricsMode {
+ public:
+  constexpr Kind kind() const override { return Kind::kFull; }
+
+  std::string ToString() const override;
+};
+
 /// \brief Configuration utilities for table metrics
 class ICEBERG_EXPORT MetricsConfig {
  public:
+  MetricsConfig(
+      std::unordered_map<std::string, std::shared_ptr<MetricsMode>> 
column_modes,
+      std::shared_ptr<MetricsMode> default_mode);

Review Comment:
   The constructor will not be called directly, defined as private



-- 
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]

Reply via email to