Skip to content

Commit

Permalink
PARQUET-2325: Fix parquet-cli's dictionary subcommand to work with FI…
Browse files Browse the repository at this point in the history
…XED_LEN_BYTE_ARRAY (#1122)
  • Loading branch information
sekikn authored Jul 16, 2023
1 parent 1bdb3c6 commit 2553978
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ private void printDictionary(Dictionary dict, PrimitiveType type) {
for (int i = 0; i <= dict.getMaxId(); i += 1) {
switch(type.getPrimitiveTypeName()) {
case BINARY:
case FIXED_LEN_BYTE_ARRAY:
if (type.getLogicalTypeAnnotation() instanceof LogicalTypeAnnotation.StringLogicalTypeAnnotation) {
console.info("{}: {}", String.format("%6d", i),
Util.humanReadable(dict.decodeToBinary(i).toStringUsingUTF8(), 70));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,14 @@ public void testShowDirectoryCommandWithoutDictionaryEncoding() throws IOExcepti
command.setConf(new Configuration());
Assert.assertEquals(0, command.run());
}

@Test
public void testShowDirectoryCommandForFixedLengthByteArray() throws IOException {
File file = parquetFile();
ShowDictionaryCommand command = new ShowDictionaryCommand(createLogger());
command.targets = Arrays.asList(file.getAbsolutePath());
command.column = FIXED_LEN_BYTE_ARRAY_FIELD;
command.setConf(new Configuration());
Assert.assertEquals(0, command.run());
}
}

0 comments on commit 2553978

Please sign in to comment.