Skip to content

Commit

Permalink
[apache#6496] feat(CLI): Support plain format output for Schema and T…
Browse files Browse the repository at this point in the history
…able command

fix COMMA_JOINER.
  • Loading branch information
Abyss-lord committed Feb 25, 2025
1 parent b587c72 commit 41986a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public interface OutputFormat<T> {
/** Joiner for creating comma-separated output strings, ignoring null values */
Joiner COMMA_JOINER = Joiner.on(", ").skipNulls();
Joiner COMMA_JOINER = Joiner.on(",").skipNulls();
/** Joiner for creating line-separated output strings, ignoring null values */
Joiner NEWLINE_JOINER = Joiner.on(System.lineSeparator()).skipNulls();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void testMetalakeDetailsWithPlainFormat() {

PlainFormat.output(mockMetalake, mockContext);
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals("demo_metalake, This is a demo metalake", output);
Assertions.assertEquals("demo_metalake,This is a demo metalake", output);
}

@Test
Expand All @@ -88,8 +88,7 @@ void testCatalogDetailsWithPlainFormat() {

PlainFormat.output(mockCatalog, mockContext);
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals(
"demo_catalog, RELATIONAL, demo_provider, This is a demo catalog", output);
Assertions.assertEquals("demo_catalog,RELATIONAL,demo_provider,This is a demo catalog", output);
}

@Test
Expand All @@ -111,7 +110,7 @@ void testSchemaDetailsWithPlainFormat() {
Schema mockSchema = getMockSchema();
PlainFormat.output(mockSchema, mockContext);
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals("demo_schema, This is a demo schema", output);
Assertions.assertEquals("demo_schema,This is a demo schema", output);
}

@Test
Expand All @@ -131,7 +130,7 @@ void testTableDetailsWithPlainFormat() {
Table mockTable = getMockTable();
PlainFormat.output(mockTable, mockContext);
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals("demo_table, This is a demo table", output);
Assertions.assertEquals("demo_table,This is a demo table", output);
}

@Test
Expand All @@ -146,7 +145,7 @@ void testAuditWithTableFormat() {
PlainFormat.output(mockAudit, mockContext);
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals(
"demo_user, 2021-01-20T02:51:51.111Z, demo_user, 2021-01-20T02:51:51.111Z", output);
"demo_user,2021-01-20T02:51:51.111Z,demo_user,2021-01-20T02:51:51.111Z", output);
}

@Test
Expand All @@ -160,7 +159,7 @@ void testAuditWithTableFormatWithNullValues() {

PlainFormat.output(mockAudit, mockContext);
String output = new String(outContent.toByteArray(), StandardCharsets.UTF_8).trim();
Assertions.assertEquals("demo_user, N/A, N/A, N/A", output);
Assertions.assertEquals("demo_user,N/A,N/A,N/A", output);
}

@Test
Expand Down

0 comments on commit 41986a7

Please sign in to comment.