Skip to content
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

[Feature] Support query deletion vector for delta lake #53766

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

Youngwb
Copy link
Contributor

@Youngwb Youngwb commented Dec 10, 2024

Why I'm doing:

What I'm doing:

Support query deletion vector for delta lake
Fixes #53767

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@Youngwb Youngwb requested review from a team as code owners December 10, 2024 08:40
@wanpengfei-git wanpengfei-git requested a review from a team December 10, 2024 08:40
be/src/exprs/base85.cpp Outdated Show resolved Hide resolved
@Youngwb Youngwb requested a review from a team as a code owner December 10, 2024 09:34
@Youngwb Youngwb force-pushed the dv_poc branch 2 times, most recently from 6c1fde6 to 64ef676 Compare December 10, 2024 12:38
@@ -315,6 +315,15 @@ struct TPaimonDeletionFile {
3: optional i64 length
}

// refer to https://github.com/delta-io/delta/blob/master/PROTOCOL.md#deletion-vector-descriptor-schema
struct TDeletionVectorDescriptor {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is iceberg dv going to reuse this field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Signed-off-by: Youngwb <[email protected]>
Copy link

sonarcloud bot commented Dec 12, 2024

uint64_t bitmap_cardinality = roaring64_bitmap_get_cardinality(bitmap);
std::unique_ptr<uint64_t[]> bitmap_array(new uint64_t[bitmap_cardinality]);
roaring64_bitmap_to_uint64_array(bitmap, bitmap_array.get());
need_skip_rowids->insert(bitmap_array.get(), bitmap_array.get() + bitmap_cardinality);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since eventually need_skip_rowids will be converted to flat bitmap, we should construct the flat bitmap directly from roaring64_bitmap_t.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but here we can still need this set, because the group reader need this set to find lowr/upper bound
image

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 14 / 14 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/connector/delta/FileScanTask.java 3 3 100.00% []
🔵 com/starrocks/connector/delta/DeltaConnectorScanRangeSource.java 8 8 100.00% []
🔵 com/starrocks/connector/delta/ScanFileUtils.java 2 2 100.00% []
🔵 com/starrocks/connector/delta/DeltaLakeMetadata.java 1 1 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 130 / 145 (89.66%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/connector/deletion_vector/deletion_vector.cpp 86 98 87.76% [28, 51, 52, 53, 54, 116, 117, 118, 119, 125, 147, 156]
🔵 be/src/util/base85.cpp 28 31 90.32% [57, 62, 72]
🔵 be/src/connector/deletion_vector/deletion_vector.h 5 5 100.00% []
🔵 be/src/connector/hive_connector.cpp 4 4 100.00% []
🔵 be/src/exec/hdfs_scanner.cpp 4 4 100.00% []
🔵 be/src/exec/hdfs_scanner_parquet.cpp 3 3 100.00% []

offset += MAGIC_NUMBER_LENGTH;

int64_t serialized_bitmap_length = length - MAGIC_NUMBER_LENGTH;
std::unique_ptr<char[]> deletion_vector(new char[serialized_bitmap_length]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just use std::vector.

unique_ptr<char[]> is little weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I will modify this next PR

Copy link
Contributor

@dirtysalt dirtysalt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dirtysalt
Copy link
Contributor

@Youngwb great job. We can support deletion vector on delta lake finally!

Copy link
Contributor

@DorianZheng DorianZheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DorianZheng DorianZheng enabled auto-merge (squash) December 12, 2024 07:34
@DorianZheng DorianZheng merged commit 66b78c4 into StarRocks:main Dec 12, 2024
64 of 67 checks passed
@Youngwb
Copy link
Contributor Author

Youngwb commented Dec 13, 2024

@mergify backport branch-3.4

Copy link
Contributor

mergify bot commented Dec 13, 2024

backport branch-3.4

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 13, 2024
wanpengfei-git pushed a commit that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support deletion vector for delta lake
8 participants