Skip to content

Commit 9a8af01

Browse files
committed
fix: review comments
1 parent be2d7e6 commit 9a8af01

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

src/iceberg/expression/literal.cc

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ Literal Literal::Date(int32_t value) { return {Value{value}, iceberg::date()}; }
134134

135135
Literal Literal::Long(int64_t value) { return {Value{value}, iceberg::int64()}; }
136136

137+
Literal Literal::Time(int64_t value) { return {Value{value}, iceberg::time()}; }
138+
137139
Literal Literal::Timestamp(int64_t value) { return {Value{value}, iceberg::timestamp()}; }
138140

139141
Literal Literal::TimestampTz(int64_t value) {
@@ -210,30 +212,15 @@ std::partial_ordering Literal::operator<=>(const Literal& other) const {
210212
return this_val ? std::partial_ordering::greater : std::partial_ordering::less;
211213
}
212214

213-
case TypeId::kInt: {
214-
auto this_val = std::get<int32_t>(value_);
215-
auto other_val = std::get<int32_t>(other.value_);
216-
return this_val <=> other_val;
217-
}
218-
215+
case TypeId::kInt:
219216
case TypeId::kDate: {
220217
auto this_val = std::get<int32_t>(value_);
221218
auto other_val = std::get<int32_t>(other.value_);
222219
return this_val <=> other_val;
223220
}
224221

225-
case TypeId::kLong: {
226-
auto this_val = std::get<int64_t>(value_);
227-
auto other_val = std::get<int64_t>(other.value_);
228-
return this_val <=> other_val;
229-
}
230-
231-
case TypeId::kTimestamp: {
232-
auto this_val = std::get<int64_t>(value_);
233-
auto other_val = std::get<int64_t>(other.value_);
234-
return this_val <=> other_val;
235-
}
236-
222+
case TypeId::kLong:
223+
case TypeId::kTimestamp:
237224
case TypeId::kTimestampTz: {
238225
auto this_val = std::get<int64_t>(value_);
239226
auto other_val = std::get<int64_t>(other.value_);

src/iceberg/expression/literal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class ICEBERG_EXPORT Literal {
4949
std::strong_ordering operator<=>(const AboveMax&) const = default;
5050
};
5151

52+
public:
5253
using Value = std::variant<bool, // for boolean
5354
int32_t, // for int, date
5455
int64_t, // for long, timestamp, timestamp_tz, time
@@ -59,12 +60,12 @@ class ICEBERG_EXPORT Literal {
5960
std::array<uint8_t, 16>, // for uuid and decimal
6061
BelowMin, AboveMax>;
6162

62-
public:
6363
/// \brief Factory methods for primitive types
6464
static Literal Boolean(bool value);
6565
static Literal Int(int32_t value);
6666
static Literal Date(int32_t value);
6767
static Literal Long(int64_t value);
68+
static Literal Time(int64_t value);
6869
static Literal Timestamp(int64_t value);
6970
static Literal TimestampTz(int64_t value);
7071
static Literal Float(float value);

src/iceberg/manifest_reader_internal.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333

3434
namespace iceberg {
3535

36+
#define NANOARROW_RETURN_IF_NOT_OK(status, error) \
37+
if (status != NANOARROW_OK) [[unlikely]] { \
38+
return InvalidArrowData("Nanoarrow error: {}", error.message); \
39+
}
40+
3641
#define PARSE_PRIMITIVE_FIELD(item, array_view, type) \
3742
for (size_t row_idx = 0; row_idx < array_view->length; row_idx++) { \
3843
if (!ArrowArrayViewIsNull(array_view, row_idx)) { \

src/iceberg/util/macros.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,3 @@
3636
#define ICEBERG_ASSIGN_OR_RAISE(lhs, rexpr) \
3737
ICEBERG_ASSIGN_OR_RAISE_IMPL(ICEBERG_ASSIGN_OR_RAISE_NAME(result_, __COUNTER__), lhs, \
3838
rexpr)
39-
40-
#define NANOARROW_RETURN_IF_NOT_OK(status, error) \
41-
if (status != NANOARROW_OK) [[unlikely]] { \
42-
return InvalidArrowData("Nanoarrow error: {}", error.message); \
43-
}

0 commit comments

Comments
 (0)