-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix](iceberg)Fix count(*) error with dangling delete problem (#44039)
### What problem does this PR solve? Prevent 'dangling delete' problem after `rewrite_data_files` action. ref: https://iceberg.apache.org/docs/nightly/spark-procedures/#rewrite_position_delete_files. Because we don’t know whether the user has performed a rewrite operation, `total-records` will only be used directly when equalitydelete and positiondelete are both 0. Issue Number: close #42240
- Loading branch information
Showing
11 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
...thirdparties/docker-compose/iceberg/scripts/create_preinstalled_scripts/iceberg/run06.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use demo.test_db; | ||
|
||
drop table if exists dangling_delete_after_write; | ||
create table dangling_delete_after_write ( | ||
id BIGINT NOT NULL, | ||
val STRING) | ||
USING iceberg | ||
TBLPROPERTIES ( | ||
'format' = 'iceberg/parquet', | ||
'format-version' = '2', | ||
'identifier-fields' = '[id]', | ||
'upsert-enabled' = 'true', | ||
'write.delete.mode' = 'merge-on-read', | ||
'write.parquet.compression-codec' = 'zstd', | ||
'write.update.mode' = 'merge-on-read', | ||
'write.upsert.enabled' = 'true'); | ||
|
||
insert into dangling_delete_after_write values(1, 'abd'); | ||
update dangling_delete_after_write set val = 'def' where id = 1; | ||
call demo.system.rewrite_data_files(table => 'demo.test_db.dangling_delete_after_write', options => map('min-input-files', '1')); | ||
insert into dangling_delete_after_write values(2, 'xyz'); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ | |
-- !q08 -- | ||
1000 | ||
|
||
-- !q09 -- | ||
2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters