@@ -72,7 +72,8 @@ Result<std::shared_ptr<DataFileMeta>> DataFileMeta::ForAppend(
7272 file_name, file_size, row_count, EmptyMinKey (), EmptyMaxKey (), SimpleStats::EmptyStats (),
7373 row_stats, min_sequence_number, max_sequence_number, schema_id, DUMMY_LEVEL , extra_files,
7474 Timestamp (/* millisecond=*/ local_micro / 1000 , /* nano_of_millisecond=*/ 0 ), 0ll ,
75- embedded_index, file_source, value_stats_cols, external_path, first_row_id, write_cols);
75+ embedded_index, file_source, value_stats_cols, external_path, first_row_id, write_cols,
76+ /* column_max_sequence_numbers=*/ std::nullopt );
7677}
7778
7879Result<std::shared_ptr<DataFileMeta>> DataFileMeta::Upgrade (int32_t new_level) const {
@@ -84,7 +85,7 @@ Result<std::shared_ptr<DataFileMeta>> DataFileMeta::Upgrade(int32_t new_level) c
8485 file_name, file_size, row_count, min_key, max_key, key_stats, value_stats,
8586 min_sequence_number, max_sequence_number, schema_id, new_level, extra_files, creation_time,
8687 delete_row_count, embedded_index, file_source, value_stats_cols, external_path,
87- first_row_id, write_cols);
88+ first_row_id, write_cols, column_max_sequence_numbers );
8889}
8990
9091std::shared_ptr<DataFileMeta> DataFileMeta::CopyWithExtraFiles (
@@ -93,15 +94,24 @@ std::shared_ptr<DataFileMeta> DataFileMeta::CopyWithExtraFiles(
9394 file_name, file_size, row_count, min_key, max_key, key_stats, value_stats,
9495 min_sequence_number, max_sequence_number, schema_id, level, new_extra_files, creation_time,
9596 delete_row_count, embedded_index, file_source, value_stats_cols, external_path,
96- first_row_id, write_cols);
97+ first_row_id, write_cols, column_max_sequence_numbers);
98+ }
99+
100+ std::shared_ptr<DataFileMeta> DataFileMeta::CopyWithColumnMaxSequenceNumbers (
101+ const std::optional<std::vector<int64_t >>& new_column_max_sequence_numbers) const {
102+ return std::make_shared<DataFileMeta>(
103+ file_name, file_size, row_count, min_key, max_key, key_stats, value_stats,
104+ min_sequence_number, max_sequence_number, schema_id, level, extra_files, creation_time,
105+ delete_row_count, embedded_index, file_source, value_stats_cols, external_path,
106+ first_row_id, write_cols, new_column_max_sequence_numbers);
97107}
98108
99109std::shared_ptr<DataFileMeta> DataFileMeta::CopyWithoutStats () const {
100110 return std::make_shared<DataFileMeta>(
101111 file_name, file_size, row_count, min_key, max_key, key_stats, SimpleStats::EmptyStats (),
102112 min_sequence_number, max_sequence_number, schema_id, level, extra_files, creation_time,
103113 delete_row_count, embedded_index, file_source, std::vector<std::string>(), external_path,
104- first_row_id, write_cols);
114+ first_row_id, write_cols, column_max_sequence_numbers );
105115}
106116
107117DataFileMeta::DataFileMeta (
@@ -113,7 +123,8 @@ DataFileMeta::DataFileMeta(
113123 const std::shared_ptr<Bytes>& _embedded_index, const std::optional<FileSource>& _file_source,
114124 const std::optional<std::vector<std::string>>& _value_stats_cols,
115125 const std::optional<std::string>& _external_path, const std::optional<int64_t >& _first_row_id,
116- const std::optional<std::vector<std::string>>& _write_cols)
126+ const std::optional<std::vector<std::string>>& _write_cols,
127+ const std::optional<std::vector<int64_t >>& _column_max_sequence_numbers)
117128 : file_name(_file_name),
118129 file_size (_file_size),
119130 row_count(_row_count),
@@ -133,7 +144,8 @@ DataFileMeta::DataFileMeta(
133144 value_stats_cols(_value_stats_cols),
134145 external_path(_external_path),
135146 first_row_id(_first_row_id),
136- write_cols(_write_cols) {}
147+ write_cols(_write_cols),
148+ column_max_sequence_numbers(_column_max_sequence_numbers) {}
137149
138150Result<std::string> DataFileMeta::FileFormat () const {
139151 size_t last_dot_index = file_name.find_last_of (" ." );
@@ -198,7 +210,8 @@ bool DataFileMeta::operator==(const DataFileMeta& other) const {
198210 creation_time == other.creation_time && delete_row_count == other.delete_row_count &&
199211 file_source == other.file_source && value_stats_cols == other.value_stats_cols &&
200212 external_path == other.external_path && first_row_id == other.first_row_id &&
201- write_cols == other.write_cols ;
213+ write_cols == other.write_cols &&
214+ column_max_sequence_numbers == other.column_max_sequence_numbers ;
202215}
203216
204217bool DataFileMeta::operator !=(const DataFileMeta& other) const {
@@ -243,7 +256,8 @@ bool DataFileMeta::TEST_Equal(const DataFileMeta& other) const {
243256 level == other.level && delete_row_count == other.delete_row_count &&
244257 file_source == other.file_source && value_stats_cols == other.value_stats_cols &&
245258 compare_optional_ignore_name (external_path, other.external_path ) &&
246- first_row_id == other.first_row_id && write_cols == other.write_cols ;
259+ first_row_id == other.first_row_id && write_cols == other.write_cols &&
260+ column_max_sequence_numbers == other.column_max_sequence_numbers ;
247261}
248262
249263std::string DataFileMeta::ToString () const {
@@ -261,7 +275,8 @@ std::string DataFileMeta::ToString() const {
261275 " {}, "
262276 " keyStats: {}, valueStats: {}, minSequenceNumber: {}, maxSequenceNumber: {}, schemaId: "
263277 " {}, level: {}, extraFiles: {}, creationTime: {}, deleteRowCount: {}, fileSource: {}, "
264- " valueStatsCols: {}, externalPath: {}, firstRowId: {}, writeCols: {}}}" ,
278+ " valueStatsCols: {}, externalPath: {}, firstRowId: {}, writeCols: {}, "
279+ " columnMaxSequenceNumbers: {}}}" ,
265280 file_name, file_size, row_count,
266281 embedded_index == nullptr ? " null"
267282 : std::string (embedded_index->data (), embedded_index->size ()),
@@ -275,7 +290,10 @@ std::string DataFileMeta::ToString() const {
275290 : fmt::format (" {}" , fmt::join (value_stats_cols.value (), " , " )),
276291 external_path == std::nullopt ? " null" : external_path.value (),
277292 first_row_id == std::nullopt ? " null" : std::to_string (first_row_id.value ()),
278- write_cols == std::nullopt ? " null" : fmt::format (" {}" , write_cols.value ()));
293+ write_cols == std::nullopt ? " null" : fmt::format (" {}" , write_cols.value ()),
294+ column_max_sequence_numbers == std::nullopt
295+ ? " null"
296+ : fmt::format (" {}" , column_max_sequence_numbers.value ()));
279297}
280298
281299int64_t DataFileMeta::GetMaxSequenceNumber (
@@ -315,6 +333,9 @@ const std::shared_ptr<arrow::DataType>& DataFileMeta::DataType() {
315333 arrow::field (" _FIRST_ROW_ID" , arrow::int64 (), /* nullable=*/ true ),
316334 arrow::field (" _WRITE_COLS" ,
317335 arrow::list (arrow::field (" item" , arrow::utf8 (), /* nullable=*/ false )),
336+ /* nullable=*/ true ),
337+ arrow::field (" _WRITE_COLS_SEQUENCES" ,
338+ arrow::list (arrow::field (" item" , arrow::int64 (), /* nullable=*/ false )),
318339 /* nullable=*/ true )});
319340 return schema;
320341}
0 commit comments