Skip to content

Commit 470259d

Browse files
mapleFUwgtmac
andauthored
Apply suggestions from code review
Co-authored-by: Gang Wu <[email protected]>
1 parent 1d7f904 commit 470259d

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/iceberg/expression/literal.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,17 @@ namespace iceberg {
3333
/// \brief Literal is a literal value that is associated with a primitive type.
3434
class ICEBERG_EXPORT Literal {
3535
private:
36-
/// \brief Exception type for values that are below the minimum allowed value for a
36+
/// \brief Sentinel value to indicate that the literal value is below the valid range
37+
/// of a specific primitive type. It can happen when casting a literal to a narrower
3738
/// primitive type.
38-
///
39-
/// When casting a value to a narrow primitive type, if the value exceeds the maximum of
40-
/// target type, it might be above the maximum allowed value for that type.
4139
struct BelowMin {
4240
bool operator==(const BelowMin&) const = default;
4341
std::strong_ordering operator<=>(const BelowMin&) const = default;
4442
};
4543

46-
/// \brief Exception type for values that are above the maximum allowed value for a
44+
/// \brief Sentinel value to indicate that the literal value is above the valid range
45+
/// of a specific primitive type. It can happen when casting a literal to a narrower
4746
/// primitive type.
48-
///
49-
/// When casting a value to a narrow primitive type, if the value exceeds the maximum of
50-
/// target type, it might be above the maximum allowed value for that type.
5147
struct AboveMax {
5248
bool operator==(const AboveMax&) const = default;
5349
std::strong_ordering operator<=>(const AboveMax&) const = default;
@@ -64,7 +60,7 @@ class ICEBERG_EXPORT Literal {
6460
BelowMin, AboveMax>;
6561

6662
public:
67-
/// Factory methods for primitive types
63+
/// \brief Factory methods for primitive types
6864
static Literal Boolean(bool value);
6965
static Literal Int(int32_t value);
7066
static Literal Long(int64_t value);
@@ -73,23 +69,23 @@ class ICEBERG_EXPORT Literal {
7369
static Literal String(std::string value);
7470
static Literal Binary(std::vector<uint8_t> value);
7571

76-
/// Create iceberg literal from bytes.
72+
/// \brief Restore a literal from single-value serialization.
7773
///
7874
/// See [this spec](https://iceberg.apache.org/spec/#binary-single-value-serialization)
7975
/// for reference.
8076
static Result<Literal> Deserialize(std::span<const uint8_t> data,
8177
std::shared_ptr<PrimitiveType> type);
8278

83-
/// Serialize iceberg literal to bytes.
79+
/// \brief Perform single-value serialization.
8480
///
8581
/// See [this spec](https://iceberg.apache.org/spec/#binary-single-value-serialization)
8682
/// for reference.
8783
Result<std::vector<uint8_t>> Serialize() const;
8884

89-
/// Get the Iceberg Type of the literal.
85+
/// \brief Get the literal type.
9086
const std::shared_ptr<PrimitiveType>& type() const;
9187

92-
/// Converts this literal to a literal of the given type.
88+
/// \brief Converts this literal to a literal of the given type.
9389
///
9490
/// When a predicate is bound to a concrete data column, literals are converted to match
9591
/// the bound column's type. This conversion process is more narrow than a cast and is
@@ -109,7 +105,7 @@ class ICEBERG_EXPORT Literal {
109105
/// was not valid
110106
Result<Literal> CastTo(const std::shared_ptr<PrimitiveType>& target_type) const;
111107

112-
/// Compare two PrimitiveLiterals. Both literals must have the same type
108+
/// \brief Compare two PrimitiveLiterals. Both literals must have the same type
113109
/// and should not be AboveMax or BelowMin.
114110
std::partial_ordering operator<=>(const Literal& other) const;
115111

0 commit comments

Comments
 (0)