You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by sp...@apache.org on 2016/12/11 17:46:08 UTC

[45/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/tests/PartitionScheme_unittest.cpp
----------------------------------------------------------------------
diff --git a/catalog/tests/PartitionScheme_unittest.cpp b/catalog/tests/PartitionScheme_unittest.cpp
deleted file mode 100644
index d10b26e..0000000
--- a/catalog/tests/PartitionScheme_unittest.cpp
+++ /dev/null
@@ -1,652 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include <algorithm>
-#include <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <limits>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "catalog/PartitionScheme.hpp"
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/EqualComparison.hpp"
-
-#include "gtest/gtest.h"
-
-using std::move;
-using std::size_t;
-
-namespace quickstep {
-
-class Type;
-
-TEST(PartitionSchemeHeaderTest, IntegerHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 4;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const int kSampleInts[] = {
-      0, 1, 2, 3, 400, 501, 64783970, 78437883, -2784627};
-  const size_t num_ints = sizeof(kSampleInts) / sizeof(kSampleInts[0]);
-  for (size_t i = 0; i < num_ints; ++i) {
-    // Check if the partition id returned by the partition scheme for
-    // an integer is the same as the hash of the integer modulus the number
-    // of partitions.
-    EXPECT_EQ(TypedValue(kSampleInts[i]).getHash() % num_partitions,
-              partition_scheme_header->getPartitionId(TypedValue(kSampleInts[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, LongHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 8;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const std::int64_t kSampleLongs[] = {INT64_C(10),
-                                  INT64_C(100),
-                                  INT64_C(1025),
-                                  INT64_C(9876543),
-                                  INT64_C(-89234758937573987)};
-  const size_t num_longs = sizeof(kSampleLongs) / sizeof(kSampleLongs[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a long is the same as the hash of the long number modulus the number
-  // of partitions.
-  for (size_t i = 0; i < num_longs; ++i) {
-    EXPECT_EQ(TypedValue(kSampleLongs[i]).getHash() % num_partitions,
-              partition_scheme_header->getPartitionId(TypedValue(kSampleLongs[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, FloatHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 5;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const float kSampleFloats[] = {
-      285728.895680f, 924005.4989f, -8973494.37438f};
-  const size_t num_floats = sizeof(kSampleFloats) / sizeof(kSampleFloats[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a float is the same as the hash of the floating point number modulus
-  // the number of partitions.
-  for (size_t i = 0; i < num_floats; ++i) {
-    EXPECT_EQ(TypedValue(kSampleFloats[i]).getHash() % num_partitions,
-              partition_scheme_header->getPartitionId(TypedValue(kSampleFloats[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, DoubleHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 6;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const double kSampleDoubles[] = {
-      1.0378, 763624.46343453, -87238497384.3187431894713};
-  const size_t num_doubles = sizeof(kSampleDoubles) / sizeof(kSampleDoubles[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a double is the same as the hash of the double modulus the number
-  // of partitions.
-  for (size_t i = 0; i < num_doubles; ++i) {
-    EXPECT_EQ(
-        TypedValue(kSampleDoubles[i]).getHash() % num_partitions,
-        partition_scheme_header->getPartitionId(TypedValue(kSampleDoubles[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, CharacterHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 7;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {
-      "a", "gerald", "ram", "3081289", "=42?", "+-/*&^%", "hello_world"};
-  const size_t num_strings = sizeof(kSampleStrings) / sizeof(kSampleStrings[0]);
-  // Check if the partition id returned by the partition scheme for
-  // characters is the same as the hash of the characters modulus the number
-  // of partitions.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(
-        TypedValue(
-            kChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)
-                .getHash() %
-            num_partitions,
-        partition_scheme_header->getPartitionId(TypedValue(
-            kChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, VarCharHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 7;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {
-      "hello", "world", "1234567", "!@#$^&*", "pa345+="};
-  const size_t num_strings = sizeof(kSampleStrings) / sizeof(kSampleStrings[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a variable length string is the same as the hash of the variable length string
-  // modulus the number of partitions.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(
-        TypedValue(
-            kVarChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)
-                .getHash() %
-            num_partitions,
-        partition_scheme_header->getPartitionId(
-            TypedValue(kVarChar,
-                       kSampleStrings[i],
-                       std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, IntegerRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0, 10, 20.
-  // Last partition can hold upto infinity.
-  // First partition can hold from -infinity to -1.
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * 10));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kInt), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // integers is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(0)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(10)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(20)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(30)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-4)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(15)));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(6)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-70)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(1000)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(20000)));
-}
-
-TEST(PartitionSchemeHeaderTest, LongRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0, 10000, 20000, 30000
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * INT64_C(10000)));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kLong), 4, 0, move(partition_range)));
-
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // long numbers is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(0))));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(13456))));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(20000))));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(300123))));
-  EXPECT_EQ(0u,
-            partition_scheme_header->getPartitionId(TypedValue(INT64_C(-400000))));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(15123))));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(6012))));
-  EXPECT_EQ(0u,
-            partition_scheme_header->getPartitionId(TypedValue(INT64_C(-7000000))));
-}
-
-TEST(PartitionSchemeHeaderTest, FloatRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0.0, 10.0, 20.0
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * 10.0f));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kFloat), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // floats is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(0.1f)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(10.00000000f)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(20.23f)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(30.56f)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-4.5f)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(15.034f)));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(6.987f)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-70.384f)));
-}
-
-TEST(PartitionSchemeHeaderTest, DoubleRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0.00000, 10.00000, 20.00000
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * 10.00000));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kDouble), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // doubles is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(0.1897438974)));
-  EXPECT_EQ(2u,
-            partition_scheme_header->getPartitionId(TypedValue(10.00000000287489)));
-  EXPECT_EQ(3u,
-            partition_scheme_header->getPartitionId(TypedValue(20.23249859403750)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(30.567866347563)));
-  EXPECT_EQ(0u,
-            partition_scheme_header->getPartitionId(TypedValue(-4.57583978935689)));
-  EXPECT_EQ(2u,
-            partition_scheme_header->getPartitionId(TypedValue(15.034248758978936)));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(6.98792489)));
-  EXPECT_EQ(
-      0u, partition_scheme_header->getPartitionId(TypedValue(-70.38454985893768738)));
-}
-
-TEST(PartitionSchemeHeaderTest, CharacterRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are the following 3 characters.
-  const char *kRangeBoundaryStrings[] = {"don", "hippo", "pattasu"};
-  const size_t num_boundaries = sizeof(kRangeBoundaryStrings) / sizeof(kRangeBoundaryStrings[0]);
-  for (size_t i = 0; i < num_boundaries; ++i) {
-    partition_range.push_back(
-        TypedValue(kChar,
-                   kRangeBoundaryStrings[i],
-                   std::strlen(kRangeBoundaryStrings[i]) + 1));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kChar, 20, false), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {"amma",
-                                  "ganesh",
-                                  "e",
-                                  "imo",
-                                  "master",
-                                  "pathetic",
-                                  "turing",
-                                  "wentao",
-                                  "dog",
-                                  "zebra"};
-  const partition_id kExpectedPartitions[] = {0, 1, 1, 2, 2, 2, 3, 3, 0, 3};
-  const size_t num_strings = sizeof(kExpectedPartitions) / sizeof(kExpectedPartitions[0]);
-  // Check if the partition id returned by the Range Partition Scheme for
-  // characters is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(
-        kExpectedPartitions[i],
-        partition_scheme_header->getPartitionId(TypedValue(
-            kChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, VarCharRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are the following 3 strings.
-  const char *kRangeBoundaryStrings[] = { "elephant", "jamaica", "zorgonz"};
-  const size_t num_boundaries = sizeof(kRangeBoundaryStrings) / sizeof(kRangeBoundaryStrings[0]);
-  for (size_t i = 0; i < num_boundaries; ++i) {
-    partition_range.push_back(
-        TypedValue(kVarChar,
-                   kRangeBoundaryStrings[i],
-                   std::strlen(kRangeBoundaryStrings[i]) + 1));
-  }
-
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kVarChar, 20, false), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {"apple",
-                                  "halloween",
-                                  "mango",
-                                  "turkey",
-                                  "elephant",
-                                  "sathyam",
-                                  "zyxw",
-                                  "zorgonz"};
-  const partition_id kExpectedPartitions[] = {0, 1, 2, 2, 1, 2, 3, 3};
-  const size_t num_strings = sizeof(kExpectedPartitions) / sizeof(kExpectedPartitions[0]);
-  // Check if the partition id returned by the Range Partition Scheme for
-  // variable length strings is the same as the partition id into which it
-  // is supposed to be based on the partition boundaries that we have defined.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(kExpectedPartitions[i],
-              partition_scheme_header->getPartitionId(
-                  TypedValue(kVarChar,
-                             kSampleStrings[i],
-                             std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeTest, AddBlocksToPartitionTest) {
-  std::unique_ptr<PartitionScheme> partition_scheme(
-      new PartitionScheme(new HashPartitionSchemeHeader(4, 0)));
-  for (int i = 0; i < 10; ++i) {
-    partition_scheme->addBlockToPartition(i, i % 4);
-  }
-
-  // Compute blocks in each partition.
-  const std::vector<block_id> blocks_in_partition_zero =
-      partition_scheme->getBlocksInPartition(0);
-  const std::vector<block_id> blocks_in_partition_one =
-      partition_scheme->getBlocksInPartition(1);
-  const std::vector<block_id> blocks_in_partition_two =
-      partition_scheme->getBlocksInPartition(2);
-  const std::vector<block_id> blocks_in_partition_three =
-      partition_scheme->getBlocksInPartition(3);
-
-  EXPECT_EQ(4u, partition_scheme->getPartitionSchemeHeader().getNumPartitions());
-  EXPECT_EQ(0, partition_scheme->getPartitionSchemeHeader().getPartitionAttributeId());
-
-  // Check if the blocks are present in the partitions that we
-  // expect them to be based on where we inserted them.
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      0));
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      4));
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      8));
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 1));
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 5));
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 9));
-  EXPECT_NE(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 2));
-  EXPECT_NE(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 6));
-  EXPECT_NE(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      3));
-  EXPECT_NE(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      7));
-  // Check if the number of blocks in a partition are as expected.
-  EXPECT_EQ(3u, blocks_in_partition_zero.size());
-  EXPECT_EQ(3u, blocks_in_partition_one.size());
-  EXPECT_EQ(2u, blocks_in_partition_two.size());
-  EXPECT_EQ(2u, blocks_in_partition_three.size());
-}
-
-TEST(PartitionSchemeTest, RemoveBlocksFromPartitionTest) {
-  std::unique_ptr<PartitionScheme> partition_scheme(
-      new PartitionScheme(new HashPartitionSchemeHeader(4, 0)));
-  for (int i = 0; i < 10; ++i) {
-    partition_scheme->addBlockToPartition(i, i % 4);
-  }
-
-  EXPECT_EQ(4u, partition_scheme->getPartitionSchemeHeader().getNumPartitions());
-  EXPECT_EQ(0, partition_scheme->getPartitionSchemeHeader().getPartitionAttributeId());
-  // remove block 0 from partition 0
-  partition_scheme->removeBlockFromPartition(0, 0);
-  const std::vector<block_id> blocks_in_partition_zero =
-      partition_scheme->getBlocksInPartition(0);
-  // check if block 0 is removed from partition 0
-  EXPECT_EQ(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      0));
-  // Check if block 4 is still present in partition zero.
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      4));
-  // Check if block 8 is still present in partition zero.
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      8));
-  EXPECT_EQ(2u, blocks_in_partition_zero.size());
-
-  // remove block 5 from partition 1
-  partition_scheme->removeBlockFromPartition(5, 1);
-  const std::vector<block_id> blocks_in_partition_one =
-      partition_scheme->getBlocksInPartition(1);
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 1));
-  // check if block 5 is not present in partition 1
-  EXPECT_EQ(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 5));
-  // Check if block 9 is still present in partition one.
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 9));
-  EXPECT_EQ(2u, blocks_in_partition_one.size());
-
-  // remove block 2 from partition 2
-  partition_scheme->removeBlockFromPartition(2, 2);
-  const std::vector<block_id> blocks_in_partition_two =
-      partition_scheme->getBlocksInPartition(2);
-  // check if block 2 is removed from partition 2
-  EXPECT_EQ(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 2));
-  // Check if block 6 is still present in partition two.
-  EXPECT_NE(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 6));
-  EXPECT_EQ(1u, blocks_in_partition_two.size());
-
-  // remove block 7 from partition 3
-  partition_scheme->removeBlockFromPartition(7, 3);
-  const std::vector<block_id> blocks_in_partition_three =
-      partition_scheme->getBlocksInPartition(3);
-  // Check if block 3 is still present in partition three.
-  EXPECT_NE(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      3));
-  // check if block 7 is removed from partition 3
-  EXPECT_EQ(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      7));
-  EXPECT_EQ(1u, blocks_in_partition_three.size());
-}
-
-TEST(PartitionSchemeTest, CheckHashPartitionSchemeSerialization) {
-  const std::size_t num_partitions = 4;
-  std::unique_ptr<PartitionScheme> part_scheme(
-      new PartitionScheme(new HashPartitionSchemeHeader(num_partitions, 0)));
-  // Add some blocks to each partition.
-  for (int i = 0; i < 10; ++i) {
-    part_scheme->addBlockToPartition(i, i % num_partitions);
-  }
-  std::unique_ptr<PartitionScheme> part_scheme_from_proto;
-  part_scheme_from_proto.reset(
-      PartitionScheme::ReconstructFromProto(part_scheme->getProto(), TypeFactory::GetType(kInt)));
-
-  const PartitionSchemeHeader &header = part_scheme->getPartitionSchemeHeader();
-  const PartitionSchemeHeader &header_from_proto = part_scheme_from_proto->getPartitionSchemeHeader();
-
-  // Check the partition type
-  EXPECT_EQ(header.getPartitionType(),
-            header_from_proto.getPartitionType());
-  // Check number of partitions
-  EXPECT_EQ(header.getNumPartitions(),
-            header_from_proto.getNumPartitions());
-  // Check the partition attribute id
-  EXPECT_EQ(header.getPartitionAttributeId(),
-            header_from_proto.getPartitionAttributeId());
-  // Check the block in each partition
-  for (partition_id part_id = 0; part_id < num_partitions; ++part_id) {
-    // Collect the blocks from C++ Partition Scheme object.
-    std::vector<block_id> blocks_in_part_scheme =
-        part_scheme->getBlocksInPartition(part_id);
-    // Collect the blocks from Partition Scheme's protocol buffer.
-    std::vector<block_id> blocks_in_part_scheme_from_proto =
-        part_scheme_from_proto->getBlocksInPartition(part_id);
-    // Sort both these vector of block ids so that we can compare them.
-    std::sort(blocks_in_part_scheme.begin(), blocks_in_part_scheme.end());
-    std::sort(blocks_in_part_scheme_from_proto.begin(),
-              blocks_in_part_scheme_from_proto.end());
-    // Compare the two sorted lists to check if they are equal.
-    EXPECT_EQ(blocks_in_part_scheme, blocks_in_part_scheme_from_proto);
-  }
-}
-
-TEST(PartitionSchemeTest, CheckRangePartitionSchemeSerialization) {
-  const Type &type = TypeFactory::GetType(kInt);
-  const std::size_t num_partitions = 4;
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0, 10, 20.
-  // Last partition can hold upto infinity.
-  // First partition can hold from -infinity to -1.
-  for (std::size_t i = 0; i < num_partitions - 1; ++i) {
-    partition_range.push_back(TypedValue(static_cast<int>(i * 10)));
-  }
-  std::unique_ptr<PartitionScheme> part_scheme(
-      new PartitionScheme(
-          new RangePartitionSchemeHeader(type, num_partitions, 0, move(partition_range))));
-  for (int i = 0; i < 10; ++i) {
-    part_scheme->addBlockToPartition(i * 5, i % num_partitions);
-  }
-  std::unique_ptr<PartitionScheme> part_scheme_from_proto;
-
-  part_scheme_from_proto.reset(
-      PartitionScheme::ReconstructFromProto(part_scheme->getProto(), type));
-
-  const PartitionSchemeHeader &header = part_scheme->getPartitionSchemeHeader();
-  const PartitionSchemeHeader &header_from_proto = part_scheme_from_proto->getPartitionSchemeHeader();
-
-  // Check the partition type
-  EXPECT_EQ(header.getPartitionType(),
-            header_from_proto.getPartitionType());
-
-  // Check number of partitions
-  EXPECT_EQ(header.getNumPartitions(),
-            header_from_proto.getNumPartitions());
-
-  // Check the partition attribute id
-  EXPECT_EQ(header.getPartitionAttributeId(),
-            header_from_proto.getPartitionAttributeId());
-
-  // Check the partition range boundaries' size.
-  const std::vector<TypedValue> &range_boundaries_part_scheme =
-      static_cast<const RangePartitionSchemeHeader&>(header).getPartitionRangeBoundaries();
-  const std::vector<TypedValue> &range_boundaries_part_scheme_from_proto =
-      static_cast<const RangePartitionSchemeHeader&>(header_from_proto).getPartitionRangeBoundaries();
-  EXPECT_EQ(range_boundaries_part_scheme.size(),
-            range_boundaries_part_scheme_from_proto.size());
-
-  // Check the partition range boundaries' values.
-  const Comparison &equal_comparison_op(EqualComparison::Instance());
-  std::unique_ptr<UncheckedComparator> equal_unchecked_comparator;
-  equal_unchecked_comparator.reset(
-      equal_comparison_op.makeUncheckedComparatorForTypes(
-          TypeFactory::GetType(kInt), TypeFactory::GetType(kInt)));
-  for (std::size_t i = 0; i < range_boundaries_part_scheme.size(); ++i) {
-    EXPECT_TRUE(equal_unchecked_comparator->compareTypedValues(
-        range_boundaries_part_scheme[i],
-        range_boundaries_part_scheme_from_proto[i]));
-  }
-
-  // Check the blocks in each partition from both the Partition Scheme's
-  // C++ object and protocol buffer.
-  for (partition_id part_id = 0; part_id < num_partitions; ++part_id) {
-    std::vector<block_id> blocks_in_part_scheme =
-        part_scheme->getBlocksInPartition(part_id);
-    std::vector<block_id> blocks_in_part_scheme_from_proto =
-        part_scheme_from_proto->getBlocksInPartition(part_id);
-    std::sort(blocks_in_part_scheme.begin(), blocks_in_part_scheme.end());
-    std::sort(blocks_in_part_scheme_from_proto.begin(),
-              blocks_in_part_scheme_from_proto.end());
-    EXPECT_EQ(blocks_in_part_scheme, blocks_in_part_scheme_from_proto);
-  }
-}
-
-TEST(PartitionSchemeTest, CheckBlocksInPartitionTest) {
-  std::unique_ptr<PartitionScheme> partition_scheme;
-  constexpr std::size_t kNumBlocks = 10;
-  constexpr std::size_t kNumPartitions = 4;
-  constexpr attribute_id kPartitioningAttribute = 0;
-  // Create a partition scheme object.
-  partition_scheme.reset(
-      new PartitionScheme(new HashPartitionSchemeHeader(kNumPartitions, kPartitioningAttribute)));
-  // Add blocks to different partitions.
-  for (std::size_t block_id = 0; block_id < kNumBlocks; ++block_id) {
-    partition_scheme->addBlockToPartition(block_id,
-                                          block_id % kNumPartitions);
-  }
-
-  const PartitionSchemeHeader &header = partition_scheme->getPartitionSchemeHeader();
-
-  // Check the number of partitions and the partitioning attribute.
-  EXPECT_EQ(kNumPartitions, header.getNumPartitions());
-  EXPECT_EQ(kPartitioningAttribute, header.getPartitionAttributeId());
-
-  // Check if the blocks are correctly assigned to its partitions.
-  EXPECT_EQ(0u, partition_scheme->getPartitionForBlock(0));
-  EXPECT_EQ(1u, partition_scheme->getPartitionForBlock(1));
-  EXPECT_EQ(2u, partition_scheme->getPartitionForBlock(2));
-  EXPECT_EQ(3u, partition_scheme->getPartitionForBlock(3));
-  EXPECT_EQ(0u, partition_scheme->getPartitionForBlock(4));
-  EXPECT_EQ(1u, partition_scheme->getPartitionForBlock(5));
-  EXPECT_EQ(2u, partition_scheme->getPartitionForBlock(6));
-  EXPECT_EQ(3u, partition_scheme->getPartitionForBlock(7));
-  EXPECT_EQ(0u, partition_scheme->getPartitionForBlock(8));
-  EXPECT_EQ(1u, partition_scheme->getPartitionForBlock(9));
-
-  // Block that is not present in any partition.
-  EXPECT_EQ(std::numeric_limits<partition_id>::max(),
-            partition_scheme->getPartitionForBlock(100));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
deleted file mode 100644
index 9b62af9..0000000
--- a/cli/CMakeLists.txt
+++ /dev/null
@@ -1,154 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-add_subdirectory(tests)
-
-if (WIN32)
-  set(QUICKSTEP_OS_WINDOWS TRUE)
-endif()
-
-if (USE_LINENOISE)
-  set(QUICKSTEP_USE_LINENOISE TRUE)
-endif()
-
-if(LIBNUMA_FOUND)
-  set(QUICKSTEP_HAVE_LIBNUMA TRUE)
-endif()
-
-if (BUILD_SHARED_LIBS)
-  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
-else()
-  set(GFLAGS_LIB_NAME gflags_nothreads-static)
-endif()
-
-if (ENABLE_GOOGLE_PROFILER)
-  set(QUICKSTEP_ENABLE_GOOGLE_PROFILER TRUE)
-endif()
-
-configure_file (
-  "${CMAKE_CURRENT_SOURCE_DIR}/CliConfig.h.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/CliConfig.h"
-)
-add_library(quickstep_cli_CommandExecutor CommandExecutor.cpp CommandExecutor.hpp)
-
-# Declare micro-libs and link dependencies:
-add_library(quickstep_cli_DropRelation DropRelation.cpp DropRelation.hpp)
-target_link_libraries(quickstep_cli_DropRelation
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_utility_Macros)
-add_library(quickstep_cli_Flags Flags.cpp Flags.hpp)
-
-if(USE_LINENOISE)
-  add_library(quickstep_cli_LineReader
-              LineReader.cpp
-              LineReaderLineNoise.cpp
-              LineReader.hpp
-              LineReaderLineNoise.hpp)
-  target_link_libraries(quickstep_cli_LineReader
-                        linenoise
-                        quickstep_utility_Macros)
-else()
-  add_library(quickstep_cli_LineReader
-              LineReader.cpp
-              LineReaderDumb.cpp
-              LineReader.hpp
-              LineReaderDumb.hpp)
-  target_link_libraries(quickstep_cli_LineReader
-                        quickstep_utility_Macros)
-endif()
-
-add_library(quickstep_cli_DefaultsConfigurator DefaultsConfigurator.cpp DefaultsConfigurator.hpp)
-add_library(quickstep_cli_InputParserUtil InputParserUtil.cpp InputParserUtil.hpp)
-add_library(quickstep_cli_PrintToScreen PrintToScreen.cpp PrintToScreen.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_cli_CommandExecutor
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_cli_DropRelation
-                      quickstep_cli_PrintToScreen
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_SqlParserWrapper
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_queryoptimizer_QueryProcessor
-                      quickstep_storage_StorageBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_TupleStorageSubBlock
-                      quickstep_parser_ParseString
-                      quickstep_types_Type
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_utility_PtrVector
-                      quickstep_utility_SqlError)
-
-target_link_libraries(quickstep_cli_DefaultsConfigurator
-                      glog
-                      quickstep_catalog_Catalog
-                      quickstep_catalog_Catalog_proto
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_utility_Macros)
-if(QUICKSTEP_HAVE_LIBNUMA)
-  target_link_libraries(quickstep_cli_DefaultsConfigurator
-                        ${LIBNUMA_LIBRARY})
-endif()
-target_link_libraries(quickstep_cli_Flags
-                      quickstep_cli_DefaultsConfigurator
-                      quickstep_storage_StorageConstants
-                      ${GFLAGS_LIB_NAME})
-target_link_libraries(quickstep_cli_InputParserUtil
-                      glog
-                      quickstep_utility_Macros
-                      quickstep_utility_StringUtil)
-if(QUICKSTEP_HAVE_LIBNUMA)
-target_link_libraries(quickstep_cli_InputParserUtil
-                      ${LIBNUMA_LIBRARY})
-endif()
-target_link_libraries(quickstep_cli_PrintToScreen
-                      ${GFLAGS_LIB_NAME}
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelation
-                      quickstep_storage_StorageBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_TupleStorageSubBlock
-                      quickstep_types_IntType
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_cli ../empty_src.cpp CliModule.hpp)
-
-target_link_libraries(quickstep_cli
-                      quickstep_cli_CommandExecutor
-                      quickstep_cli_DefaultsConfigurator
-                      quickstep_cli_DropRelation
-                      quickstep_cli_Flags
-                      quickstep_cli_InputParserUtil
-                      quickstep_cli_LineReader
-                      quickstep_cli_PrintToScreen)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CliConfig.h.in
----------------------------------------------------------------------
diff --git a/cli/CliConfig.h.in b/cli/CliConfig.h.in
deleted file mode 100644
index 2508f3a..0000000
--- a/cli/CliConfig.h.in
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#cmakedefine QUICKSTEP_USE_LINENOISE
-#cmakedefine QUICKSTEP_OS_WINDOWS
-#cmakedefine QUICKSTEP_ENABLE_GOOGLE_PROFILER

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CliModule.hpp
----------------------------------------------------------------------
diff --git a/cli/CliModule.hpp b/cli/CliModule.hpp
deleted file mode 100644
index e65de98..0000000
--- a/cli/CliModule.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-/** @defgroup CLI
- *
- * The QuickStep command-line interface.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CommandExecutor.cpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
deleted file mode 100644
index 4ab32de..0000000
--- a/cli/CommandExecutor.cpp
+++ /dev/null
@@ -1,406 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "cli/CommandExecutor.hpp"
-
-#include <algorithm>
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "cli/DropRelation.hpp"
-#include "cli/PrintToScreen.hpp"
-#include "parser/ParseStatement.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/SqlParserWrapper.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/QueryProcessor.hpp"
-#include "storage/StorageBlock.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageManager.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/TupleStorageSubBlock.hpp"
-#include "types/Type.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/SqlError.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-using std::fprintf;
-using std::fputc;
-using std::fputs;
-using std::size_t;
-using std::string;
-using std::vector;
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-namespace cli {
-namespace {
-
-namespace C = ::quickstep::cli;
-
-void executeDescribeDatabase(
-    const PtrVector<ParseString> *arguments,
-    const CatalogDatabase &catalog_database,
-    StorageManager *storage_manager,
-    FILE *out) {
-  // 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_blocks;
-  const CatalogRelation *relation = nullptr;
-  if (arguments->size() == 0) {
-    for (const CatalogRelation &rel : catalog_database) {
-      max_column_width =
-          std::max(static_cast<int>(rel.getName().length()), max_column_width);
-      num_blocks.push_back(rel.size_blocks());
-    }
-  } else {
-    const ParseString &table_name = arguments->front();
-    const std::string &table_name_val = table_name.value();
-    relation = catalog_database.getRelationByName(table_name_val);
-
-    if (relation == nullptr) {
-      THROW_SQL_ERROR_AT(&(arguments->front())) << " Unrecognized relation " << table_name_val;
-    }
-    max_column_width = std::max(static_cast<int>(relation->getName().length()),
-                                    max_column_width);
-    num_blocks.push_back(relation->size_blocks());
-  }
-  // 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 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);
-    fputs("       List of relations\n\n", out);
-    fprintf(out, "%-*s |", max_column_width+1, " Name");
-    fprintf(out, "%-*s |", C::kInitMaxColumnWidth, " Type");
-    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_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\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\n", max_num_blocks_digits - 1, *num_blocks_it);
-      ++num_blocks_it;
-    }
-    fputc('\n', out);
-  }
-}
-
-void executeDescribeTable(
-    const PtrVector<ParseString> *arguments,
-    const CatalogDatabase &catalog_database, FILE *out) {
-  const ParseString &table_name = arguments->front();
-  const std::string &table_name_val = table_name.value();
-  const CatalogRelation *relation =
-      catalog_database.getRelationByName(table_name_val);
-  if (relation == nullptr) {
-    THROW_SQL_ERROR_AT(&(arguments->front())) << " Unrecognized relation "  << table_name_val;
-  }
-  vector<int> column_widths;
-  int max_attr_column_width = C::kInitMaxColumnWidth;
-  int max_type_column_width = C::kInitMaxColumnWidth;
-
-  for (const CatalogAttribute &attr : *relation) {
-    // Printed column needs to be wide enough to print:
-    //   1. The attribute name (in the printed "header").
-    //   2. Any value of the attribute's Type.
-    max_attr_column_width =
-        std::max(max_attr_column_width,
-            static_cast<int>(attr.getDisplayName().length()));
-    max_type_column_width =
-        std::max(max_type_column_width,
-            static_cast<int>(attr.getType().getName().length()));
-  }
-  // Add room for one extra character to allow spacing between the column ending and the vertical bar
-  column_widths.push_back(max_attr_column_width+1);
-  column_widths.push_back(max_type_column_width+1);
-
-  fprintf(out, "%*s \"%s\"\n", C::kInitMaxColumnWidth, "Table", table_name_val.c_str());
-  fprintf(out, "%-*s |", max_attr_column_width+1, " Column");
-  fprintf(out, "%-*s\n", max_type_column_width+1, " Type");
-  PrintToScreen::printHBar(column_widths, out);
-  for (const CatalogAttribute &attr : *relation) {
-    fprintf(out, " %-*s |", max_attr_column_width,
-            attr.getDisplayName().c_str());
-    fprintf(out, " %-*s\n", max_type_column_width,
-            attr.getType().getName().c_str());
-  }
-  // TODO(rogers): Add handlers for partitioning information.
-  if (relation->hasIndexScheme()) {
-    fprintf(out, "%*s\n", C::kInitMaxColumnWidth+2, " Indexes");
-    const quickstep::IndexScheme &index_scheme = relation->getIndexScheme();
-    for (auto index_it = index_scheme.begin(); index_it != index_scheme.end();
-         ++index_it) {
-      fprintf(out, "  \"%-*s\" %s", static_cast<int>(index_it->first.length()),
-              index_it->first.c_str(),
-              index_it->second.IndexSubBlockType_Name(
-                  index_it->second.sub_block_type()).c_str());
-      fputc(' ', out);
-      fputc('(', out);
-      fprintf(out, "%s", relation->getAttributeById(index_it->second.indexed_attribute_ids(0))
-                             ->getDisplayName().c_str());
-      for (std::size_t i = 1; i < static_cast<std::size_t>(index_it->second.indexed_attribute_ids_size()); ++i) {
-        const char *attribute_display_name = relation->getAttributeById(
-                                                 index_it->second.indexed_attribute_ids(i))
-                                                     ->getDisplayName().c_str();
-        fprintf(out, ", %s", attribute_display_name);
-      }
-      fputc(')', out);
-      fputc('\n', out);
-    }
-  }
-}
-
-/**
- * @brief A helper function that executes a SQL query to obtain a row of results.
- */
-inline std::vector<TypedValue> executeQueryForSingleRow(
-    const tmb::client_id main_thread_client_id,
-    const tmb::client_id foreman_client_id,
-    const std::string &query_string,
-    tmb::MessageBus *bus,
-    StorageManager *storage_manager,
-    QueryProcessor *query_processor,
-    SqlParserWrapper *parser_wrapper) {
-  parser_wrapper->feedNextBuffer(new std::string(query_string));
-
-  ParseResult result = parser_wrapper->getNextStatement();
-  DCHECK(result.condition == ParseResult::kSuccess);
-
-  const ParseStatement &statement = *result.parsed_statement;
-
-  // Generate the query plan.
-  std::unique_ptr<QueryHandle> query_handle(
-      std::make_unique<QueryHandle>(query_processor->query_id(),
-                                    main_thread_client_id,
-                                    statement.getPriority()));
-  query_processor->generateQueryHandle(statement, query_handle.get());
-  DCHECK(query_handle->getQueryPlanMutable() != nullptr);
-
-  // Use foreman to execute the query plan.
-  QueryExecutionUtil::ConstructAndSendAdmitRequestMessage(
-      main_thread_client_id, foreman_client_id, query_handle.get(), bus);
-
-  QueryExecutionUtil::ReceiveQueryCompletionMessage(main_thread_client_id, bus);
-
-  // Retrieve the scalar result from the result relation.
-  const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation();
-  DCHECK(query_result_relation != nullptr);
-
-  std::vector<TypedValue> values;
-  {
-    std::vector<block_id> blocks = query_result_relation->getBlocksSnapshot();
-    DCHECK_EQ(1u, blocks.size());
-
-    BlockReference block = storage_manager->getBlock(blocks[0], *query_result_relation);
-    const TupleStorageSubBlock &tuple_store = block->getTupleStorageSubBlock();
-    DCHECK_EQ(1, tuple_store.numTuples());
-
-    const std::size_t num_columns = tuple_store.getRelation().size();
-    if (tuple_store.isPacked()) {
-      for (std::size_t i = 0; i < num_columns; ++i) {
-        values.emplace_back(tuple_store.getAttributeValueTyped(0, i));
-        values[i].ensureNotReference();
-      }
-    } else {
-      std::unique_ptr<TupleIdSequence> existence_map(tuple_store.getExistenceMap());
-      for (std::size_t i = 0; i < num_columns; ++i) {
-        values.emplace_back(
-            tuple_store.getAttributeValueTyped(*existence_map->begin(), i));
-        values[i].ensureNotReference();
-      }
-    }
-  }
-
-  // Drop the result relation.
-  DropRelation::Drop(*query_result_relation,
-                     query_processor->getDefaultDatabase(),
-                     storage_manager);
-
-  return values;
-}
-
-/**
- * @brief A helper function that executes a SQL query to obtain a scalar result.
- */
-inline TypedValue executeQueryForSingleResult(
-    const tmb::client_id main_thread_client_id,
-    const tmb::client_id foreman_client_id,
-    const std::string &query_string,
-    tmb::MessageBus *bus,
-    StorageManager *storage_manager,
-    QueryProcessor *query_processor,
-    SqlParserWrapper *parser_wrapper) {
-  std::vector<TypedValue> results =
-      executeQueryForSingleRow(main_thread_client_id,
-                               foreman_client_id,
-                               query_string,
-                               bus,
-                               storage_manager,
-                               query_processor,
-                               parser_wrapper);
-  DCHECK_EQ(1u, results.size());
-  return results[0];
-}
-
-void executeAnalyze(const PtrVector<ParseString> *arguments,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out) {
-  const CatalogDatabase &database = *query_processor->getDefaultDatabase();
-
-  std::unique_ptr<SqlParserWrapper> parser_wrapper(new SqlParserWrapper());
-  std::vector<std::reference_wrapper<const CatalogRelation>> relations;
-  if (arguments->size() == 0) {
-    relations.insert(relations.begin(), database.begin(), database.end());
-  } else {
-    for (const auto &rel_name : *arguments) {
-      const CatalogRelation *rel = database.getRelationByName(rel_name.value());
-      if (rel == nullptr) {
-        THROW_SQL_ERROR_AT(&rel_name) << "Table does not exist";
-      } else {
-        relations.emplace_back(*rel);
-      }
-    }
-  }
-
-  // Analyze each relation in the database.
-  for (const CatalogRelation &relation : relations) {
-    fprintf(out, "Analyzing %s ... ", relation.getName().c_str());
-    fflush(out);
-
-    CatalogRelation *mutable_relation =
-        query_processor->getDefaultDatabase()->getRelationByIdMutable(relation.getID());
-
-    // Get the number of distinct values for each column.
-    for (const CatalogAttribute &attribute : relation) {
-      std::string query_string = "SELECT COUNT(DISTINCT ";
-      query_string.append(attribute.getName());
-      query_string.append(") FROM ");
-      query_string.append(relation.getName());
-      query_string.append(";");
-
-      std::vector<TypedValue> results =
-          executeQueryForSingleRow(main_thread_client_id,
-                                   foreman_client_id,
-                                   query_string,
-                                   bus,
-                                   storage_manager,
-                                   query_processor,
-                                   parser_wrapper.get());
-
-      auto *stat = mutable_relation->getStatisticsMutable();
-      const attribute_id attr_id = attribute.getID();
-
-      DCHECK(results[0].getTypeID() == TypeID::kLong);
-      stat->setNumDistinctValues(attr_id,
-                                 results[0].getLiteral<std::int64_t>());
-    }
-
-    // Get the number of tuples for the relation.
-    std::string query_string = "SELECT COUNT(*) FROM ";
-    query_string.append(relation.getName());
-    query_string.append(";");
-
-    TypedValue num_tuples =
-        executeQueryForSingleResult(main_thread_client_id,
-                                    foreman_client_id,
-                                    query_string,
-                                    bus,
-                                    storage_manager,
-                                    query_processor,
-                                    parser_wrapper.get());
-
-    DCHECK(num_tuples.getTypeID() == TypeID::kLong);
-    mutable_relation->getStatisticsMutable()->setNumTuples(
-        num_tuples.getLiteral<std::int64_t>());
-
-    fprintf(out, "done\n");
-    fflush(out);
-  }
-  query_processor->markCatalogAltered();
-  query_processor->saveCatalog();
-}
-
-}  // namespace
-
-void executeCommand(const ParseStatement &statement,
-                    const CatalogDatabase &catalog_database,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out) {
-  const ParseCommand &command = static_cast<const ParseCommand &>(statement);
-  const PtrVector<ParseString> *arguments = command.arguments();
-  const std::string &command_str = command.command()->value();
-  if (command_str == C::kDescribeDatabaseCommand) {
-    executeDescribeDatabase(arguments, catalog_database, storage_manager, out);
-  } else if (command_str == C::kDescribeTableCommand) {
-    if (arguments->size() == 0) {
-      executeDescribeDatabase(arguments, catalog_database, storage_manager, out);
-    } else {
-      executeDescribeTable(arguments, catalog_database, out);
-    }
-  } else if (command_str == C::kAnalyzeCommand) {
-    executeAnalyze(arguments,
-                   main_thread_client_id,
-                   foreman_client_id,
-                   bus,
-                   storage_manager,
-                   query_processor, out);
-  } else {
-    THROW_SQL_ERROR_AT(command.command()) << "Invalid Command";
-  }
-}
-}  // namespace cli
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CommandExecutor.hpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.hpp b/cli/CommandExecutor.hpp
deleted file mode 100644
index a1d9af9..0000000
--- a/cli/CommandExecutor.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_CLI_COMMAND_COMMAND_EXECUTOR_HPP_
-#define QUICKSTEP_CLI_COMMAND_COMMAND_EXECUTOR_HPP_
-
-#include <cstdio>
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabase;
-class ParseStatement;
-class QueryProcessor;
-class StorageManager;
-
-namespace cli {
-
-/** \addtogroup CLI
- *  @{
- */
-
-// Adding the max column width as 6  as the default initializer
-// as the length of the word Column is 6 characters.
-// This is used while describing the table.
-constexpr int kInitMaxColumnWidth = 6;
-
-constexpr char kDescribeDatabaseCommand[] = "\\dt";
-constexpr char kDescribeTableCommand[] = "\\d";
-constexpr char kAnalyzeCommand[] = "\\analyze";
-
-/**
-  * @brief Executes the command by calling the command handler.
-  *
-  * @param statement The parsed statement from the cli.
-  * @param catalog_database The catalog information about the current database.
-  * @param main_thread_client_id The TMB client ID of the main thread.
-  * @param foreman_client_id The TMB client ID of the Foreman thread.
-  * @param bus A pointer to the TMB.
-  * @param storage_manager The current StorageManager.
-  * @param query_processor The query processor to generate plans for SQL queries.
-  * @param foreman The foreman to execute query plans.
-  * @param out The stream where the output of the command has to be redirected to.
-*/
-void executeCommand(const ParseStatement &statement,
-                    const CatalogDatabase &catalog_database,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    tmb::MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out);
-
-/** @} */
-
-}  // namespace cli
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_COMMAND_COMMAND_EXECUTOR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DefaultsConfigurator.cpp
----------------------------------------------------------------------
diff --git a/cli/DefaultsConfigurator.cpp b/cli/DefaultsConfigurator.cpp
deleted file mode 100644
index 94280a7..0000000
--- a/cli/DefaultsConfigurator.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "cli/DefaultsConfigurator.hpp"
-
-#include "cli/CliConfig.h"  // For QUICKSTEP_OS_WINDOWS.
-
-#ifdef QUICKSTEP_OS_WINDOWS
-// TODO(jmp): If filesystem shows up in C++-17, we can switch to just using that.
-#include <experimental/filesystem>
-#else
-#include <cstdlib>
-#endif  // QUICKSTEP_OS_WINDOWS
-
-#include <fstream>
-#include <string>
-
-#include "catalog/Catalog.hpp"
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogDatabase.hpp"
-
-#include "glog/logging.h"
-
-using std::string;
-
-namespace quickstep {
-
-void DefaultsConfigurator::InitializeDefaultDatabase(const string &storage_path, const string &catalog_path) {
-  // TODO(jmp): Refactor the code in this file!
-  LOG(INFO) << "Initializing the database, creating a new catalog file and storage directory";
-
-  // Create the directory
-  // TODO(jmp): At some point, likely in C++-17, we will just have the
-  //            filesystem path, and we can clean this up
-#ifdef QUICKSTEP_OS_WINDOWS
-  CHECK(std::experimental::filesystem::create_directories(storage_path))
-      << "Failed when attempting to create the directory: " << storage_path
-      << "\nCheck if the directory already exists. If so, delete it or move it before initializing";
-#else
-  {
-    const string path_name = "mkdir " + storage_path;
-    CHECK(std::system(path_name.c_str()))
-         << "Failed when attempting to create the directory: " << storage_path;
-  }
-#endif  // QUICKSTEP_OS_WINDOWS
-
-  // Create the default catalog file.
-  std::ofstream catalog_file(catalog_path.c_str());
-  CHECK(catalog_file.good())
-      << "ERROR: Unable to open " << catalog_path << " for writing.";
-
-  Catalog catalog;
-  catalog.addDatabase(new CatalogDatabase(nullptr, "default"));
-
-  CHECK(catalog.getProto().SerializeToOstream(&catalog_file))
-      << "ERROR: Unable to serialize catalog proto to file " << catalog_path;
-
-  // Close the catalog file - it will be reopened below by the QueryProcessor.
-  catalog_file.close();
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DefaultsConfigurator.hpp
----------------------------------------------------------------------
diff --git a/cli/DefaultsConfigurator.hpp b/cli/DefaultsConfigurator.hpp
deleted file mode 100644
index 4b534d6..0000000
--- a/cli/DefaultsConfigurator.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_CLI_DEFAULTS_CONFIGURATOR_HPP_
-#define QUICKSTEP_CLI_DEFAULTS_CONFIGURATOR_HPP_
-
-#include "storage/StorageConfig.h"  // For QUICKSTEP_HAVE_LIBNUMA.
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include <numa.h>
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-#include <cstddef>
-#include <string>
-#include <thread>  // NOLINT(build/c++11)
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include <unordered_map>
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- * @{
- **/
-
-/**
- * @brief A static class for setting the default configuration parameters in
- *        Quickstep.
- **/
-class DefaultsConfigurator {
- public:
-  /**
-   * @brief Get the number of concurrent threads supported by the hardware,
-   *
-   * @note This function will return 0, if it fails (which it may on some
-   *       machines/environments).
-   **/
-  static std::size_t GetNumHardwareThreads() {
-    return std::thread::hardware_concurrency();
-  }
-
-  /**
-   * @brief Get the number of available numa sockets.
-   *
-   * @return Number of available numa sockets. Always 1 if the system doesn't
-   *         have libnuma.
-   **/
-  static std::size_t GetNumNUMANodes() {
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    // Id of the maximum node.
-    return numa_max_node() + 1;
-#else
-    return 1;
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-  }
-
-  /**
-   * @brief Get the number of NUMA nodes covered by the given worker affinities
-   *        to the CPU cores.
-   *
-   * @param worker_cpu_affinities A vector V where V[i] is the CPU core to which
-   *        worker with index i is affinitized.
-   *
-   * @return The number of NUMA nodes that are covered by the given set of
-   *         workers.
-   **/
-  static std::size_t GetNumNUMANodesCoveredByWorkers(const std::vector<int> &worker_cpu_affinities) {
-    if (!worker_cpu_affinities.empty()) {
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-      // Key = NUMA node, value = whether there is at least one worker whose
-      // affinity is set to a core on the given NUMA node.
-      std::unordered_map<int, bool> any_worker_on_numa_node;
-      for (const int curr_cpu_core_id : worker_cpu_affinities) {
-        const int curr_numa_node_id = numa_node_of_cpu(curr_cpu_core_id);
-        if (curr_numa_node_id >= 0) {
-          // Note - For the purpose of this function, the value is always true.
-          // Therefore, we can rely on the size of the map to get the count.
-          any_worker_on_numa_node[curr_numa_node_id] = true;
-        }
-      }
-      return any_worker_on_numa_node.size();
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-    }
-    // When libnuma is not available, or worker affinities are not specified,
-    // the default return value is 1.
-    return 1;
-  }
-
-  /**
-   * @brief Initialize the default database with no relations.
-   *
-   * @param storage_path The filesystem directory to store catalog.
-   * @param catalog_path The full path of the catalog file.
-   **/
-  static void InitializeDefaultDatabase(const std::string &storage_path,
-                                        const std::string &catalog_path);
-
- private:
-  /**
-   * @brief Private constructor to disable instantiation of the class.
-   **/
-  DefaultsConfigurator();
-
-  DISALLOW_COPY_AND_ASSIGN(DefaultsConfigurator);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_DEFAULTS_CONFIGURATOR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DropRelation.cpp
----------------------------------------------------------------------
diff --git a/cli/DropRelation.cpp b/cli/DropRelation.cpp
deleted file mode 100644
index 9bf75f2..0000000
--- a/cli/DropRelation.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "cli/DropRelation.hpp"
-
-#include <vector>
-
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageManager.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-void DropRelation::Drop(const CatalogRelation &relation,
-                        CatalogDatabase *database,
-                        StorageManager *storage_manager) {
-  std::vector<block_id> relation_blocks(relation.getBlocksSnapshot());
-  for (const block_id relation_block_id : relation_blocks) {
-    storage_manager->deleteBlockOrBlobFile(relation_block_id);
-  }
-
-  const relation_id rel_id = relation.getID();
-  DEBUG_ASSERT(database->hasRelationWithId(rel_id));
-  database->dropRelationById(rel_id);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DropRelation.hpp
----------------------------------------------------------------------
diff --git a/cli/DropRelation.hpp b/cli/DropRelation.hpp
deleted file mode 100644
index 91cea43..0000000
--- a/cli/DropRelation.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_CLI_DROP_RELATION_HPP_
-#define QUICKSTEP_CLI_DROP_RELATION_HPP_
-
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class CatalogRelation;
-class StorageManager;
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief All static methods which drop a relation.
- **/
-class DropRelation {
- public:
-  static void Drop(const CatalogRelation &relation,
-                   CatalogDatabase *database,
-                   StorageManager *storage_manager);
-
- private:
-  // Undefined default constructor. Class is all-static and should not be
-  // instantiated.
-  DropRelation();
-
-  DISALLOW_COPY_AND_ASSIGN(DropRelation);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_DROP_RELATION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/Flags.cpp
----------------------------------------------------------------------
diff --git a/cli/Flags.cpp b/cli/Flags.cpp
deleted file mode 100644
index 87f9f73..0000000
--- a/cli/Flags.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "cli/Flags.hpp"
-
-#include <cstddef>
-#include <cstdio>
-#include <string>
-
-#include "cli/DefaultsConfigurator.hpp"
-#include "storage/StorageConstants.hpp"
-
-#include "gflags/gflags.h"
-
-using std::fprintf;
-
-namespace quickstep {
-
-static bool ValidateNumWorkers(const char *flagname, int value) {
-  if (value > 0) {
-    return true;
-  }
-
-  // Detect the hardware concurrency level.
-  const std::size_t num_hw_threads =
-      DefaultsConfigurator::GetNumHardwareThreads();
-
-  // Use the command-line value if that was supplied, else use the value
-  // that we computed above, provided it did return a valid value.
-  // TODO(jmp): May need to change this at some point to keep one thread
-  //            available for the OS if the hardware concurrency level is high.
-  FLAGS_num_workers = num_hw_threads != 0 ? num_hw_threads : 1;
-
-  return FLAGS_num_workers > 0;
-}
-DEFINE_int32(num_workers, 0, "Number of worker threads. If this value is "
-             "specified and is greater than 0, then this user-supplied value is "
-             "used. Else (i.e. the default case), we examine the reported "
-             "hardware concurrency level, and use that.");
-static const volatile bool num_workers_dummy
-    = gflags::RegisterFlagValidator(&FLAGS_num_workers, &ValidateNumWorkers);
-
-static bool ValidateStoragePath(const char *flagname,
-                                const std::string &value) {
-  if (!value.empty() && value.back() != kPathSeparator) {
-    FLAGS_storage_path.push_back(kPathSeparator);
-  }
-
-  return true;
-}
-DEFINE_string(storage_path, kDefaultStoragePath,
-              "Filesystem path to store the Quickstep database.");
-static const volatile bool storage_path_dummy
-    = gflags::RegisterFlagValidator(&FLAGS_storage_path, &ValidateStoragePath);
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/Flags.hpp
----------------------------------------------------------------------
diff --git a/cli/Flags.hpp b/cli/Flags.hpp
deleted file mode 100644
index b020a3e..0000000
--- a/cli/Flags.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_CLI_FLAGS_HPP_
-#define QUICKSTEP_CLI_FLAGS_HPP_
-
-#include "gflags/gflags_declare.h"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief A collection of common flags shared by Quickstep CLIs in both the
- * single-node and the distributed version.
- **/
-DECLARE_int32(num_workers);
-
-DECLARE_string(storage_path);
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_FLAGS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/InputParserUtil.cpp
----------------------------------------------------------------------
diff --git a/cli/InputParserUtil.cpp b/cli/InputParserUtil.cpp
deleted file mode 100644
index e45605c..0000000
--- a/cli/InputParserUtil.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "cli/InputParserUtil.hpp"
-
-#include <cstddef>
-#include <iostream>
-#include <memory>
-#include <ostream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogConfig.h"
-#include "storage/StorageConfig.h"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include <numa.h>
-#endif
-
-using std::string;
-
-namespace quickstep {
-
-std::vector<int> InputParserUtil::ParseWorkerAffinities(
-    const int num_workers,
-    const string &affinity_string) {
-  std::vector<int> affinities;
-  bool switch_to_default_affinities = false;
-  if (affinity_string.empty()) {
-    switch_to_default_affinities = true;
-    LOG(INFO) << "Empty worker affinities provided, switching to default "
-                 "worker affinities";
-  } else if (!ParseIntString(affinity_string, ',', &affinities)) {
-      switch_to_default_affinities = true;
-      LOG(INFO) << "Invalid worker affinities provided, switching to default "
-                   "affinities";
-  }
-
-  for (const int affinity : affinities) {
-    if (affinity < -1) {
-      switch_to_default_affinities = true;
-      LOG(INFO) << "CPU affinities specified by --worker_affinities must be "
-                   "non-negative, or -1 to specify no affinity. Switching to "
-                   "default worker affinities";
-      break;
-    }
-  }
-
-  if (switch_to_default_affinities) {
-    // Set default affinities.
-    // If the number of worker threads is less than the maximum parallelism on
-    // the box, we try to balance workers on all sockets. The intention is to
-    // balance the memory bandwidth usage across all sockets. This may however
-    // hurt the performance (due to poor data locality) when the machine has
-    // many sockets and data is not partitioned.
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    // This code is inspired from the print_node_cpus() function of numactl.
-    // WARNING - If some NUMA sockets are disabled, we can't detect it.
-    const int num_sockets = numa_num_configured_nodes();
-    CHECK_GT(num_sockets, 0);
-    // A vector V where V[i] denotes a vector of CPU cores that belong to the
-    // socket i.
-    std::vector<std::vector<int>> cpus_from_sockets;
-    cpus_from_sockets.resize(num_sockets);
-    for (int curr_socket = 0; curr_socket < num_sockets; ++curr_socket) {
-      std::unique_ptr<struct bitmask> cpus(numa_allocate_cpumask());
-      const int err = numa_node_to_cpus(curr_socket, cpus.get());
-      if (err >= 0) {
-        for (int i = 0; i < static_cast<int>(cpus->size); i++) {
-          if (numa_bitmask_isbitset(cpus.get(), i)) {
-            // The current CPU belongs to curr_socket.
-            cpus_from_sockets[curr_socket].push_back(i);
-          }
-        }
-      }
-    }
-    // Now assign affinity to each worker, picking one CPU from each socket in a
-    // round robin manner.
-    int curr_socket = 0;
-    std::size_t iteration = 0;
-    for (int curr_worker = 0; curr_worker < num_workers; ++curr_worker) {
-      if (iteration < cpus_from_sockets[curr_socket].size()) {
-        const int curr_worker_affinity =
-            cpus_from_sockets[curr_socket][iteration];
-        affinities.push_back(curr_worker_affinity);
-      }
-      // Increase iteration number only when we are at the last socket.
-      iteration = iteration + ((curr_socket + 1) / num_sockets);
-      curr_socket = (curr_socket + 1) % num_sockets;
-    }
-#endif
-  }
-
-  if (affinities.size() < static_cast<std::size_t>(num_workers)) {
-    std::cout << "--num_workers is " << num_workers << ", but only "
-              << "specified " << affinities.size() << " CPU affinities "
-              << "with --worker_affinities. "
-              << (num_workers - affinities.size()) << " workers will be "
-              << "unaffinitized.\n";
-    affinities.resize(num_workers, -1);
-  } else if (affinities.size() > static_cast<std::size_t>(num_workers)) {
-    std::cout << "--num_workers is " << num_workers << ", but specified "
-              << affinities.size() << " CPU affinities with "
-              << "--worker_affinities. Extra affinities will be ignored.\n";
-    affinities.resize(num_workers);
-  }
-
-  return affinities;
-}
-
-std::vector<int> InputParserUtil::GetNUMANodesForCPUs() {
-  std::vector<int> numa_nodes_of_cpus;
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-  const int num_cpus = numa_num_configured_cpus();
-  numa_nodes_of_cpus.reserve(num_cpus);
-  for (int curr_cpu = 0; curr_cpu < num_cpus; ++curr_cpu) {
-    numa_nodes_of_cpus.push_back(numa_node_of_cpu(curr_cpu));
-  }
-#endif
-  return numa_nodes_of_cpus;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/InputParserUtil.hpp
----------------------------------------------------------------------
diff --git a/cli/InputParserUtil.hpp b/cli/InputParserUtil.hpp
deleted file mode 100644
index d34dbed..0000000
--- a/cli/InputParserUtil.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_CLI_INPUT_PARSER_UTIL_HPP_
-#define QUICKSTEP_CLI_INPUT_PARSER_UTIL_HPP_
-
-#include <string>
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief A static utility class for parsing input to Quickstep CLI.
- **/
-class InputParserUtil {
- public:
-  /**
-   * @brief Parse an input string consisting of worker thread's CPU core
-   *        affinities.
-   *
-   * @param num_workers The number of worker threads.
-   * @param affinity_string A string consisting of the worker thread affinities.
-   *
-   * @note Check cli/QuickstepCli.cpp for the description on the format of the
-   *       affinity_string.
-   *
-   * @return A vector of CPU cores to which workers are affinitized. If no
-   *         information is available for a worker, we assign -1.
-   **/
-  static std::vector<int> ParseWorkerAffinities(
-      const int num_workers,
-      const std::string &affinity_string);
-
-  /**
-   * @brief Get NUMA nodes of all the CPUs.
-   *
-   * @note This function is only relevant when libnuma is present.
-   *
-   * @return A vector where ith element is the NUMA node of ith CPU, starting
-   *         from 0.
-   **/
-  static std::vector<int> GetNUMANodesForCPUs();
-
- private:
-  /**
-   * @brief Private constructor to disable instantiation of the class.
-   **/
-  InputParserUtil();
-
-  DISALLOW_COPY_AND_ASSIGN(InputParserUtil);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_INPUT_PARSER_UTIL_HPP_