Skip to content

Commit 8db6621

Browse files
committed
fix: resolve all signed/unsigned integer comparison warnings
- Fix PARSE_PRIMITIVE_FIELD macro (line 42-43) - Fix PARSE_STRING_FIELD macro (line 54-55) - Fix PARSE_BINARY_FIELD macro (line 66-67) - Fix view_of_file_field->length loop (line 360-361) - Fix view_of_partition->length loop (line 376-377) - Use static_cast<size_t>() for all Arrow array length comparisons - Resolves all modernize-use-integer-sign-comparison clang-tidy warnings
1 parent 9669237 commit 8db6621

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/iceberg/manifest_reader_internal.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ namespace iceberg {
3939
}
4040

4141
#define PARSE_PRIMITIVE_FIELD(item, array_view, type) \
42-
for (size_t row_idx = 0; row_idx < array_view->length; row_idx++) { \
42+
for (size_t row_idx = 0; row_idx < static_cast<size_t>(array_view->length); \
43+
row_idx++) { \
4344
if (!ArrowArrayViewIsNull(array_view, row_idx)) { \
4445
auto value = ArrowArrayViewGetIntUnsafe(array_view, row_idx); \
4546
item = static_cast<type>(value); \
@@ -50,7 +51,8 @@ namespace iceberg {
5051
}
5152

5253
#define PARSE_STRING_FIELD(item, array_view) \
53-
for (size_t row_idx = 0; row_idx < array_view->length; row_idx++) { \
54+
for (size_t row_idx = 0; row_idx < static_cast<size_t>(array_view->length); \
55+
row_idx++) { \
5456
if (!ArrowArrayViewIsNull(array_view, row_idx)) { \
5557
auto value = ArrowArrayViewGetStringUnsafe(array_view, row_idx); \
5658
item = std::string(value.data, value.size_bytes); \
@@ -61,7 +63,8 @@ namespace iceberg {
6163
}
6264

6365
#define PARSE_BINARY_FIELD(item, array_view) \
64-
for (size_t row_idx = 0; row_idx < array_view->length; row_idx++) { \
66+
for (size_t row_idx = 0; row_idx < static_cast<size_t>(array_view->length); \
67+
row_idx++) { \
6568
if (!ArrowArrayViewIsNull(view_of_column, row_idx)) { \
6669
item = ArrowArrayViewGetInt8Vector(array_view, row_idx); \
6770
} else if (required) { \
@@ -357,7 +360,8 @@ Status ParseDataFile(const std::shared_ptr<StructType>& data_file_schema,
357360
view_of_file_field);
358361
break;
359362
case 2:
360-
for (size_t row_idx = 0; row_idx < view_of_file_field->length; row_idx++) {
363+
for (size_t row_idx = 0;
364+
row_idx < static_cast<size_t>(view_of_file_field->length); row_idx++) {
361365
if (!ArrowArrayViewIsNull(view_of_file_field, row_idx)) {
362366
auto value = ArrowArrayViewGetStringUnsafe(view_of_file_field, row_idx);
363367
std::string_view path_str(value.data, value.size_bytes);

0 commit comments

Comments
 (0)