Skip to content

Commit b54cfd2

Browse files
committed
parse blob footer
1 parent 2f30859 commit b54cfd2

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

be/src/vec/exec/format/table/iceberg_reader.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
#include <gen_cpp/parquet_types.h>
2424
#include <glog/logging.h>
2525
#include <parallel_hashmap/phmap.h>
26-
#include <rapidjson/allocators.h>
2726
#include <rapidjson/document.h>
2827

2928
#include <algorithm>
30-
#include <boost/iterator/iterator_facade.hpp>
3129
#include <cstring>
3230
#include <functional>
3331
#include <memory>
@@ -37,8 +35,7 @@
3735
#include "runtime/define_primitive_type.h"
3836
#include "runtime/primitive_type.h"
3937
#include "runtime/runtime_state.h"
40-
#include "runtime/types.h"
41-
#include "util/string_util.h"
38+
#include "util/coding.h"
4239
#include "vec/aggregate_functions/aggregate_function.h"
4340
#include "vec/columns/column.h"
4441
#include "vec/columns/column_string.h"
@@ -815,6 +812,7 @@ Status IcebergTableReader::read_deletion_vector(const std::string& data_file_pat
815812
size_t buffer_size = delete_range.size;
816813
std::vector<char> buf(buffer_size);
817814
if (buffer_size < 12) [[unlikely]] {
815+
// Minimum size: 4 bytes length + 4 bytes magic + 4 bytes CRC32
818816
create_status = Status::DataQualityError("Deletion vector file size too small: {}",
819817
buffer_size);
820818
return nullptr;
@@ -839,12 +837,11 @@ Status IcebergTableReader::read_deletion_vector(const std::string& data_file_pat
839837
return nullptr;
840838
}
841839

842-
// constexpr static char MAGIC_NUMBER[] = {'\xD1', '\xD3', '\x39', '\x64'};
843-
// if (memcmp(buf.data() + sizeof(total_length), MAGIC_NUMBER, 4), 0 != 0) [[unlikely]] {
844-
// create_status = Status::DataQualityError(
845-
// "Deletion vector magic number mismatch");
846-
// return nullptr;
847-
// }
840+
constexpr static char MAGIC_NUMBER[] = {'\xD1', '\xD3', '\x39', '\x64'};
841+
if (memcmp(buf.data() + sizeof(total_length), MAGIC_NUMBER, 4)) [[unlikely]] {
842+
create_status = Status::DataQualityError("Deletion vector magic number mismatch");
843+
return nullptr;
844+
}
848845

849846
roaring::Roaring64Map bitmap;
850847
SCOPED_TIMER(_iceberg_profile.parse_delete_file_time);

0 commit comments

Comments
 (0)