Skip to content

[C++] Add option to not create parent directory with S3 delete_file #36275

Description

@dacort

Describe the enhancement requested

Today, when using delete_file with S3FileSystem, it will create an empty file if there's no "directory".

Example:

Before:

aws s3 ls s3://bucket/prefix/
2023-06-23 11:43:53        668 prefix/01/file1.json.gz
2023-06-23 11:35:24       1438 prefix/01/file2.json.gz
2023-06-23 10:47:18        819 prefix/01/file3.json.gz

Run S3FileSystem::delete_file on file1.json.gz

After:

2023-06-23 11:51:02          0 prefix/01/
2023-06-23 11:35:24       1438 prefix/01/file2.json.gz
2023-06-23 10:47:18        819 prefix/01/file3.json.gz

This is due to this line that calls EnsureParentExists.

Unfortunately, this results in 0-byte files getting created on S3, even if there are other objects in the "directory". It seems like this was somewhat intentional based on this comment in the original PR.

That said, I'd love for the ability do disable this. delete_file shouldn't create additional files/directories in S3.

Component(s)

Other

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions