@@ -72,11 +72,11 @@ Result<std::vector<std::unique_ptr<ManifestFile>>> ParseManifestListEntry(
7272 auto field_name = field.value ().get ().name ();
7373 auto view_of_column = array_view.children [idx];
7474
75- #define PARSE_PRIMITIVE_FIELD (field_name ) \
75+ #define PARSE_PRIMITIVE_FIELD (field_name, type ) \
7676 for (size_t row_idx = 0 ; row_idx < view_of_column->length ; row_idx++) { \
7777 if (!ArrowArrayViewIsNull (view_of_column, row_idx)) { \
7878 auto value = ArrowArrayViewGetIntUnsafe (view_of_column, row_idx); \
79- manifest_files[row_idx]->field_name = value; \
79+ manifest_files[row_idx]->field_name = static_cast <type>( value); \
8080 } \
8181 }
8282
@@ -89,9 +89,9 @@ Result<std::vector<std::unique_ptr<ManifestFile>>> ParseManifestListEntry(
8989 }
9090 }
9191 } else if (field_name == ManifestFile::kManifestLength .name ()) {
92- PARSE_PRIMITIVE_FIELD (manifest_length);
92+ PARSE_PRIMITIVE_FIELD (manifest_length, int64_t );
9393 } else if (field_name == ManifestFile::kPartitionSpecId .name ()) {
94- PARSE_PRIMITIVE_FIELD (partition_spec_id);
94+ PARSE_PRIMITIVE_FIELD (partition_spec_id, int32_t );
9595 } else if (field_name == ManifestFile::kContent .name ()) {
9696 for (size_t row_idx = 0 ; row_idx < view_of_column->length ; row_idx++) {
9797 if (!ArrowArrayViewIsNull (view_of_column, row_idx)) {
@@ -100,23 +100,23 @@ Result<std::vector<std::unique_ptr<ManifestFile>>> ParseManifestListEntry(
100100 }
101101 }
102102 } else if (field_name == ManifestFile::kSequenceNumber .name ()) {
103- PARSE_PRIMITIVE_FIELD (sequence_number);
103+ PARSE_PRIMITIVE_FIELD (sequence_number, int64_t );
104104 } else if (field_name == ManifestFile::kMinSequenceNumber .name ()) {
105- PARSE_PRIMITIVE_FIELD (min_sequence_number);
105+ PARSE_PRIMITIVE_FIELD (min_sequence_number, int64_t );
106106 } else if (field_name == ManifestFile::kAddedSnapshotId .name ()) {
107- PARSE_PRIMITIVE_FIELD (added_snapshot_id);
107+ PARSE_PRIMITIVE_FIELD (added_snapshot_id, int64_t );
108108 } else if (field_name == ManifestFile::kAddedFilesCount .name ()) {
109- PARSE_PRIMITIVE_FIELD (added_files_count);
109+ PARSE_PRIMITIVE_FIELD (added_files_count, int32_t );
110110 } else if (field_name == ManifestFile::kExistingFilesCount .name ()) {
111- PARSE_PRIMITIVE_FIELD (existing_files_count);
111+ PARSE_PRIMITIVE_FIELD (existing_files_count, int32_t );
112112 } else if (field_name == ManifestFile::kDeletedFilesCount .name ()) {
113- PARSE_PRIMITIVE_FIELD (deleted_files_count);
113+ PARSE_PRIMITIVE_FIELD (deleted_files_count, int32_t );
114114 } else if (field_name == ManifestFile::kAddedRowsCount .name ()) {
115- PARSE_PRIMITIVE_FIELD (added_rows_count);
115+ PARSE_PRIMITIVE_FIELD (added_rows_count, int64_t );
116116 } else if (field_name == ManifestFile::kExistingRowsCount .name ()) {
117- PARSE_PRIMITIVE_FIELD (existing_rows_count);
117+ PARSE_PRIMITIVE_FIELD (existing_rows_count, int64_t );
118118 } else if (field_name == ManifestFile::kDeletedRowsCount .name ()) {
119- PARSE_PRIMITIVE_FIELD (deleted_rows_count);
119+ PARSE_PRIMITIVE_FIELD (deleted_rows_count, int64_t );
120120 } else if (field_name == ManifestFile::kPartitions .name ()) {
121121 // view_of_column is list<struct<PartitionFieldSummary>>
122122 auto manifest_count = view_of_column->length ;
@@ -185,12 +185,13 @@ Result<std::vector<std::unique_ptr<ManifestFile>>> ParseManifestListEntry(
185185 } else if (field_name == ManifestFile::kKeyMetadata .name ()) {
186186 for (size_t row_idx = 0 ; row_idx < view_of_column->length ; row_idx++) {
187187 if (!ArrowArrayViewIsNull (view_of_column, row_idx)) {
188- auto value = ArrowArrayViewGetUIntUnsafe (view_of_column, row_idx);
189- manifest_files[row_idx]->key_metadata .push_back (value);
188+ auto buffer = ArrowArrayViewGetBytesUnsafe (view_of_column, row_idx);
189+ manifest_files[row_idx]->key_metadata = std::vector<uint8_t >(
190+ buffer.data .as_char , buffer.data .as_char + buffer.size_bytes );
190191 }
191192 }
192193 } else if (field_name == ManifestFile::kFirstRowId .name ()) {
193- PARSE_PRIMITIVE_FIELD (first_row_id);
194+ PARSE_PRIMITIVE_FIELD (first_row_id, int64_t );
194195 } else {
195196 return InvalidArgument (" Unsupported type: {}" , field_name);
196197 }
0 commit comments