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

lightning: allow long dbname printed in 1 line for error summary #58148

Merged
merged 1 commit into from
Dec 11, 2024
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
8 changes: 4 additions & 4 deletions pkg/lightning/errormanager/errormanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,10 +1107,10 @@ func (em *ErrorManager) Output() string {
t := table.NewWriter()
t.AppendHeader(table.Row{"#", "Error Type", "Error Count", "Error Data Table"})
t.SetColumnConfigs([]table.ColumnConfig{
{Name: "#", WidthMax: 6},
{Name: "Error Type", WidthMax: 20},
{Name: "Error Count", WidthMax: 12},
{Name: "Error Data Table", WidthMax: 42},
{Name: "#"},
{Name: "Error Type"},
{Name: "Error Count"},
{Name: "Error Data Table"},
})
t.SetRowPainter(func(table.Row) text.Colors {
return text.Colors{text.FgRed}
Expand Down
14 changes: 14 additions & 0 deletions pkg/lightning/errormanager/errormanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,18 @@ func TestErrorMgrErrorOutput(t *testing.T) {
"|\x1b[31m 4 \x1b[0m|\x1b[31m Unique Key Conflict \x1b[0m|\x1b[31m 100 \x1b[0m|\x1b[31m `error_info`.`conflict_view` \x1b[0m|\n" +
"+---+---------------------+-------------+--------------------------------+\n"
require.Equal(t, expected, output)

em.schema = "long_long_long_long_long_long_long_long_dbname"
output = em.Output()
expected = "\n" +
"Import Data Error Summary: \n" +
"+---+---------------------+-------------+--------------------------------------------------------------------+\n" +
"| # | ERROR TYPE | ERROR COUNT | ERROR DATA TABLE |\n" +
"+---+---------------------+-------------+--------------------------------------------------------------------+\n" +
"|\x1b[31m 1 \x1b[0m|\x1b[31m Data Type \x1b[0m|\x1b[31m 100 \x1b[0m|\x1b[31m `long_long_long_long_long_long_long_long_dbname`.`type_error_v2` \x1b[0m|\n" +
"|\x1b[31m 2 \x1b[0m|\x1b[31m Data Syntax \x1b[0m|\x1b[31m 100 \x1b[0m|\x1b[31m `long_long_long_long_long_long_long_long_dbname`.`syntax_error_v2` \x1b[0m|\n" +
"|\x1b[31m 3 \x1b[0m|\x1b[31m Charset Error \x1b[0m|\x1b[31m 100 \x1b[0m|\x1b[31m \x1b[0m|\n" +
"|\x1b[31m 4 \x1b[0m|\x1b[31m Unique Key Conflict \x1b[0m|\x1b[31m 100 \x1b[0m|\x1b[31m `long_long_long_long_long_long_long_long_dbname`.`conflict_view` \x1b[0m|\n" +
"+---+---------------------+-------------+--------------------------------------------------------------------+\n"
require.Equal(t, expected, output)
}