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 handling of Hive ACID tables with hidden directories #16773

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -312,8 +312,7 @@ private static List<FileEntry> listFiles(TrinoFileSystem fileSystem, String dire
FileIterator iterator = fileSystem.listFiles(directory);
while (iterator.hasNext()) {
FileEntry file = iterator.next();
String name = new Path(file.location()).getName();
if (!name.startsWith("_") && !name.startsWith(".")) {
if (!file.location().contains("/_") && !file.location().contains("/.")) {
files.add(file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public void testOriginal()
new MockFile("mock:/tbl/part1/000002_0", 500, FAKE_DATA),
new MockFile("mock:/tbl/part1/random", 500, FAKE_DATA),
new MockFile("mock:/tbl/part1/_done", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/_tmp/000000_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/_tmp/abc/000000_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/subdir/000000_0", 0, FAKE_DATA));
AcidState state = getAcidState(
testingTrinoFileSystem(fs),
Expand Down Expand Up @@ -147,6 +149,8 @@ public void testOriginalDeltas()
new MockFile("mock:/tbl/part1/000002_0", 500, FAKE_DATA),
new MockFile("mock:/tbl/part1/random", 500, FAKE_DATA),
new MockFile("mock:/tbl/part1/_done", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/_tmp/000000_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/_tmp/delta_025_025/000000_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/subdir/000000_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/delta_025_025/bucket_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/delta_029_029/bucket_0", 0, FAKE_DATA),
Expand Down Expand Up @@ -185,6 +189,8 @@ public void testBaseDeltas()
throws Exception
{
MockFileSystem fs = new MockFileSystem(newEmptyConfiguration(),
new MockFile("mock:/tbl/part1/_tmp/bucket_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/_tmp/base_5/bucket_0", 0, FAKE_DATA),
new MockFile("mock:/tbl/part1/base_5/bucket_0", 500, FAKE_DATA),
new MockFile("mock:/tbl/part1/base_10/bucket_0", 500, FAKE_DATA),
new MockFile("mock:/tbl/part1/base_49/bucket_0", 500, FAKE_DATA),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public void testOriginal()
new MockFile("mock:/tbl/part1/000002_0", 500, new byte[0]),
new MockFile("mock:/tbl/part1/random", 500, new byte[0]),
new MockFile("mock:/tbl/part1/_done", 0, new byte[0]),
new MockFile("mock:/tbl/part1/_tmp/000000_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/_tmp/abc/000000_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/subdir/000000_0", 0, new byte[0]));
AcidUtils.Directory dir = AcidUtils.getAcidState(
new MockPath(fs, "/tbl/part1"),
Expand Down Expand Up @@ -83,6 +85,8 @@ public void testOriginalDeltas()
new MockFile("mock:/tbl/part1/000002_0", 500, new byte[0]),
new MockFile("mock:/tbl/part1/random", 500, new byte[0]),
new MockFile("mock:/tbl/part1/_done", 0, new byte[0]),
new MockFile("mock:/tbl/part1/_tmp/000000_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/_tmp/delta_025_025/000000_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/subdir/000000_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/delta_025_025/bucket_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/delta_029_029/bucket_0", 0, new byte[0]),
Expand Down Expand Up @@ -123,6 +127,8 @@ public void testBaseDeltas()
{
Configuration conf = newEmptyConfiguration();
MockFileSystem fs = new MockFileSystem(conf,
new MockFile("mock:/tbl/part1/_tmp/bucket_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/_tmp/base_5/bucket_0", 0, new byte[0]),
new MockFile("mock:/tbl/part1/base_5/bucket_0", 500, new byte[0]),
new MockFile("mock:/tbl/part1/base_10/bucket_0", 500, new byte[0]),
new MockFile("mock:/tbl/part1/base_49/bucket_0", 500, new byte[0]),
Expand Down