-
Notifications
You must be signed in to change notification settings - Fork 736
awong/iceberg v2/equality deletes #30204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 4 commits
c696dce
bd0c55d
481c8cb
8edd6fd
9df7cb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * Copyright 2026 Redpanda Data, Inc. | ||
| * | ||
| * Licensed as a Redpanda Enterprise file under the Redpanda Community | ||
| * License (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * https://github.com/redpanda-data/redpanda/blob/master/licenses/rcl.md | ||
| */ | ||
|
|
||
| #include "iceberg/equality_delete_file.h" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a test |
||
|
|
||
| #include "bytes/iostream.h" | ||
| #include "serde/parquet/writer.h" | ||
|
|
||
| namespace iceberg { | ||
|
|
||
| ss::future<delete_file_result> write_equality_delete_file( | ||
| equality_delete_options opts, | ||
| chunked_vector<serde::parquet::group_value> rows) { | ||
| iobuf file; | ||
| serde::parquet::writer w( | ||
| {.schema = std::move(opts.parquet_schema), .compress = opts.compress}, | ||
| make_iobuf_ref_output_stream(file)); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another test. |
||
| co_await w.init(); | ||
|
|
||
| auto record_count = rows.size(); | ||
| for (auto& row : rows) { | ||
| co_await w.write_row(std::move(row)); | ||
| } | ||
|
|
||
| co_await w.close(); | ||
|
|
||
| data_file df{ | ||
| .content_type = data_file_content_type::equality_deletes, | ||
| .file_path = uri{}, | ||
| .file_format = data_file_format::parquet, | ||
| .partition = partition_key{}, | ||
| .record_count = record_count, | ||
| .file_size_bytes = file.size_bytes(), | ||
| .equality_ids = std::move(opts.equality_field_ids), | ||
| }; | ||
|
|
||
| co_return delete_file_result{ | ||
| .file_data = std::move(file), | ||
| .manifest_entry = std::move(df), | ||
| }; | ||
| } | ||
|
|
||
| } // namespace iceberg | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Copyright 2026 Redpanda Data, Inc. | ||
| * | ||
| * Licensed as a Redpanda Enterprise file under the Redpanda Community | ||
| * License (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * https://github.com/redpanda-data/redpanda/blob/master/licenses/rcl.md | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include "bytes/iobuf.h" | ||
| #include "container/chunked_vector.h" | ||
| #include "iceberg/datatypes.h" | ||
| #include "iceberg/manifest_entry.h" | ||
| #include "serde/parquet/schema.h" | ||
| #include "serde/parquet/value.h" | ||
|
|
||
| #include <seastar/core/future.hh> | ||
|
|
||
| namespace iceberg { | ||
|
|
||
| struct delete_file_result { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spill to disk? |
||
| iobuf file_data; | ||
| data_file manifest_entry; | ||
| }; | ||
|
|
||
| struct equality_delete_options { | ||
| serde::parquet::schema_element parquet_schema; | ||
| chunked_vector<nested_field::id_t> equality_field_ids; | ||
| bool compress = false; | ||
| }; | ||
|
|
||
| /// \brief Write an equality delete file in parquet format from key column | ||
| /// values. | ||
| /// | ||
| /// The schema must match the equality columns from the table schema. The | ||
| /// resulting data_file has content_type=equality_deletes and equality_ids | ||
| /// populated from the provided field IDs. | ||
| ss::future<delete_file_result> write_equality_delete_file( | ||
| equality_delete_options opts, | ||
| chunked_vector<serde::parquet::group_value> rows); | ||
|
|
||
| } // namespace iceberg | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range test