@@ -48,9 +48,15 @@ struct AboveMax {
4848 std::strong_ordering operator <=>(const AboveMax&) const = default ;
4949};
5050
51- // TODO(mwish): Supports More types
5251using PrimitiveLiteralValue =
53- std::variant<bool , int32_t , int64_t , float , double , std::string, std::vector<uint8_t >, BelowMin, AboveMax>;
52+ std::variant<bool , // for boolean
53+ int32_t , // for int, date
54+ int64_t , // for long, timestamp, timestamp_tz, time
55+ float , // for float
56+ double , // for double
57+ std::string, // for string
58+ std::vector<uint8_t >, // for binary, fixed, decimal and uuid
59+ BelowMin, AboveMax>;
5460
5561// / \brief PrimitiveLiteral is owned literal of a primitive type.
5662class PrimitiveLiteral {
@@ -75,17 +81,19 @@ class PrimitiveLiteral {
7581 // / See [this spec](https://iceberg.apache.org/spec/#binary-single-value-serialization) for reference.
7682 Result<std::vector<uint8_t >> Serialize () const ;
7783
78- // Get the value as a variant
84+ // / Get the value as a variant
7985 const PrimitiveLiteralValue& value () const ;
8086
81- // Get the Iceberg Type of the literal
87+ // / Get the Iceberg Type of the literal
8288 const std::shared_ptr<PrimitiveType>& type () const ;
8389
84- // Cast the literal to a specific type
90+ // / Cast the literal to a specific type
8591 Result<PrimitiveLiteral> CastTo (const std::shared_ptr<PrimitiveType>& target_type) const ;
8692
8793 std::partial_ordering operator <=>(const PrimitiveLiteral& other) const ;
8894
95+ std::string ToString () const ;
96+
8997 private:
9098 PrimitiveLiteralValue value_;
9199 std::shared_ptr<PrimitiveType> type_;
0 commit comments