You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by hb...@apache.org on 2016/06/09 01:10:03 UTC
[34/48] incubator-quickstep git commit: Reverting the PR that gets
the number of rows (#233)
Reverting the PR that gets the number of rows (#233)
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/0115e961
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/0115e961
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/0115e961
Branch: refs/heads/query-manager-used-in-foreman
Commit: 0115e961b214287f34ee14944e540462fb720918
Parents: 12d7928
Author: Rogers Jeffrey Leo John <ro...@gmail.com>
Authored: Sat May 21 07:36:06 2016 -0500
Committer: Zuyu Zhang <zz...@pivotal.io>
Committed: Wed Jun 8 11:57:45 2016 -0700
----------------------------------------------------------------------
cli/CommandExecutor.cpp | 23 +++--------------------
cli/tests/command_executor/D.test | 14 +++++++-------
cli/tests/command_executor/Dt.test | 20 ++++++++++----------
3 files changed, 20 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0115e961/cli/CommandExecutor.cpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index 3cb3f86..ddcd38f 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -72,7 +72,6 @@ void executeDescribeDatabase(
// Column width initialized to 6 to take into account the header name
// and the column value table
int max_column_width = C::kInitMaxColumnWidth;
- vector<std::size_t> num_tuples;
vector<std::size_t> num_blocks;
const CatalogRelation *relation = nullptr;
if (arguments->size() == 0) {
@@ -80,8 +79,6 @@ void executeDescribeDatabase(
max_column_width =
std::max(static_cast<int>(rel.getName().length()), max_column_width);
num_blocks.push_back(rel.size_blocks());
- num_tuples.push_back(
- PrintToScreen::GetNumTuplesInRelation(rel, storage_manager));
}
} else {
const ParseString &table_name = arguments->front();
@@ -94,49 +91,35 @@ void executeDescribeDatabase(
max_column_width = std::max(static_cast<int>(relation->getName().length()),
max_column_width);
num_blocks.push_back(relation->size_blocks());
- num_tuples.push_back(PrintToScreen::GetNumTuplesInRelation(
- *relation,
- storage_manager));
}
// Only if we have relations work on the printing logic.
if (catalog_database.size() > 0) {
const std::size_t max_num_blocks = *std::max_element(num_blocks.begin(), num_blocks.end());
- const std::size_t max_num_rows = *std::max_element(num_tuples.begin(), num_tuples.end());
- const int max_num_rows_digits = std::max(PrintToScreen::GetNumberOfDigits(max_num_rows),
- C::kInitMaxColumnWidth);
const int max_num_blocks_digits = std::max(PrintToScreen::GetNumberOfDigits(max_num_blocks),
C::kInitMaxColumnWidth+2);
-
vector<int> column_widths;
column_widths.push_back(max_column_width +1);
column_widths.push_back(C::kInitMaxColumnWidth + 1);
column_widths.push_back(max_num_blocks_digits + 1);
- column_widths.push_back(max_num_rows_digits + 1);
fputs(" List of relations\n\n", out);
fprintf(out, "%-*s |", max_column_width+1, " Name");
fprintf(out, "%-*s |", C::kInitMaxColumnWidth, " Type");
- fprintf(out, "%-*s |", max_num_blocks_digits, " Blocks");
- fprintf(out, "%-*s\n", max_num_rows_digits, " Rows");
+ fprintf(out, "%-*s\n", max_num_blocks_digits, " Blocks");
PrintToScreen::printHBar(column_widths, out);
// If there are no argument print the entire list of tables
// else print the particular table only.
- vector<std::size_t>::const_iterator num_tuples_it = num_tuples.begin();
vector<std::size_t>::const_iterator num_blocks_it = num_blocks.begin();
if (arguments->size() == 0) {
for (const CatalogRelation &rel : catalog_database) {
fprintf(out, " %-*s |", max_column_width, rel.getName().c_str());
fprintf(out, " %-*s |", C::kInitMaxColumnWidth - 1, "table");
- fprintf(out, " %-*lu |", max_num_blocks_digits - 1, *num_blocks_it);
- fprintf(out, " %-*lu\n", max_num_rows_digits - 1, *num_tuples_it);
- ++num_tuples_it;
+ fprintf(out, " %-*lu\n", max_num_blocks_digits - 1, *num_blocks_it);
++num_blocks_it;
}
} else {
fprintf(out, " %-*s |", max_column_width, relation->getName().c_str());
fprintf(out, " %-*s |", C::kInitMaxColumnWidth -1, "table");
- fprintf(out, " %-*lu |", max_num_blocks_digits - 1, *num_blocks_it);
- fprintf(out, " %-*lu\n", max_num_rows_digits - 1, *num_tuples_it);
- ++num_tuples_it;
+ fprintf(out, " %-*lu\n", max_num_blocks_digits - 1, *num_blocks_it);
++num_blocks_it;
}
fputc('\n', out);
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0115e961/cli/tests/command_executor/D.test
----------------------------------------------------------------------
diff --git a/cli/tests/command_executor/D.test b/cli/tests/command_executor/D.test
index 45f8d8b..d18ab47 100644
--- a/cli/tests/command_executor/D.test
+++ b/cli/tests/command_executor/D.test
@@ -104,13 +104,13 @@ INSERT INTO foo3 values(5, 1, 1.0, 1.0, 'XYZZ');
--
List of relations
- Name | Type | Blocks | Rows
-+--------------------------------------+-------+---------+-------+
- foo | table | 1 | 5
- foo2 | table | 1 | 2
- foo3 | table | 1 | 1
- foo4 | table | 0 | 0
- averylongtablenamethatseemstoneverend | table | 1 | 3
+ Name | Type | Blocks
++--------------------------------------+-------+---------+
+ foo | table | 1
+ foo2 | table | 1
+ foo3 | table | 1
+ foo4 | table | 0
+ averylongtablenamethatseemstoneverend | table | 1
==
\d invalidtable
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0115e961/cli/tests/command_executor/Dt.test
----------------------------------------------------------------------
diff --git a/cli/tests/command_executor/Dt.test b/cli/tests/command_executor/Dt.test
index 1de6360..65c6be3 100644
--- a/cli/tests/command_executor/Dt.test
+++ b/cli/tests/command_executor/Dt.test
@@ -52,22 +52,22 @@ INSERT INTO foo3 values(5, 1, 1.0, 1.0, 'XYZZ');
--
List of relations
- Name | Type | Blocks | Rows
-+--------------------------------------+-------+---------+-------+
- foo | table | 1 | 5
- foo2 | table | 1 | 2
- foo3 | table | 1 | 1
- foo4 | table | 0 | 0
- averylongtablenamethatseemstoneverend | table | 1 | 3
+ Name | Type | Blocks
++--------------------------------------+-------+---------+
+ foo | table | 1
+ foo2 | table | 1
+ foo3 | table | 1
+ foo4 | table | 0
+ averylongtablenamethatseemstoneverend | table | 1
==
\dt foo
--
List of relations
- Name | Type | Blocks | Rows
-+-------+-------+---------+-------+
- foo | table | 1 | 5
+ Name | Type | Blocks
++-------+-------+---------+
+ foo | table | 1
==
\dt invalidtable