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

Spark: Positional deletes creates partitioned path on unpartitioned tables #7685

Merged
merged 4 commits into from
Jun 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected void openCurrentWriter() {
}

private EncryptedOutputFile newFile() {
if (partition == null) {
if (spec.isUnpartitioned() || partition == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this check needs to be added to other writers, like FanoutWriter, ClusteredWriter. They all have the same pattern.

    return partition == null
        ? fileFactory.newOutputFile()
        : fileFactory.newOutputFile(spec, partition);
  }

Originally I was wondering if this check should be done in the method below of OutputFileFactory class. But I see it is not appropriate, as the Java doc clearly indicates that this method should be used for partitioned writes. Hence caller needs to separate out unpartitioned vs partitioned writes.

  /** Generates an {@link EncryptedOutputFile} for partitioned writes in a given spec. */
  public EncryptedOutputFile newOutputFile(PartitionSpec spec, StructLike partition) 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with adding those as well. WDYT @aokolnychyi

return fileFactory.newOutputFile();
} else {
return fileFactory.newOutputFile(spec, partition);
Expand Down