3030
3131namespace iceberg {
3232
33- // / \brief PrimitiveLiteral is owned literal of a primitive type.
33+ // / \brief PrimitiveLiteral is a literal value that is associated with a primitive type.
3434class ICEBERG_EXPORT PrimitiveLiteral {
3535 private:
3636 // / \brief Exception type for values that are below the minimum allowed value for a
3737 // / primitive type.
3838 // /
3939 // / When casting a value to a narrow primitive type, if the value exceeds the maximum of
40- // / dest type, it might be above the maximum allowed value for that type.
40+ // / target type, it might be above the maximum allowed value for that type.
4141 struct BelowMin {
4242 bool operator ==(const BelowMin&) const = default ;
4343 std::strong_ordering operator <=>(const BelowMin&) const = default ;
@@ -47,7 +47,7 @@ class ICEBERG_EXPORT PrimitiveLiteral {
4747 // / primitive type.
4848 // /
4949 // / When casting a value to a narrow primitive type, if the value exceeds the maximum of
50- // / dest type, it might be above the maximum allowed value for that type.
50+ // / target type, it might be above the maximum allowed value for that type.
5151 struct AboveMax {
5252 bool operator ==(const AboveMax&) const = default ;
5353 std::strong_ordering operator <=>(const AboveMax&) const = default ;
@@ -74,18 +74,19 @@ class ICEBERG_EXPORT PrimitiveLiteral {
7474 static PrimitiveLiteral String (std::string value);
7575 static PrimitiveLiteral Binary (std::vector<uint8_t > value);
7676
77- // / Create iceberg value from bytes.
77+ // / Create iceberg literal from bytes.
7878 // /
7979 // / See [this spec](https://iceberg.apache.org/spec/#binary-single-value-serialization)
8080 // / for reference.
8181 static Result<PrimitiveLiteral> Deserialize (std::span<const uint8_t > data);
82- // / Serialize iceberg value to bytes.
82+
83+ // / Serialize iceberg literal to bytes.
8384 // /
8485 // / See [this spec](https://iceberg.apache.org/spec/#binary-single-value-serialization)
8586 // / for reference.
8687 Result<std::vector<uint8_t >> Serialize () const ;
8788
88- // / Get the Iceberg Type of the literal
89+ // / Get the Iceberg Type of the literal.
8990 const std::shared_ptr<PrimitiveType>& type () const ;
9091
9192 // / Converts this literal to a literal of the given type.
@@ -99,11 +100,12 @@ class ICEBERG_EXPORT PrimitiveLiteral {
99100 // /
100101 // / This method may return BelowMin or AboveMax when the target type is not as wide as
101102 // / the original type. These values indicate that the containing predicate can be
102- // / simplified. For example, Integer.MAX_VALUE+1 converted to an int will result in
103- // / AboveMax and can simplify a < Integer.MAX_VALUE+1 to always true.
103+ // / simplified. For example, std::numeric_limits<int>::max()+1 converted to an int will
104+ // / result in AboveMax and can simplify a < std::numeric_limits<int>::max()+1 to always
105+ // / true.
104106 // /
105- // / @ param target_type A primitive PrimitiveType
106- // / @ return A Result containing a literal of the given type or an error if conversion
107+ // / \ param target_type A primitive PrimitiveType
108+ // / \ return A Result containing a literal of the given type or an error if conversion
107109 // / was not valid
108110 Result<PrimitiveLiteral> CastTo (
109111 const std::shared_ptr<PrimitiveType>& target_type) const ;
@@ -127,7 +129,6 @@ class ICEBERG_EXPORT PrimitiveLiteral {
127129 Result<PrimitiveLiteral> CastFromInt (TypeId target_type_id) const ;
128130 Result<PrimitiveLiteral> CastFromLong (TypeId target_type_id) const ;
129131 Result<PrimitiveLiteral> CastFromFloat (TypeId target_type_id) const ;
130- Result<PrimitiveLiteral> CastFromDouble (TypeId target_type_id) const ;
131132
132133 private:
133134 PrimitiveLiteralValue value_;
0 commit comments