[02/11] incubator-quickstep git commit: Updates to save blocks and analyze

2017-12-11 Thread jianqiao
Updates to save blocks and analyze


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/b45cdbc6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/b45cdbc6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/b45cdbc6

Branch: refs/heads/transitive-closure
Commit: b45cdbc63be488aad3211b5146dfe6f8fbfdc024
Parents: df20e4c
Author: Jianqiao Zhu 
Authored: Mon Nov 27 16:21:03 2017 -0600
Committer: Jianqiao Zhu 
Committed: Mon Nov 27 16:21:03 2017 -0600

--
 catalog/CatalogRelationStatistics.hpp |   9 ++
 cli/CommandExecutor.cpp   | 249 -
 cli/Constants.hpp |   2 +
 storage/StorageManager.cpp|  12 +-
 4 files changed, 222 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b45cdbc6/catalog/CatalogRelationStatistics.hpp
--
diff --git a/catalog/CatalogRelationStatistics.hpp 
b/catalog/CatalogRelationStatistics.hpp
index df95231..55fc747 100644
--- a/catalog/CatalogRelationStatistics.hpp
+++ b/catalog/CatalogRelationStatistics.hpp
@@ -68,6 +68,15 @@ class CatalogRelationStatistics {
   serialization::CatalogRelationStatistics getProto() const;
 
   /**
+   * @brief Clear all statistics.
+   */
+  void clear() {
+num_tuples_ = kNullValue;
+column_stats_.clear();
+is_exact_ = true;
+  }
+
+  /**
* @brief Check whether the statistics are exact for the relation.
*
* return True if the statistics are exact for the relation, false otherwise.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b45cdbc6/cli/CommandExecutor.cpp
--
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index 6a84672..7976d7d 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -201,9 +201,28 @@ void ExecuteAnalyze(const PtrVector 
&arguments,
 CatalogRelationStatistics *mutable_stat =
 mutable_relation->getStatisticsMutable();
 
+mutable_stat->clear();
+
 const std::string rel_name = EscapeQuotes(relation.getName(), '"');
 
-// Get the number of distinct values for each column.
+// Get the number of tuples for the relation.
+std::string query_string = "SELECT COUNT(*) FROM \"";
+query_string.append(rel_name);
+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_EQ(TypeID::kLong, num_tuples.getTypeID());
+mutable_stat->setNumTuples(num_tuples.getLiteral());
+
+// Get the min/max values for each column.
 for (const CatalogAttribute &attribute : relation) {
   const std::string attr_name = EscapeQuotes(attribute.getName(), '"');
   const Type &attr_type = attribute.getType();
@@ -211,24 +230,15 @@ void ExecuteAnalyze(const PtrVector 
&arguments,
   AggregateFunctionMin::Instance().canApplyToTypes({&attr_type});
   bool is_max_applicable =
   AggregateFunctionMax::Instance().canApplyToTypes({&attr_type});
+  if (!is_min_applicable || !is_max_applicable) {
+continue;
+  }
 
-  // NOTE(jianqiao): Note that the relation name and the attribute names 
may
-  // contain non-letter characters, e.g. CREATE TABLE "with space"("1" 
int).
-  // So here we need to format the names with double quotes (").
-  std::string query_string = "SELECT COUNT(DISTINCT \"";
+  std::string query_string = "SELECT MIN(\"";
   query_string.append(attr_name);
-  query_string.append("\")");
-  if (is_min_applicable) {
-query_string.append(", MIN(\"");
-query_string.append(attr_name);
-query_string.append("\")");
-  }
-  if (is_max_applicable) {
-query_string.append(", MAX(\"");
-query_string.append(attr_name);
-query_string.append("\")");
-  }
-  query_string.append(" FROM \"");
+  query_string.append("\"), MAX(\"");
+  query_string.append(attr_name);
+  query_string.append("\") FROM \"");
   query_string.append(rel_name);
   query_string.append("\";");
 
@@ -240,42 +250,181 @@ void ExecuteAnalyze(const PtrVector 
&arguments,
storage_manager,
query_processor,
parser_wrapper.get());
-
-  aut

[07/11] incubator-quickstep git commit: Initialize updates for transitive closure

2017-12-11 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/734ddc1e/parser/preprocessed/SqlParser_gen.hpp
--
diff --git a/parser/preprocessed/SqlParser_gen.hpp 
b/parser/preprocessed/SqlParser_gen.hpp
index 142059d..130f353 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -78,107 +78,108 @@ extern int quickstep_yydebug;
 TOKEN_BLOCKPROPERTIES = 288,
 TOKEN_BLOCKSAMPLE = 289,
 TOKEN_BLOOM_FILTER = 290,
-TOKEN_CSB_TREE = 291,
-TOKEN_BY = 292,
-TOKEN_CASE = 293,
-TOKEN_CHARACTER = 294,
-TOKEN_CHECK = 295,
-TOKEN_COLUMN = 296,
+TOKEN_BY = 291,
+TOKEN_CASE = 292,
+TOKEN_CHARACTER = 293,
+TOKEN_CHECK = 294,
+TOKEN_COLUMN = 295,
+TOKEN_CONNECT = 296,
 TOKEN_CONSTRAINT = 297,
 TOKEN_COPY = 298,
 TOKEN_CREATE = 299,
-TOKEN_CURRENT = 300,
-TOKEN_DATE = 301,
-TOKEN_DATETIME = 302,
-TOKEN_DAY = 303,
-TOKEN_DECIMAL = 304,
-TOKEN_DEFAULT = 305,
-TOKEN_DELETE = 306,
-TOKEN_DESC = 307,
-TOKEN_DISTINCT = 308,
-TOKEN_DOUBLE = 309,
-TOKEN_DROP = 310,
-TOKEN_ELSE = 311,
-TOKEN_END = 312,
-TOKEN_EXISTS = 313,
-TOKEN_EXTRACT = 314,
-TOKEN_FALSE = 315,
-TOKEN_FIRST = 316,
-TOKEN_FLOAT = 317,
-TOKEN_FOLLOWING = 318,
-TOKEN_FOR = 319,
-TOKEN_FOREIGN = 320,
-TOKEN_FROM = 321,
-TOKEN_FULL = 322,
-TOKEN_GROUP = 323,
-TOKEN_HASH = 324,
-TOKEN_HAVING = 325,
-TOKEN_HOUR = 326,
-TOKEN_IN = 327,
-TOKEN_INDEX = 328,
-TOKEN_INNER = 329,
-TOKEN_INSERT = 330,
-TOKEN_INTEGER = 331,
-TOKEN_INTERVAL = 332,
-TOKEN_INTO = 333,
-TOKEN_JOIN = 334,
-TOKEN_KEY = 335,
-TOKEN_LAST = 336,
-TOKEN_LEFT = 337,
-TOKEN_LIMIT = 338,
-TOKEN_LONG = 339,
-TOKEN_MINUTE = 340,
-TOKEN_MONTH = 341,
-TOKEN_NULL = 342,
-TOKEN_NULLS = 343,
-TOKEN_OFF = 344,
-TOKEN_ON = 345,
-TOKEN_ORDER = 346,
-TOKEN_OUTER = 347,
-TOKEN_OVER = 348,
-TOKEN_PARTITION = 349,
-TOKEN_PARTITIONS = 350,
-TOKEN_PERCENT = 351,
-TOKEN_PRECEDING = 352,
-TOKEN_PRIMARY = 353,
-TOKEN_PRIORITY = 354,
-TOKEN_QUIT = 355,
-TOKEN_RANGE = 356,
-TOKEN_REAL = 357,
-TOKEN_REFERENCES = 358,
-TOKEN_RIGHT = 359,
-TOKEN_ROW = 360,
-TOKEN_ROW_DELIMITER = 361,
-TOKEN_ROWS = 362,
-TOKEN_SECOND = 363,
-TOKEN_SELECT = 364,
-TOKEN_SET = 365,
-TOKEN_SMA = 366,
-TOKEN_SMALLINT = 367,
-TOKEN_STDERR = 368,
-TOKEN_STDOUT = 369,
-TOKEN_SUBSTRING = 370,
-TOKEN_TABLE = 371,
-TOKEN_THEN = 372,
-TOKEN_TIME = 373,
-TOKEN_TIMESTAMP = 374,
-TOKEN_TO = 375,
-TOKEN_TRUE = 376,
-TOKEN_TUPLESAMPLE = 377,
-TOKEN_UNBOUNDED = 378,
-TOKEN_UNIQUE = 379,
-TOKEN_UPDATE = 380,
-TOKEN_USING = 381,
-TOKEN_VALUES = 382,
-TOKEN_VARCHAR = 383,
-TOKEN_WHEN = 384,
-TOKEN_WHERE = 385,
-TOKEN_WINDOW = 386,
-TOKEN_WITH = 387,
-TOKEN_YEAR = 388,
-TOKEN_YEARMONTH = 389,
-TOKEN_EOF = 390,
-TOKEN_LEX_ERROR = 391
+TOKEN_CSB_TREE = 300,
+TOKEN_CURRENT = 301,
+TOKEN_DATE = 302,
+TOKEN_DATETIME = 303,
+TOKEN_DAY = 304,
+TOKEN_DECIMAL = 305,
+TOKEN_DEFAULT = 306,
+TOKEN_DELETE = 307,
+TOKEN_DESC = 308,
+TOKEN_DISTINCT = 309,
+TOKEN_DOUBLE = 310,
+TOKEN_DROP = 311,
+TOKEN_ELSE = 312,
+TOKEN_END = 313,
+TOKEN_EXISTS = 314,
+TOKEN_EXTRACT = 315,
+TOKEN_FALSE = 316,
+TOKEN_FIRST = 317,
+TOKEN_FLOAT = 318,
+TOKEN_FOLLOWING = 319,
+TOKEN_FOR = 320,
+TOKEN_FOREIGN = 321,
+TOKEN_FROM = 322,
+TOKEN_FULL = 323,
+TOKEN_GROUP = 324,
+TOKEN_HASH = 325,
+TOKEN_HAVING = 326,
+TOKEN_HOUR = 327,
+TOKEN_IN = 328,
+TOKEN_INDEX = 329,
+TOKEN_INNER = 330,
+TOKEN_INSERT = 331,
+TOKEN_INTEGER = 332,
+TOKEN_INTERVAL = 333,
+TOKEN_INTO = 334,
+TOKEN_JOIN = 335,
+TOKEN_KEY = 336,
+TOKEN_LAST = 337,
+TOKEN_LEFT = 338,
+TOKEN_LIMIT = 339,
+TOKEN_LONG = 340,
+TOKEN_MINUTE = 341,
+TOKEN_MONTH = 342,
+TOKEN_NULL = 343,
+TOKEN_NULLS = 344,
+TOKEN_OFF = 345,
+TOKEN_ON = 346,
+TOKEN_ORDER = 347,
+TOKEN_OUTER = 348,
+TOKEN_OVER = 349,
+TOKEN_PARTITION = 350,
+TOKEN_PARTITIONS = 351,
+TOKEN_PERCENT = 352,
+TOKEN_PRECEDING = 353,
+TOKEN_PRIMARY = 354,
+TOKEN_PRIORITY = 355,
+TOKEN_QUIT = 356,
+TOKEN_RANGE = 357,
+TOKEN_REAL = 358,
+TOKEN_REFERENCES = 359,
+TOKEN_RIGHT = 360,
+TOKEN_ROW = 361,
+TOKEN_ROW_DELIMITER = 362,
+TOKEN_ROWS = 363,
+TOKEN_SECOND = 364,
+TOKEN_SELECT = 365,
+TOKEN_SET = 366,
+TOKEN_SMA = 367,
+TOKEN_SMALLINT = 368,
+TOKEN_STDERR = 369,
+TOKEN_STDOUT = 370,
+TOKEN_SUBSTRING = 371,
+TOKEN_TABLE = 372,
+TOKEN_THEN = 373,
+TOKEN_TIME 

[01/11] incubator-quickstep git commit: Updates to compact key hash table

2017-12-11 Thread jianqiao
Repository: incubator-quickstep
Updated Branches:
  refs/heads/transitive-closure [created] 2aefd7bce


Updates to compact key hash table


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/df20e4c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/df20e4c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/df20e4c0

Branch: refs/heads/transitive-closure
Commit: df20e4c09ec3a8490b1d1ddcd590d813a873181e
Parents: 3595bc1
Author: Jianqiao Zhu 
Authored: Sun Nov 26 21:16:46 2017 -0600
Committer: Jianqiao Zhu 
Committed: Mon Nov 27 16:06:44 2017 -0600

--
 query_optimizer/CMakeLists.txt  |   1 +
 query_optimizer/ExecutionGenerator.cpp  | 109 ++---
 .../cost_model/StarSchemaSimpleCostModel.cpp|  39 +++-
 .../cost_model/StarSchemaSimpleCostModel.hpp|   4 +-
 query_optimizer/rules/FuseAggregateJoin.cpp |   6 -
 .../FinalizeAggregationOperator.cpp |  29 +--
 .../FinalizeAggregationOperator.hpp |   3 -
 .../InitializeAggregationOperator.cpp   |  24 +-
 .../InitializeAggregationOperator.hpp   |   7 +-
 storage/AggregationOperationState.cpp   | 134 ++-
 storage/AggregationOperationState.hpp   |  38 +--
 storage/AggregationOperationState.proto |   3 -
 storage/CMakeLists.txt  |  24 ++
 storage/CollisionFreeVectorTable.cpp|  58 -
 storage/CollisionFreeVectorTable.hpp|  42 ++--
 storage/CompactKeySeparateChainingHashTable.cpp | 195 
 storage/CompactKeySeparateChainingHashTable.hpp | 234 +++
 storage/Flags.hpp   |   1 -
 storage/HashTable.proto |  15 +-
 storage/HashTableBase.hpp   |   1 +
 storage/HashTableFactory.hpp|  24 +-
 utility/CMakeLists.txt  |  10 +
 utility/Range.hpp   | 188 +++
 utility/ScopedArray.hpp |  78 +++
 24 files changed, 977 insertions(+), 290 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/df20e4c0/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 5e0db44..011cecb 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -148,6 +148,7 @@ 
target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
   quickstep_relationaloperators_UpdateOperator
   quickstep_relationaloperators_WindowAggregationOperator
   quickstep_storage_AggregationOperationState_proto
+  quickstep_storage_Flags
   quickstep_storage_HashTableFactory
   quickstep_storage_HashTable_proto
   quickstep_storage_InsertDestination_proto

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/df20e4c0/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index b0d3c48..3ef74ee 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -132,6 +132,7 @@
 #include "relational_operators/UpdateOperator.hpp"
 #include "relational_operators/WindowAggregationOperator.hpp"
 #include "storage/AggregationOperationState.pb.h"
+#include "storage/Flags.hpp"
 #include "storage/HashTable.pb.h"
 #include "storage/HashTableFactory.hpp"
 #include "storage/InsertDestination.pb.h"
@@ -199,70 +200,6 @@ namespace S = ::quickstep::serialization;
 
 namespace {
 
-size_t CacheLineAlignedBytes(const size_t actual_bytes) {
-  return (actual_bytes + kCacheLineBytes - 1) / kCacheLineBytes * 
kCacheLineBytes;
-}
-
-size_t CalculateNumInitializationPartitionsForCollisionFreeVectorTable(const 
size_t memory_size) {
-  // At least 1 partition, at most (#workers * 2) partitions.
-  return std::max(1uL, std::min(memory_size / kCollisonFreeVectorInitBlobSize,
-static_cast(2 * FLAGS_num_workers)));
-}
-
-void CalculateCollisionFreeAggregationInfo(
-const size_t num_entries, const vector>> &group_by_aggrs_info,
-S::CollisionFreeVectorInfo *collision_free_vector_info) {
-  size_t memory_size = CacheLineAlignedBytes(
-  BarrieredReadWriteConcurrentBitVector::BytesNeeded(num_entries));
-
-  for (std::size_t i = 0; i < group_by_aggrs_info.size(); ++i) {
-const auto &group_by_aggr_info = group_by_aggrs_info[i];
-
-size_t state_size = 0;
-switch (group_by_

[08/11] incubator-quickstep git commit: Initialize updates for transitive closure

2017-12-11 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/734ddc1e/parser/preprocessed/SqlParser_gen.cpp
--
diff --git a/parser/preprocessed/SqlParser_gen.cpp 
b/parser/preprocessed/SqlParser_gen.cpp
index 9b77875..b1b4547 100644
--- a/parser/preprocessed/SqlParser_gen.cpp
+++ b/parser/preprocessed/SqlParser_gen.cpp
@@ -133,6 +133,7 @@ typedef struct YYLTYPE {
 #include "parser/ParseSubqueryExpression.hpp"
 #include "parser/ParseSubqueryTableReference.hpp"
 #include "parser/ParseTableReference.hpp"
+#include "parser/ParseTransitiveClosureTableReference.hpp"
 #include "parser/ParseWindow.hpp"
 #include "storage/StorageBlockInfo.hpp"
 #include "types/Type.hpp"
@@ -153,7 +154,7 @@ typedef struct YYLTYPE {
 // Needed for Bison 2.6 and higher, which do not automatically provide this 
typedef.
 typedef void* yyscan_t;
 
-#line 157 "SqlParser_gen.cpp" /* yacc.c:339  */
+#line 158 "SqlParser_gen.cpp" /* yacc.c:339  */
 
 # ifndef YY_NULLPTR
 #  if defined __cplusplus && 201103L <= __cplusplus
@@ -221,107 +222,108 @@ extern int quickstep_yydebug;
 TOKEN_BLOCKPROPERTIES = 288,
 TOKEN_BLOCKSAMPLE = 289,
 TOKEN_BLOOM_FILTER = 290,
-TOKEN_CSB_TREE = 291,
-TOKEN_BY = 292,
-TOKEN_CASE = 293,
-TOKEN_CHARACTER = 294,
-TOKEN_CHECK = 295,
-TOKEN_COLUMN = 296,
+TOKEN_BY = 291,
+TOKEN_CASE = 292,
+TOKEN_CHARACTER = 293,
+TOKEN_CHECK = 294,
+TOKEN_COLUMN = 295,
+TOKEN_CONNECT = 296,
 TOKEN_CONSTRAINT = 297,
 TOKEN_COPY = 298,
 TOKEN_CREATE = 299,
-TOKEN_CURRENT = 300,
-TOKEN_DATE = 301,
-TOKEN_DATETIME = 302,
-TOKEN_DAY = 303,
-TOKEN_DECIMAL = 304,
-TOKEN_DEFAULT = 305,
-TOKEN_DELETE = 306,
-TOKEN_DESC = 307,
-TOKEN_DISTINCT = 308,
-TOKEN_DOUBLE = 309,
-TOKEN_DROP = 310,
-TOKEN_ELSE = 311,
-TOKEN_END = 312,
-TOKEN_EXISTS = 313,
-TOKEN_EXTRACT = 314,
-TOKEN_FALSE = 315,
-TOKEN_FIRST = 316,
-TOKEN_FLOAT = 317,
-TOKEN_FOLLOWING = 318,
-TOKEN_FOR = 319,
-TOKEN_FOREIGN = 320,
-TOKEN_FROM = 321,
-TOKEN_FULL = 322,
-TOKEN_GROUP = 323,
-TOKEN_HASH = 324,
-TOKEN_HAVING = 325,
-TOKEN_HOUR = 326,
-TOKEN_IN = 327,
-TOKEN_INDEX = 328,
-TOKEN_INNER = 329,
-TOKEN_INSERT = 330,
-TOKEN_INTEGER = 331,
-TOKEN_INTERVAL = 332,
-TOKEN_INTO = 333,
-TOKEN_JOIN = 334,
-TOKEN_KEY = 335,
-TOKEN_LAST = 336,
-TOKEN_LEFT = 337,
-TOKEN_LIMIT = 338,
-TOKEN_LONG = 339,
-TOKEN_MINUTE = 340,
-TOKEN_MONTH = 341,
-TOKEN_NULL = 342,
-TOKEN_NULLS = 343,
-TOKEN_OFF = 344,
-TOKEN_ON = 345,
-TOKEN_ORDER = 346,
-TOKEN_OUTER = 347,
-TOKEN_OVER = 348,
-TOKEN_PARTITION = 349,
-TOKEN_PARTITIONS = 350,
-TOKEN_PERCENT = 351,
-TOKEN_PRECEDING = 352,
-TOKEN_PRIMARY = 353,
-TOKEN_PRIORITY = 354,
-TOKEN_QUIT = 355,
-TOKEN_RANGE = 356,
-TOKEN_REAL = 357,
-TOKEN_REFERENCES = 358,
-TOKEN_RIGHT = 359,
-TOKEN_ROW = 360,
-TOKEN_ROW_DELIMITER = 361,
-TOKEN_ROWS = 362,
-TOKEN_SECOND = 363,
-TOKEN_SELECT = 364,
-TOKEN_SET = 365,
-TOKEN_SMA = 366,
-TOKEN_SMALLINT = 367,
-TOKEN_STDERR = 368,
-TOKEN_STDOUT = 369,
-TOKEN_SUBSTRING = 370,
-TOKEN_TABLE = 371,
-TOKEN_THEN = 372,
-TOKEN_TIME = 373,
-TOKEN_TIMESTAMP = 374,
-TOKEN_TO = 375,
-TOKEN_TRUE = 376,
-TOKEN_TUPLESAMPLE = 377,
-TOKEN_UNBOUNDED = 378,
-TOKEN_UNIQUE = 379,
-TOKEN_UPDATE = 380,
-TOKEN_USING = 381,
-TOKEN_VALUES = 382,
-TOKEN_VARCHAR = 383,
-TOKEN_WHEN = 384,
-TOKEN_WHERE = 385,
-TOKEN_WINDOW = 386,
-TOKEN_WITH = 387,
-TOKEN_YEAR = 388,
-TOKEN_YEARMONTH = 389,
-TOKEN_EOF = 390,
-TOKEN_LEX_ERROR = 391
+TOKEN_CSB_TREE = 300,
+TOKEN_CURRENT = 301,
+TOKEN_DATE = 302,
+TOKEN_DATETIME = 303,
+TOKEN_DAY = 304,
+TOKEN_DECIMAL = 305,
+TOKEN_DEFAULT = 306,
+TOKEN_DELETE = 307,
+TOKEN_DESC = 308,
+TOKEN_DISTINCT = 309,
+TOKEN_DOUBLE = 310,
+TOKEN_DROP = 311,
+TOKEN_ELSE = 312,
+TOKEN_END = 313,
+TOKEN_EXISTS = 314,
+TOKEN_EXTRACT = 315,
+TOKEN_FALSE = 316,
+TOKEN_FIRST = 317,
+TOKEN_FLOAT = 318,
+TOKEN_FOLLOWING = 319,
+TOKEN_FOR = 320,
+TOKEN_FOREIGN = 321,
+TOKEN_FROM = 322,
+TOKEN_FULL = 323,
+TOKEN_GROUP = 324,
+TOKEN_HASH = 325,
+TOKEN_HAVING = 326,
+TOKEN_HOUR = 327,
+TOKEN_IN = 328,
+TOKEN_INDEX = 329,
+TOKEN_INNER = 330,
+TOKEN_INSERT = 331,
+TOKEN_INTEGER = 332,
+TOKEN_INTERVAL = 333,
+TOKEN_INTO = 334,
+TOKEN_JOIN = 335,
+TOKEN_KEY = 336,
+TOKEN_LAST = 337,
+TOKEN_LEFT = 338,
+TOKEN_LIMIT = 339,
+TOKEN_LONG = 340,
+TOKEN_MINUTE = 341,
+TOKEN_MONTH = 342,
+TOKEN_NULL = 343,
+TOKEN_NULLS = 344,
+TOKEN_OFF = 345,
+TOKEN_ON = 346,
+TOKEN_OR

[04/11] incubator-quickstep git commit: Updates to fix the union all + reorder column problem.

2017-12-11 Thread jianqiao
Updates to fix the union all + reorder column problem.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/a08044e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/a08044e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/a08044e4

Branch: refs/heads/transitive-closure
Commit: a08044e42418a93091d7440a04cc944d4bfede8a
Parents: a57638e
Author: Jianqiao Zhu 
Authored: Fri Dec 1 02:15:05 2017 -0600
Committer: Jianqiao Zhu 
Committed: Fri Dec 1 02:16:10 2017 -0600

--
 cli/QuickstepCli.cpp | 20 +++-
 query_optimizer/resolver/Resolver.cpp|  2 +-
 query_optimizer/rules/ReorderColumns.cpp |  6 +-
 storage/StorageManager.cpp   | 11 +++
 4 files changed, 32 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a08044e4/cli/QuickstepCli.cpp
--
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
index e8ca56c..15d8ede 100644
--- a/cli/QuickstepCli.cpp
+++ b/cli/QuickstepCli.cpp
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -154,6 +155,8 @@ DEFINE_string(mode, "local",
 DECLARE_bool(profile_and_report_workorder_perf);
 DECLARE_bool(visualize_execution_dag);
 
+DEFINE_string(execution_dag_log, "", "The log file for writing execution dag 
to.");
+
 }  // namespace quickstep
 
 int main(int argc, char* argv[]) {
@@ -299,6 +302,13 @@ int main(int argc, char* argv[]) {
   std::unique_ptr parser_wrapper(new SqlParserWrapper());
   std::chrono::time_point start, end;
 
+  std::unique_ptr execution_dag_log_out;
+  const bool has_execution_dag_log = 
!quickstep::FLAGS_execution_dag_log.empty();
+  if (has_execution_dag_log) {
+execution_dag_log_out = std::make_unique(
+quickstep::FLAGS_execution_dag_log, std::ios::out | std::ios::app);
+  }
+
 #ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER
   bool started_profiling = false;
 #endif
@@ -353,6 +363,9 @@ int main(int argc, char* argv[]) {
 }
 // Here the statement is presumed to be a query.
 const std::size_t query_id = query_processor->query_id();
+if (has_execution_dag_log) {
+  *execution_dag_log_out << "#QUERY ID " << query_id << "#" << 
"\n";
+}
 const CatalogRelation *query_result_relation = nullptr;
 std::unique_ptr dag_visualizer;
 
@@ -418,7 +431,12 @@ int main(int argc, char* argv[]) {
 if (profiling_stats) {
   dag_visualizer->bindProfilingStats(*profiling_stats);
 }
-std::cerr << "\n" << dag_visualizer->toDOT() << "\n";
+if (has_execution_dag_log) {
+  CHECK(execution_dag_log_out != nullptr);
+  *execution_dag_log_out << "\n" << dag_visualizer->toDOT() << 
"\n";
+} else {
+  std::cerr << "\n" << dag_visualizer->toDOT() << "\n";
+}
   }
 } catch (const std::exception &e) {
   fprintf(io_handle->err(), "QUERY EXECUTION ERROR: %s\n", e.what());

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a08044e4/query_optimizer/resolver/Resolver.cpp
--
diff --git a/query_optimizer/resolver/Resolver.cpp 
b/query_optimizer/resolver/Resolver.cpp
index 0b6dc22..dc4bc2e 100644
--- a/query_optimizer/resolver/Resolver.cpp
+++ b/query_optimizer/resolver/Resolver.cpp
@@ -1586,7 +1586,7 @@ L::LogicalPtr Resolver::resolveSetOperations(
 possible_attributes.push_back(possible_attribute);
   }
 
-  for (std::size_t opid = 0; opid < operation_attributes.size(); ++opid) {
+  for (std::size_t opid = 0; opid < attribute_matrix.size(); ++opid) {
 // Generate a cast operation if needed.
 std::vector cast_expressions;
 for (std::size_t aid = 0; aid < operation_attributes.size(); ++aid) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a08044e4/query_optimizer/rules/ReorderColumns.cpp
--
diff --git a/query_optimizer/rules/ReorderColumns.cpp 
b/query_optimizer/rules/ReorderColumns.cpp
index 4783a8d..d12e8c7 100644
--- a/query_optimizer/rules/ReorderColumns.cpp
+++ b/query_optimizer/rules/ReorderColumns.cpp
@@ -61,7 +61,11 @@ P::PhysicalPtr ReorderColumns::applyInternal(const 
P::PhysicalPtr &input,
   if (skip_transform) {
 std::vector new_children;
 for (const P::PhysicalPtr &child : input->children()) {
-  new_children.emplace_back(applyInternal(child, lock_ordering && 
is_not_transformable));
+  bool child_lock_ordering = lock_ordering && is_not_transformable;
+  if (child->getPhysi

[03/11] incubator-quickstep git commit: Fix dag visualizer

2017-12-11 Thread jianqiao
Fix dag visualizer


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/a57638e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/a57638e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/a57638e4

Branch: refs/heads/transitive-closure
Commit: a57638e400d6174be9f644b89f8b9353582c5889
Parents: b45cdbc
Author: jianqiao 
Authored: Mon Nov 27 18:27:27 2017 -0600
Committer: jianqiao 
Committed: Mon Nov 27 18:27:27 2017 -0600

--
 utility/ExecutionDAGVisualizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a57638e4/utility/ExecutionDAGVisualizer.cpp
--
diff --git a/utility/ExecutionDAGVisualizer.cpp 
b/utility/ExecutionDAGVisualizer.cpp
index 8059ef3..bb8fe8f 100644
--- a/utility/ExecutionDAGVisualizer.cpp
+++ b/utility/ExecutionDAGVisualizer.cpp
@@ -293,7 +293,7 @@ void ExecutionDAGVisualizer::bindProfilingStats(
   "effective concurrency: " + FormatDigits(concurrency, 2));
 
   DCHECK(workorders_count.find(node_index) != workorders_count.end());
-  const std::size_t workorders_count_for_node = 
workorders_count.at(node_index);
+  const std::size_t workorders_count_for_node = 
workorders_count[node_index];
   if (workorders_count_for_node > 0) {
 mean_time_per_workorder[node_index] =
 mean_time_per_workorder[node_index] /



[10/11] incubator-quickstep git commit: Initialize updates for transitive closure

2017-12-11 Thread jianqiao
Initialize updates for transitive closure


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/734ddc1e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/734ddc1e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/734ddc1e

Branch: refs/heads/transitive-closure
Commit: 734ddc1ec10459e60e7f59edbf296f7988070e05
Parents: d725bca
Author: Jianqiao Zhu 
Authored: Sun Dec 10 21:00:16 2017 -0600
Committer: Jianqiao Zhu 
Committed: Sun Dec 10 21:00:16 2017 -0600

--
 parser/CMakeLists.txt   |8 +
 parser/ParseTableReference.hpp  |3 +-
 parser/ParseTransitiveClosureTableReference.cpp |   48 +
 parser/ParseTransitiveClosureTableReference.hpp |   83 +
 parser/SqlLexer.lpp |6 +-
 parser/SqlParser.ypp|8 +-
 parser/preprocessed/SqlLexer_gen.cpp| 1380 +
 parser/preprocessed/SqlLexer_gen.hpp|2 +-
 parser/preprocessed/SqlParser_gen.cpp   | 2909 +-
 parser/preprocessed/SqlParser_gen.hpp   |  201 +-
 query_execution/CMakeLists.txt  |1 +
 query_execution/QueryContext.cpp|6 +
 query_execution/QueryContext.hpp|   12 +
 query_execution/QueryContext.proto  |   13 +-
 query_optimizer/CMakeLists.txt  |4 +
 query_optimizer/ExecutionGenerator.cpp  |  144 +-
 query_optimizer/ExecutionGenerator.hpp  |3 +
 query_optimizer/PhysicalGenerator.cpp   |2 +-
 query_optimizer/cost_model/CMakeLists.txt   |2 +
 query_optimizer/cost_model/SimpleCostModel.cpp  |   10 +
 query_optimizer/cost_model/SimpleCostModel.hpp  |4 +
 .../cost_model/StarSchemaSimpleCostModel.cpp|   26 +
 .../cost_model/StarSchemaSimpleCostModel.hpp|4 +
 query_optimizer/logical/CMakeLists.txt  |9 +
 query_optimizer/logical/LogicalType.hpp |1 +
 query_optimizer/logical/PatternMatcher.hpp  |2 +
 query_optimizer/logical/TransitiveClosure.cpp   |   80 +
 query_optimizer/logical/TransitiveClosure.hpp   |  134 +
 query_optimizer/physical/CMakeLists.txt |9 +
 query_optimizer/physical/PatternMatcher.hpp |2 +
 query_optimizer/physical/PhysicalType.hpp   |1 +
 query_optimizer/physical/TransitiveClosure.cpp  |   81 +
 query_optimizer/physical/TransitiveClosure.hpp  |  141 +
 query_optimizer/resolver/CMakeLists.txt |2 +
 query_optimizer/resolver/Resolver.cpp   |   45 +
 query_optimizer/resolver/Resolver.hpp   |6 +-
 query_optimizer/strategy/CMakeLists.txt |5 +
 query_optimizer/strategy/OneToOne.cpp   |   41 +
 .../BuildTransitiveClosureOperator.cpp  |  136 +
 .../BuildTransitiveClosureOperator.hpp  |  180 ++
 relational_operators/CMakeLists.txt |   59 +
 .../InitializeTransitiveClosureOperator.cpp |   87 +
 .../InitializeTransitiveClosureOperator.hpp |  109 +
 relational_operators/RelationalOperator.hpp |3 +
 .../TransitiveClosureOperator.cpp   |0
 .../TransitiveClosureOperator.hpp   |   57 +
 storage/AggregationOperationState.hpp   |6 +-
 storage/CMakeLists.txt  |5 +
 storage/TransitiveClosureState.cpp  |0
 storage/TransitiveClosureState.hpp  |   82 +
 .../BarrieredReadWriteConcurrentBitVector.hpp   |2 +
 utility/BlockIDStream.hpp   |   83 +
 utility/CMakeLists.txt  |6 +
 utility/TransitiveClosureContext.cpp|0
 utility/TransitiveClosureContext.hpp|1 +
 55 files changed, 4003 insertions(+), 2251 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/734ddc1e/parser/CMakeLists.txt
--
diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt
index d4aaab4..7004e88 100644
--- a/parser/CMakeLists.txt
+++ b/parser/CMakeLists.txt
@@ -114,6 +114,9 @@ add_library(quickstep_parser_ParseString ParseString.cpp 
ParseString.hpp)
 add_library(quickstep_parser_ParseSubqueryExpression 
ParseSubqueryExpression.cpp ParseSubqueryExpression.hpp)
 add_library(quickstep_parser_ParseSubqueryTableReference 
ParseSubqueryTableReference.cpp ParseSubqueryTableReference.hpp)
 add_library(quickstep_parser_ParseTableReference ParseTableReference.cpp 
ParseTableReference.hpp)
+add_library(quickstep_parser_ParseTransitiveClosureTableReference
+ParseTransitiveClosureTableReference.cpp
+ParseTransitiveClosureTableReference.hpp)
 add_library(quickstep_parser_ParseTreeNode ../empty_src.cpp Pars

[05/11] incubator-quickstep git commit: Updates to cost model

2017-12-11 Thread jianqiao
Updates to cost model


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/d725bcaf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/d725bcaf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/d725bcaf

Branch: refs/heads/transitive-closure
Commit: d725bcafec86b7637ce08a24c309b2ea1981a618
Parents: a08044e
Author: Jianqiao Zhu 
Authored: Fri Dec 1 17:20:25 2017 -0600
Committer: Jianqiao Zhu 
Committed: Fri Dec 1 17:20:25 2017 -0600

--
 query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d725bcaf/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
--
diff --git a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp 
b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
index f7417b6..729a563 100644
--- a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
+++ b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
@@ -486,7 +486,7 @@ std::size_t StarSchemaSimpleCostModel::getNumDistinctValues(
   return stat.getNumDistinctValues(rel_attr_id);
 }
   }
-  return estimateCardinalityForTableReference(table_reference);
+  return estimateCardinalityForTableReference(table_reference) * 0.5;
 }
 
 bool StarSchemaSimpleCostModel::impliesUniqueAttributes(
@@ -520,7 +520,7 @@ bool StarSchemaSimpleCostModel::impliesUniqueAttributes(
   std::static_pointer_cast(physical_plan);
   const CatalogRelationStatistics &stat =
   table_reference->relation()->getStatistics();
-  if (stat.hasNumTuples()) {
+  if (stat.isExact() && stat.hasNumTuples()) {
 const std::size_t num_tuples = stat.getNumTuples();
 for (const auto &attr : attributes) {
   const attribute_id rel_attr_id =



[11/11] incubator-quickstep git commit: Updates to transitive closure

2017-12-11 Thread jianqiao
Updates to transitive closure


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/2aefd7bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/2aefd7bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/2aefd7bc

Branch: refs/heads/transitive-closure
Commit: 2aefd7bce5bad9bb6063b4fd71ec37876d58662d
Parents: 734ddc1
Author: Jianqiao Zhu 
Authored: Mon Dec 11 14:45:08 2017 -0600
Committer: Jianqiao Zhu 
Committed: Mon Dec 11 16:07:23 2017 -0600

--
 query_optimizer/ExecutionGenerator.cpp  |  19 ++-
 query_optimizer/PhysicalGenerator.cpp   |   2 +-
 .../BuildTransitiveClosureOperator.cpp  |   2 -
 relational_operators/CMakeLists.txt |   5 +
 .../InitializeTransitiveClosureOperator.cpp |   6 +-
 .../TransitiveClosureOperator.cpp   | 158 +++
 .../TransitiveClosureOperator.hpp   |  86 +-
 storage/TransitiveClosureState.hpp  |   8 +
 types/containers/ColumnVector.hpp   |   7 +
 .../BarrieredReadWriteConcurrentBitVector.hpp   |   7 +
 utility/BitVector.hpp   |  28 +++-
 11 files changed, 314 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/2aefd7bc/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 8f29271..648b937 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -2488,18 +2488,23 @@ void ExecutionGenerator::convertTransitiveClosure(
  &output_relation,
  insert_destination_proto);
 
+  const QueryPlan::DAGNodeIndex tc_operator_index =
+  execution_plan_->addRelationalOperator(
+  new TransitiveClosureOperator(query_handle_->query_id(),
+transitive_closure_state_index,
+*output_relation,
+insert_destination_index));
+  insert_destination_proto->set_relational_op_index(tc_operator_index);
 
-  (void)insert_destination_index;
+  execution_plan_->addDirectDependency(tc_operator_index,
+   build_tc_operator_index,
+   true /* is_pipeline_breaker */);
 
-  // TODO: fix
-  insert_destination_proto->set_relational_op_index(build_tc_operator_index /* 
FIX */);
   physical_to_output_relation_map_.emplace(
   std::piecewise_construct,
   std::forward_as_tuple(physical_plan),
-  std::forward_as_tuple(build_tc_operator_index /* FIX */, 
output_relation));
-
-  temporary_relation_info_vec_.emplace_back(build_tc_operator_index /* FIX */,
-output_relation);
+  std::forward_as_tuple(tc_operator_index, output_relation));
+  temporary_relation_info_vec_.emplace_back(tc_operator_index, 
output_relation);
 }
 
 }  // namespace optimizer

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/2aefd7bc/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index b7b0db0..865cd11 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -194,7 +194,7 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
  << physical_plan_->toString();
   }
 
-  std::cerr << "Optimized physical plan:\n" << physical_plan_->toString();
+  DVLOG(4) << "Optimized physical plan:\n" << physical_plan_->toString();
 
   if (FLAGS_visualize_plan) {
 quickstep::PlanVisualizer plan_visualizer;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/2aefd7bc/relational_operators/BuildTransitiveClosureOperator.cpp
--
diff --git a/relational_operators/BuildTransitiveClosureOperator.cpp 
b/relational_operators/BuildTransitiveClosureOperator.cpp
index e151756..919a974 100644
--- a/relational_operators/BuildTransitiveClosureOperator.cpp
+++ b/relational_operators/BuildTransitiveClosureOperator.cpp
@@ -107,7 +107,6 @@ void BuildTransitiveClosureWorkOrder::execute() {
 }
 
 void BuildTransitiveClosureWorkOrder::buildStartRelation(ValueAccessor 
*accessor) {
-  std::cout << "BuildStartRelation: " << block_ << "\n";
   InvokeOnAnyValueAccessor(
   accessor,
   [&](auto *accessor) -> void {
@@ -119,7 +118,6 @@ void 
BuildTransitiveClosureWorkOrder::buildStartRelation(ValueAccessor *accessor
 }
 
 void BuildT

[09/11] incubator-quickstep git commit: Initialize updates for transitive closure

2017-12-11 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/734ddc1e/parser/preprocessed/SqlLexer_gen.cpp
--
diff --git a/parser/preprocessed/SqlLexer_gen.cpp 
b/parser/preprocessed/SqlLexer_gen.cpp
index 4800cde..6847a14 100644
--- a/parser/preprocessed/SqlLexer_gen.cpp
+++ b/parser/preprocessed/SqlLexer_gen.cpp
@@ -592,8 +592,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , 
yyscan_t yyscanner );
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 164
-#define YY_END_OF_BUFFER 165
+#define YY_NUM_RULES 165
+#define YY_END_OF_BUFFER 166
 /* This struct is not used in this scanner,
but its presence is necessary. */
 struct yy_trans_info
@@ -601,72 +601,74 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_accept[589] =
+static const flex_int16_t yy_accept[593] =
 {   0,
 0,0,0,0,0,0,0,0,0,0,
-0,0,  165,2,2,  163,  163,  162,  161,  163,
-  140,  136,  139,  136,  136,  159,  132,  129,  133,  158,
-  158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  137,4,5,5,3,  155,
-  155,  152,  156,  156,  150,  157,  157,  154,1,  162,
-  130,  160,  159,  159,  159,0,  134,  131,  135,  158,
-  158,  158,  158,   10,  158,  158,  158,   22,  158,  158,
-  158,  158,  158,  158,  158,  158,  158,  158,  158,  138,
-
-  158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
-  158,  158,   58,   67,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  158,   81,   82,  158,  158,  158,
-  158,  158,  158,  158,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  113,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,4,5,3,  155,  151,  156,
-  149,  149,  141,  143,  144,  145,  146,  147,  148,  149,
-  157,  153,  160,  159,0,  159,6,7,  158,9,
-   11,  158,  158,   15,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  158,   33,  158,  158,  158,  158,
-
-  158,  158,  158,  158,   43,  158,  158,  158,  158,  158,
-  158,   50,  158,  158,  158,  158,  158,  158,  158,  158,
-  158,   62,  158,   69,  158,  158,  158,  158,  158,  158,
-  158,   77,  158,   80,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  158,  158,  158,   98,  158,  158,
-  103,  104,  158,  158,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  158,  158,  158,  158,  158,  141,
-  143,  142,  158,  158,  158,  158,  158,  158,  158,   20,
-   23,  158,  158,  158,   28,  158,  158,  158,   31,  158,
-  158,  158,   37,  158,  158,   41,   42,  158,  158,  158,
-
-  158,  158,  158,  158,   52,   53,  158,   55,  158,   57,
-  158,  158,  158,  158,   66,   68,   70,   71,   72,  158,
-   74,  158,  158,   78,  158,  158,   85,  158,  158,  158,
-  158,  158,   92,  158,   94,  158,  158,  158,  100,  158,
-  158,  158,  158,  158,  158,  158,  158,  110,  111,  114,
-  158,  158,  158,  158,  158,  158,  158,  158,  123,  158,
-  158,  126,  127,  141,  142,8,  158,  158,  158,  158,
-  158,  158,  158,   25,  158,  158,  158,  158,  158,  158,
-  158,  158,  158,  158,  158,  158,  158,  158,   46,   47,
-   48,  158,  158,   54,  158,   59,   60,  158,  158,  158,
-
-   73,  158,   76,   79,   83,   84,  158,  158,  158,  158,
-  158,   93,  158,  158,   97,  158,  158,  158,  158,  158,
-  158,  158,  109,  158,  158,  158,  117,  158,  158,  120,
-  158,  158,  124,  158,  158,  158,  158,   14,  158,  158,
-  158,  158,  158,   26,  158,   29,  158,  158,  158,  158,
-  158,   36,  158,  158,   40,   44,  158,  158,  158,   56,
-   61,  158,  158,  158,   75,  158,  158,  158,  158,  158,
-  158,   96,  158,  101,  102,  158,  106,  107,  158,  158,
-  158,  158,  118,  119,  121,  158,  125,  158,  158,   13,
-  158,  158,  158,  158,  158,  158,   21,   30,  158,   34,
-
-   35,  158,  158,   45,  158,   51,   63,  158,  158,  158,
-   88,  158,   90,  158,  158,  158,  158,  158,  158,  158,
-  158,  122,  158,  158,  158,  158,  158,  158,  158,  158,
-   32,  158,   39,  158,  158,   65,  158,  158,   91,  158,
-  158,  105,  158,  158,  158,  158,  158,   12,  158,  158,
-  158,  158,   24,  158,  158,   49,   64,   86,   89,  158,
-  158,  108,  112,  158,  116,  128,   16,  158,  158,  158,
-   27,   38,   87,   95,  158,  158,  158,   18,   19,  158,
-  115,  158,  158,  158,   99,  158,   17,0
+0,0,  166,2,2,  164,  164,  163,  162,  164,
+  141,  137,  140,  1

[06/11] incubator-quickstep git commit: Initialize updates for transitive closure

2017-12-11 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/734ddc1e/relational_operators/CMakeLists.txt
--
diff --git a/relational_operators/CMakeLists.txt 
b/relational_operators/CMakeLists.txt
index 7b9ed96..6cc7f08 100644
--- a/relational_operators/CMakeLists.txt
+++ b/relational_operators/CMakeLists.txt
@@ -38,6 +38,9 @@ 
add_library(quickstep_relationaloperators_BuildAggregationExistenceMapOperator
 BuildAggregationExistenceMapOperator.hpp)
 add_library(quickstep_relationaloperators_BuildHashOperator 
BuildHashOperator.cpp BuildHashOperator.hpp)
 add_library(quickstep_relationaloperators_BuildLIPFilterOperator 
BuildLIPFilterOperator.cpp BuildLIPFilterOperator.hpp)
+add_library(quickstep_relationaloperators_BuildTransitiveClosureOperator
+BuildTransitiveClosureOperator.cpp
+BuildTransitiveClosureOperator.hpp)
 add_library(quickstep_relationaloperators_CreateIndexOperator ../empty_src.cpp 
CreateIndexOperator.hpp)
 add_library(quickstep_relationaloperators_CreateTableOperator ../empty_src.cpp 
CreateTableOperator.hpp)
 add_library(quickstep_relationaloperators_DestroyAggregationStateOperator
@@ -53,6 +56,9 @@ add_library(quickstep_relationaloperators_HashJoinOperator 
HashJoinOperator.cpp
 add_library(quickstep_relationaloperators_InitializeAggregationOperator
 InitializeAggregationOperator.cpp
 InitializeAggregationOperator.hpp)
+add_library(quickstep_relationaloperators_InitializeTransitiveClosureOperator
+InitializeTransitiveClosureOperator.cpp
+InitializeTransitiveClosureOperator.hpp)
 add_library(quickstep_relationaloperators_InsertOperator InsertOperator.cpp 
InsertOperator.hpp)
 add_library(quickstep_relationaloperators_NestedLoopsJoinOperator
 NestedLoopsJoinOperator.cpp
@@ -73,6 +79,9 @@ 
add_library(quickstep_relationaloperators_SortRunGenerationOperator SortRunGener
 SortRunGenerationOperator.hpp)
 add_library(quickstep_relationaloperators_TableExportOperator 
TableExportOperator.cpp TableExportOperator.hpp)
 add_library(quickstep_relationaloperators_TableGeneratorOperator 
TableGeneratorOperator.cpp TableGeneratorOperator.hpp)
+add_library(quickstep_relationaloperators_TransitiveClosureOperator
+TransitiveClosureOperator.cpp
+TransitiveClosureOperator.hpp)
 add_library(quickstep_relationaloperators_TextScanOperator 
TextScanOperator.cpp TextScanOperator.hpp)
 add_library(quickstep_relationaloperators_UnionAllOperator 
UnionAllOperator.cpp UnionAllOperator.hpp)
 add_library(quickstep_relationaloperators_UpdateOperator UpdateOperator.cpp 
UpdateOperator.hpp)
@@ -171,6 +180,28 @@ 
target_link_libraries(quickstep_relationaloperators_BuildLIPFilterOperator
   quickstep_utility_lipfilter_LIPFilterBuilder
   quickstep_utility_lipfilter_LIPFilterUtil
   tmb)
+target_link_libraries(quickstep_relationaloperators_BuildTransitiveClosureOperator
+  glog
+  quickstep_catalog_CatalogRelation
+  quickstep_catalog_CatalogTypedefs
+  quickstep_cli_Flags
+  quickstep_queryexecution_QueryContext
+  quickstep_queryexecution_WorkOrderProtosContainer
+  quickstep_queryexecution_WorkOrdersContainer
+  quickstep_relationaloperators_RelationalOperator
+  quickstep_relationaloperators_WorkOrder
+  quickstep_relationaloperators_WorkOrder_proto
+  quickstep_storage_StorageBlock
+  quickstep_storage_StorageBlockInfo
+  quickstep_storage_StorageManager
+  quickstep_storage_TransitiveClosureState
+  quickstep_storage_TupleStorageSubBlock
+  quickstep_storage_ValueAccessor
+  quickstep_storage_ValueAccessorUtil
+  quickstep_utility_BlockIDStream
+  quickstep_utility_Macros
+  quickstep_utility_Range
+  tmb)
 target_link_libraries(quickstep_relationaloperators_CreateIndexOperator
   glog
   quickstep_catalog_CatalogRelation
@@ -304,6 +335,20 @@ 
target_link_libraries(quickstep_relationaloperators_InitializeAggregationOperato
   quickstep_storage_AggregationOperationState
   quickstep_utility_Macros
   tmb)
+target_link_libraries(quickstep_relationaloperators_InitializeTransitiveClosureOperator
+  glog
+  quickstep_cli_Flags
+  quickstep_queryexecution_QueryContext
+  quickstep_queryexecution_WorkOrderProtosContainer
+  quickstep_queryexecution_WorkOrdersCo