You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by zh...@apache.org on 2023/02/24 06:57:50 UTC
[kudu] branch master updated: [Tools] Remove enter key when listing non-existed table
This is an automated email from the ASF dual-hosted git repository.
zhangyifan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new ec28d61f7 [Tools] Remove enter key when listing non-existed table
ec28d61f7 is described below
commit ec28d61f7f92577dc855125a52984ce2e060a077
Author: xinghuayu007 <14...@qq.com>
AuthorDate: Sun Feb 12 15:51:52 2023 +0800
[Tools] Remove enter key when listing non-existed table
When Kudu listing a non-existed table using command line tool,
it ouputs an enter key and a new line appears. But earlier
version does not output an enter key.
Therefore it is better to be compatible with old versions of
Kudu.
Change-Id: I86fafc3c7df26d380b424b6d6b3f80a1b8d78dc8
Reviewed-on: http://gerrit.cloudera.org:8080/19493
Tested-by: Kudu Jenkins
Reviewed-by: Yingchun Lai <la...@apache.org>
Reviewed-by: Yuqi Du <sh...@gmail.com>
Reviewed-by: Yifan Zhang <ch...@163.com>
---
src/kudu/tools/kudu-admin-test.cc | 3 +--
src/kudu/tools/tool_action_table.cc | 4 +++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/kudu/tools/kudu-admin-test.cc b/src/kudu/tools/kudu-admin-test.cc
index 3e12c7e0a..8c5eca346 100644
--- a/src/kudu/tools/kudu-admin-test.cc
+++ b/src/kudu/tools/kudu-admin-test.cc
@@ -1763,8 +1763,7 @@ TEST_F(AdminCliTest, TestListSoftDeletedTables) {
}, &stdout));
vector<string> stdout_lines = Split(stdout, ",", strings::SkipEmpty());
- ASSERT_EQ(1, stdout_lines.size());
- ASSERT_EQ("\n", stdout_lines[0]);
+ ASSERT_TRUE(stdout_lines.empty());
ASSERT_OK(RunKuduTool({
"table",
diff --git a/src/kudu/tools/tool_action_table.cc b/src/kudu/tools/tool_action_table.cc
index a8987029f..9cc084bc5 100644
--- a/src/kudu/tools/tool_action_table.cc
+++ b/src/kudu/tools/tool_action_table.cc
@@ -358,7 +358,9 @@ class TableLister {
}
if (iequals(FLAGS_list_table_output_format, "pretty")) {
- cout << ToPrettyFormat(tables_info_pb) << endl;
+ if (!tables_info_pb.tables().empty()) {
+ cout << ToPrettyFormat(tables_info_pb) << endl;
+ }
} else {
DCHECK(iequals(FLAGS_list_table_output_format, "json") ||
iequals(FLAGS_list_table_output_format, "json_compact"));