Skip to content

Commit 9355670

Browse files
committed
some minor enhancement
1 parent 59f60da commit 9355670

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/iceberg/datum.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,8 @@ std::partial_ordering PrimitiveLiteral::operator<=>(const PrimitiveLiteral& othe
9898
throw IcebergError("Not implemented: comparison between different primitive types");
9999
}
100100

101-
} // namespace iceberg
101+
std::string PrimitiveLiteral::ToString() const {
102+
throw NotImplemented("ToString for PrimitiveLiteral is not implemented yet");
103+
}
104+
105+
} // namespace iceberg

src/iceberg/datum.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ struct AboveMax {
4848
std::strong_ordering operator<=>(const AboveMax&) const = default;
4949
};
5050

51-
// TODO(mwish): Supports More types
5251
using 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.
5662
class 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_;

src/iceberg/expression/expression.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#pragma once
2121

22-
/// \file iceberg/expression.h
22+
/// \file iceberg/expression/expression.h
2323
/// Expression interface for Iceberg table operations.
2424

2525
#include <memory>

0 commit comments

Comments
 (0)