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

Fix stream output when the same file occurs with different DVs in the same batch #1897

Merged

Conversation

larsk-db
Copy link
Contributor

@larsk-db larsk-db commented Jul 11, 2023

Cherry-pick of d36623f for branch-2.4

Description

There was an edge case in streaming with deletion vectors in the source, where in ignoreChanges-mode it could happen that if the same file occurred with different DVs in the same batch (or both with a DV and without a DV), then we would read the file with the wrong DV, since we broadcast the DVs to the scans by data file path.

This PR fixes this issue, by reading files from different versions in different scans and then taking the union of the result to build the final DataFrame for the batch.

How was this patch tested?

Added new tests for having 2 DML commands (DELETE->DELETE and DELETE->INSERT) in the same batch for all change modi.

Does this PR introduce any user-facing changes?

No.

import org.apache.spark.sql.streaming.{StreamTest, Trigger}
import org.apache.spark.sql.streaming.util.StreamManualClock

trait DeltaSourceDeletionVectorTests extends StreamTest with DeletionVectorsTestUtils {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also cherry-pick once the flaky test fix is in the master.

@vkorukanti vkorukanti merged commit de19540 into delta-io:branch-2.4 Aug 22, 2023
4 of 5 checks passed
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.

2 participants