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

[core] Fix duplicate primary keys in query results #3158

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

zhourui999
Copy link
Contributor

@zhourui999 zhourui999 commented Apr 5, 2024

Purpose

Linked issue: #3157

Because the same builder is used in the for loop of generateSplits in SnapshotReaderImpl, if rawConvertible is true the last time, it will affect the value of the next Datasplit rawFiles. The ultimate result is the need for MergeRedier's Datasplit, as rawFiles were mistakenly set and NoMergeReader was created, resulting in duplicate data during reading

image

image

Tests

API and Format

Documentation

@zhourui999 zhourui999 changed the title fix: query values with the same primary key [core] query values with the same primary key Apr 5, 2024
@zhourui999 zhourui999 changed the title [core] query values with the same primary key [core] fix query values with the same primary key Apr 5, 2024
@zhourui999 zhourui999 changed the title [core] fix query values with the same primary key [core] Fix query with the same primary key Apr 5, 2024
@zhourui999 zhourui999 changed the title [core] Fix query with the same primary key [core] Fix duplicate primary keys in query results Apr 6, 2024
@Zouxxyy
Copy link
Contributor

Zouxxyy commented Apr 7, 2024

Thanks for pointing it out!

.withSnapshot(snapshotId)
.withPartition(partition)
.withBucket(bucket)
.isStreaming(isStreaming);
List<DataFileMeta> dataFiles = splitGroup.files;
builder.withDataFiles(dataFiles);
if (splitGroup.rawConvertible) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It can also be modified this way.
I think the current implementation is okay too, what do you think? @JingsongLi

builder.rawFiles(
               splitGroup.rawConvertible
                       ? convertToRawFiles(partition, bucket, dataFiles)
                       : Collections.emptyList());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay,I think your suggestion is better. I'll make some changes

@JingsongLi
Copy link
Contributor

+1

@zhourui999 zhourui999 force-pushed the bug_fix_same_primary_key branch from 275da6e to 249dacd Compare April 7, 2024 02:43
@JingsongLi JingsongLi merged commit ed97beb into apache:master Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants