[04/11] incubator-quickstep git commit: Add common-subexpression support.

2017-05-01 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/364eb40d/expressions/scalar/ScalarLiteral.cpp
--
diff --git a/expressions/scalar/ScalarLiteral.cpp 
b/expressions/scalar/ScalarLiteral.cpp
index 48b5574..808953d 100644
--- a/expressions/scalar/ScalarLiteral.cpp
+++ b/expressions/scalar/ScalarLiteral.cpp
@@ -19,6 +19,7 @@
 
 #include "expressions/scalar/ScalarLiteral.hpp"
 
+#include 
 #include 
 #include 
 
@@ -47,24 +48,49 @@ Scalar* ScalarLiteral::clone() const {
   return new ScalarLiteral(internal_literal_, type_);
 }
 
-ColumnVector* ScalarLiteral::getAllValues(
+ColumnVectorPtr ScalarLiteral::getAllValues(
 ValueAccessor *accessor,
-const SubBlocksReference *sub_blocks_ref) const {
-  return ColumnVector::MakeVectorOfValue(
-  type_,
-  internal_literal_,
-  accessor->getNumTuplesVirtual());
+const SubBlocksReference *sub_blocks_ref,
+ColumnVectorCache *cv_cache) const {
+  return ColumnVectorPtr(
+  ColumnVector::MakeVectorOfValue(type_,
+  internal_literal_,
+  accessor->getNumTuplesVirtual()));
 }
 
-ColumnVector* ScalarLiteral::getAllValuesForJoin(
+ColumnVectorPtr ScalarLiteral::getAllValuesForJoin(
 const relation_id left_relation_id,
 ValueAccessor *left_accessor,
 const relation_id right_relation_id,
 ValueAccessor *right_accessor,
-const std::vector> _tuple_ids) const {
-  return ColumnVector::MakeVectorOfValue(type_,
- internal_literal_,
- joined_tuple_ids.size());
+const std::vector> _tuple_ids,
+ColumnVectorCache *cv_cache) const {
+  return ColumnVectorPtr(
+  ColumnVector::MakeVectorOfValue(type_,
+  internal_literal_,
+  joined_tuple_ids.size()));
+}
+
+void ScalarLiteral::getFieldStringItems(
+std::vector *inline_field_names,
+std::vector *inline_field_values,
+std::vector *non_container_child_field_names,
+std::vector *non_container_child_fields,
+std::vector *container_child_field_names,
+std::vector *container_child_fields) const 
{
+  Scalar::getFieldStringItems(inline_field_names,
+  inline_field_values,
+  non_container_child_field_names,
+  non_container_child_fields,
+  container_child_field_names,
+  container_child_fields);
+
+  inline_field_names->emplace_back("internal_literal");
+  if (internal_literal_.isNull()) {
+inline_field_values->emplace_back("NULL");
+  } else {
+
inline_field_values->emplace_back(type_.printValueToString(internal_literal_));
+  }
 }
 
 }  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/364eb40d/expressions/scalar/ScalarLiteral.hpp
--
diff --git a/expressions/scalar/ScalarLiteral.hpp 
b/expressions/scalar/ScalarLiteral.hpp
index c7f5ceb..2a4c396 100644
--- a/expressions/scalar/ScalarLiteral.hpp
+++ b/expressions/scalar/ScalarLiteral.hpp
@@ -20,6 +20,7 @@
 #ifndef QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_LITERAL_HPP_
 #define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_LITERAL_HPP_
 
+#include 
 #include 
 #include 
 
@@ -28,11 +29,12 @@
 #include "expressions/scalar/Scalar.hpp"
 #include "storage/StorageBlockInfo.hpp"
 #include "types/TypedValue.hpp"
+#include "types/containers/ColumnVector.hpp"
 #include "utility/Macros.hpp"
 
 namespace quickstep {
 
-class ColumnVector;
+class ColumnVectorCache;
 class Type;
 class ValueAccessor;
 
@@ -101,15 +103,26 @@ class ScalarLiteral : public Scalar {
 return internal_literal_;
   }
 
-  ColumnVector* getAllValues(ValueAccessor *accessor,
- const SubBlocksReference *sub_blocks_ref) const 
override;
+  ColumnVectorPtr getAllValues(ValueAccessor *accessor,
+   const SubBlocksReference *sub_blocks_ref,
+   ColumnVectorCache *cv_cache) const override;
 
-  ColumnVector* getAllValuesForJoin(
+  ColumnVectorPtr getAllValuesForJoin(
   const relation_id left_relation_id,
   ValueAccessor *left_accessor,
   const relation_id right_relation_id,
   ValueAccessor *right_accessor,
-  const std::vector> _tuple_ids) 
const override;
+  const std::vector> _tuple_ids,
+  ColumnVectorCache *cv_cache) const override;
+
+ protected:
+  void getFieldStringItems(
+  std::vector *inline_field_names,
+  std::vector *inline_field_values,
+  std::vector *non_container_child_field_names,
+  std::vector *non_container_child_fields,
+  

[08/11] incubator-quickstep git commit: Implement optimizer and execution layers for UNION and INTERSECT.

2017-05-01 Thread hakanmemisoglu
Implement optimizer and execution layers for UNION and INTERSECT.


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

Branch: refs/heads/frontend-backend
Commit: f1434eb9a4ecf43039445fbecf2d8d1d7802b20b
Parents: 46e4113
Author: Tianrun 
Authored: Mon Apr 10 10:21:11 2017 -0600
Committer: Hakan Memisoglu 
Committed: Tue May 2 00:12:54 2017 -0500

--
 query_optimizer/CMakeLists.txt  |   2 +
 query_optimizer/ExecutionGenerator.cpp  |  68 +
 query_optimizer/ExecutionGenerator.hpp  |   8 +
 query_optimizer/cost_model/CMakeLists.txt   |   2 +
 query_optimizer/cost_model/SimpleCostModel.cpp  |  13 +
 query_optimizer/cost_model/SimpleCostModel.hpp  |   6 +
 .../cost_model/StarSchemaSimpleCostModel.cpp|  12 +
 .../cost_model/StarSchemaSimpleCostModel.hpp|   6 +-
 query_optimizer/physical/CMakeLists.txt |  10 +
 query_optimizer/physical/PhysicalType.hpp   |   1 +
 query_optimizer/physical/UnionAll.hpp   | 188 +
 query_optimizer/resolver/Resolver.cpp   |   6 +-
 query_optimizer/strategy/CMakeLists.txt |   5 +
 query_optimizer/strategy/Join.cpp   |  42 +++
 query_optimizer/strategy/OneToOne.cpp   |  30 ++
 .../tests/execution_generator/Select.test   |  86 ++
 .../tests/physical_generator/Select.test| 280 +++
 query_optimizer/tests/resolver/CMakeLists.txt   |   4 +
 .../tests/resolver/SetOperation.test| 185 
 relational_operators/CMakeLists.txt |  16 ++
 relational_operators/RelationalOperator.hpp |   1 +
 relational_operators/UnionAllOperator.cpp   | 144 ++
 relational_operators/UnionAllOperator.hpp   | 228 +++
 23 files changed, 1339 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f1434eb9/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 79710fb..176b071 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -121,6 +121,7 @@ 
target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
   quickstep_queryoptimizer_physical_TableGenerator
   quickstep_queryoptimizer_physical_TableReference
   quickstep_queryoptimizer_physical_TopLevelPlan
+  quickstep_queryoptimizer_physical_UnionAll
   quickstep_queryoptimizer_physical_UpdateTable
   quickstep_queryoptimizer_physical_WindowAggregate
   quickstep_relationaloperators_AggregationOperator
@@ -146,6 +147,7 @@ 
target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
   quickstep_relationaloperators_SortRunGenerationOperator
   quickstep_relationaloperators_TableGeneratorOperator
   quickstep_relationaloperators_TextScanOperator
+  quickstep_relationaloperators_UnionAllOperator
   quickstep_relationaloperators_UpdateOperator
   quickstep_relationaloperators_WindowAggregationOperator
   quickstep_storage_AggregationOperationState_proto

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f1434eb9/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 2878918..36015a9 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -94,6 +94,7 @@
 #include "query_optimizer/physical/TableGenerator.hpp"
 #include "query_optimizer/physical/TableReference.hpp"
 #include "query_optimizer/physical/TopLevelPlan.hpp"
+#include "query_optimizer/physical/UnionAll.hpp"
 #include "query_optimizer/physical/UpdateTable.hpp"
 #include "query_optimizer/physical/WindowAggregate.hpp"
 #include "relational_operators/AggregationOperator.hpp"
@@ -119,6 +120,7 @@
 #include "relational_operators/SortRunGenerationOperator.hpp"
 #include "relational_operators/TableGeneratorOperator.hpp"
 #include "relational_operators/TextScanOperator.hpp"
+#include "relational_operators/UnionAllOperator.hpp"
 #include "relational_operators/UpdateOperator.hpp"
 #include "relational_operators/WindowAggregationOperator.hpp"
 

[11/11] incubator-quickstep git commit: WorkOrder proto clean-up.

2017-05-01 Thread hakanmemisoglu
WorkOrder proto clean-up.


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

Branch: refs/heads/frontend-backend
Commit: a4bfab901acbdc38f3d510380857a08dee140ade
Parents: 50401ce
Author: Zuyu Zhang 
Authored: Thu Apr 20 15:21:22 2017 -0700
Committer: Hakan Memisoglu 
Committed: Tue May 2 00:12:54 2017 -0500

--
 relational_operators/WorkOrder.proto | 69 ---
 1 file changed, 35 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a4bfab90/relational_operators/WorkOrder.proto
--
diff --git a/relational_operators/WorkOrder.proto 
b/relational_operators/WorkOrder.proto
index 12a65ca..7231c84 100644
--- a/relational_operators/WorkOrder.proto
+++ b/relational_operators/WorkOrder.proto
@@ -21,13 +21,16 @@ package quickstep.serialization;
 
 import "relational_operators/SortMergeRunOperator.proto";
 
+// Next tag: 25.
 enum WorkOrderType {
   AGGREGATION = 1;
+  BUILD_AGGREGATION_EXISTENCE_MAP = 23;
   BUILD_HASH = 2;
   BUILD_LIP_FILTER = 3;
   CREATE_INDEX = 4;  // Placeholder.
   CREATE_TABLE = 5;  // Placeholder.
   DELETE = 6;
+  DESTROY_AGGREGATION_STATE = 22;
   DESTROY_HASH = 7;
   DROP_TABLE = 8;
   FINALIZE_AGGREGATION = 9;
@@ -41,11 +44,9 @@ enum WorkOrderType {
   SORT_RUN_GENERATION = 17;
   TABLE_GENERATOR = 18;
   TEXT_SCAN = 19;
+  UNION_ALL = 24;
   UPDATE = 20;
   WINDOW_AGGREGATION = 21;
-  DESTROY_AGGREGATION_STATE = 22;
-  BUILD_AGGREGATION_EXISTENCE_MAP = 23;
-  UNION_ALL = 24;
 }
 
 message WorkOrder {
@@ -53,7 +54,7 @@ message WorkOrder {
   required uint64 query_id = 2;
 
   // The convention for extension numbering is that extensions for a particular
-  // WorkOrderID should begin from (operator_type + 1) * 16.
+  // WorkOrderID should begin from (operator_type * 16).
   extensions 16 to max;
 }
 
@@ -66,6 +67,15 @@ message AggregationWorkOrder {
   }
 }
 
+message BuildAggregationExistenceMapWorkOrder {
+  extend WorkOrder {
+optional int32 relation_id = 368;
+optional fixed64 build_block_id = 369;
+optional int32 build_attribute = 370;
+optional uint32 aggr_state_index = 371;
+  }
+}
+
 // Next tag: 39.
 message BuildHashWorkOrder {
   extend WorkOrder {
@@ -100,6 +110,12 @@ message DeleteWorkOrder {
   }
 }
 
+message DestroyAggregationStateWorkOrder {
+  extend WorkOrder {
+optional uint32 aggr_state_index = 352;
+  }
+}
+
 message DestroyHashWorkOrder {
   extend WorkOrder {
 // All required.
@@ -248,12 +264,21 @@ message TableGeneratorWorkOrder {
 message TextScanWorkOrder {
   extend WorkOrder {
 // All required.
-optional string filename = 301;
-optional uint64 text_offset = 302;
-optional uint64 text_segment_size = 303;
-optional uint32 field_terminator = 304;  // For one-byte char.
-optional bool process_escape_sequences = 305;
-optional int32 insert_destination_index = 306;
+optional string filename = 304;
+optional uint64 text_offset = 305;
+optional uint64 text_segment_size = 306;
+optional uint32 field_terminator = 307;  // For one-byte char.
+optional bool process_escape_sequences = 308;
+optional int32 insert_destination_index = 309;
+  }
+}
+
+message UnionAllWorkOrder {
+  extend WorkOrder {
+optional int32 relation_id = 384;
+optional int32 insert_destination_index = 385;
+optional fixed64 block_id = 386;
+repeated int32 select_attribute_id = 387;
   }
 }
 
@@ -277,27 +302,3 @@ message WindowAggregationWorkOrder {
 optional int32 insert_destination_index = 338;
   }
 }
-
-message DestroyAggregationStateWorkOrder {
-  extend WorkOrder {
-optional uint32 aggr_state_index = 352;
-  }
-}
-
-message BuildAggregationExistenceMapWorkOrder {
-  extend WorkOrder {
-optional int32 relation_id = 368;
-optional fixed64 build_block_id = 369;
-optional int32 build_attribute = 370;
-optional uint32 aggr_state_index = 371;
-  }
-}
-
-message UnionAllWorkOrder {
-  extend WorkOrder {
-optional int32 relation_id = 384;
-optional int32 insert_destination_index = 385;
-optional fixed64 block_id = 386;
-repeated int32 select_attribute_id = 387;
-  }
-}



[06/11] incubator-quickstep git commit: Topological sort functionality in DAG

2017-05-01 Thread hakanmemisoglu
Topological sort functionality in DAG

- Implemented a very simple Kahn's algorithm for topological sorting of nodes
  in the DAG class.


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

Branch: refs/heads/frontend-backend
Commit: 7047d3dfa0eb421468320ac56ed1f2d1a31a40b8
Parents: f1434eb
Author: Harshad Deshmukh 
Authored: Tue Apr 18 15:34:16 2017 -0500
Committer: Hakan Memisoglu 
Committed: Tue May 2 00:12:54 2017 -0500

--
 utility/DAG.hpp| 51 +++
 utility/tests/DAG_unittest.cpp | 82 +
 2 files changed, 133 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7047d3df/utility/DAG.hpp
--
diff --git a/utility/DAG.hpp b/utility/DAG.hpp
index fcfe1ce..8deb795 100644
--- a/utility/DAG.hpp
+++ b/utility/DAG.hpp
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -246,6 +247,11 @@ class DAG {
 return nodes_[node_index].getDependents().end();
   }
 
+  /**
+   * @brief Get a topologically sorted list of node IDs.
+   **/
+  std::vector getTopologicalSorting() const;
+
  private:
   /**
* @brief A node in the DAG which contains a payload. DAGNode owns its
@@ -489,6 +495,51 @@ bool DAG::hasCycleHelper(const typename 
DAG:
   return false;
 }
 
+template 
+std::vector::size_type_nodes>
+DAG::getTopologicalSorting() const {
+  // As a clarification, if A->B then A is the dependency for B and B is 
dependent on A.
+  // We implement "Kahn's algorithm" for the sorting.
+  DCHECK(!hasCycle());
+  // This list is going to be the topologically sorted output.
+  std::unique_ptr>
+  sorted_list(new std::vector());
+  sorted_list->reserve(this->size());
+  // Key = node ID, value = # incoming edges for this node.
+  // NOTE(harshad) - We modify the "values" in this map as we go along.
+  std::unordered_map::size_type_nodes,
+ std::size_t> num_dependencies;
+  std::queue::size_type_nodes> 
nodes_with_no_dependencies;
+  // First store the nodes without any dependencies in a list.
+  // Also remember the number of dependencies for each node in a map.
+  for (auto node_id = 0u; node_id < this->size(); ++node_id) {
+if (nodes_[node_id].getDependencies().empty()) {
+  nodes_with_no_dependencies.emplace(node_id);
+}
+num_dependencies[node_id] = nodes_[node_id].getDependencies().size();
+  }
+  // The algorithm begins now.
+  while (!nodes_with_no_dependencies.empty()) {
+// For a node with no dependencies ...
+auto curr_node = nodes_with_no_dependencies.front();
+nodes_with_no_dependencies.pop();
+// Add the node to the sorted list.
+sorted_list->emplace_back(curr_node);
+auto dependents_of_curr_node = getDependents(curr_node);
+for (auto dependent_iterator : dependents_of_curr_node) {
+  // For each dependent of the current node ...
+  auto dependent_node_id = dependent_iterator.first;
+  // Remove the incoming edge from curr_node.
+  DCHECK_GE(num_dependencies[dependent_node_id], 1u);
+  if (--num_dependencies[dependent_node_id] == 0) {
+// Now this node has no children.
+nodes_with_no_dependencies.emplace(dependent_node_id);
+  }
+}
+  }
+  return *(sorted_list.release());
+}
+
 /** @} */
 
 }  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7047d3df/utility/tests/DAG_unittest.cpp
--
diff --git a/utility/tests/DAG_unittest.cpp b/utility/tests/DAG_unittest.cpp
index 3fe2990..3e8d167 100644
--- a/utility/tests/DAG_unittest.cpp
+++ b/utility/tests/DAG_unittest.cpp
@@ -490,6 +490,88 @@ TEST(DAGTest, LinkMetadataBoolTest) {
   EXPECT_FALSE(dag_.getLinkMetadata(1, 0));
 }
 
+TEST(DAGTest, TopoSortTest) {
+  const int kNodeSize = 5;
+  DAG dag_;
+
+  for (int node_index = 0; node_index < kNodeSize; ++node_index) {
+ASSERT_EQ(static_cast(node_index),
+  dag_.createNode(new DummyPayload(node_index)));
+  }
+
+  /*
+   *0
+   *   / \
+   *  v   v
+   *  1   2
+   *   \ /
+   *v
+   *3
+   *|
+   *v
+   *4
+   *
+   */
+
+  dag_.createLink(0, 1, 2);
+  dag_.createLink(0, 2, 1);
+  dag_.createLink(1, 3, 1);
+  dag_.createLink(2, 3, 1);
+  dag_.createLink(3, 4, 1);
+
+  vector::size_type_nodes> 

[03/11] incubator-quickstep git commit: Add common-subexpression support.

2017-05-01 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/364eb40d/query_optimizer/rules/CollapseSelection.hpp
--
diff --git a/query_optimizer/rules/CollapseSelection.hpp 
b/query_optimizer/rules/CollapseSelection.hpp
new file mode 100644
index 000..bc5e4a3
--- /dev/null
+++ b/query_optimizer/rules/CollapseSelection.hpp
@@ -0,0 +1,62 @@
+/**
+ * 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_QUERY_OPTIMIZER_RULES_COLLAPSE_SELECTION_HPP_
+#define QUICKSTEP_QUERY_OPTIMIZER_RULES_COLLAPSE_SELECTION_HPP_
+
+#include 
+
+#include "query_optimizer/physical/Physical.hpp"
+#include "query_optimizer/rules/BottomUpRule.hpp"
+#include "utility/Macros.hpp"
+
+namespace quickstep {
+namespace optimizer {
+
+/** \addtogroup OptimizerRules
+ *  @{
+ */
+
+/**
+ * @brief Merges nested Selections into one single Selection.
+ */
+class CollapseSelection : public BottomUpRule {
+ public:
+  /**
+   * @brief Constructor.
+   */
+  CollapseSelection() {}
+
+  std::string getName() const override {
+return "CollapseSelection";
+  }
+
+ protected:
+  physical::PhysicalPtr applyToNode(const physical::PhysicalPtr ) 
override;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(CollapseSelection);
+};
+
+/** @} */
+
+}  // namespace optimizer
+}  // namespace quickstep
+
+#endif  // QUICKSTEP_QUERY_OPTIMIZER_RULES_COLLAPSE_SELECTION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/364eb40d/query_optimizer/rules/ExtractCommonSubexpression.cpp
--
diff --git a/query_optimizer/rules/ExtractCommonSubexpression.cpp 
b/query_optimizer/rules/ExtractCommonSubexpression.cpp
new file mode 100644
index 000..e3f996c
--- /dev/null
+++ b/query_optimizer/rules/ExtractCommonSubexpression.cpp
@@ -0,0 +1,376 @@
+/**
+ * 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 "query_optimizer/rules/ExtractCommonSubexpression.hpp"
+
+#include 
+#include 
+#include 
+#include 
+
+#include "query_optimizer/OptimizerContext.hpp"
+#include "query_optimizer/expressions/AggregateFunction.hpp"
+#include "query_optimizer/expressions/Alias.hpp"
+#include "query_optimizer/expressions/CommonSubexpression.hpp"
+#include "query_optimizer/expressions/ExpressionType.hpp"
+#include "query_optimizer/expressions/NamedExpression.hpp"
+#include "query_optimizer/expressions/PatternMatcher.hpp"
+#include "query_optimizer/expressions/Scalar.hpp"
+#include "query_optimizer/physical/Aggregate.hpp"
+#include "query_optimizer/physical/HashJoin.hpp"
+#include "query_optimizer/physical/NestedLoopsJoin.hpp"
+#include "query_optimizer/physical/Physical.hpp"
+#include "query_optimizer/physical/PhysicalType.hpp"
+#include "query_optimizer/physical/Selection.hpp"
+#include "utility/HashError.hpp"
+
+#include "glog/logging.h"
+
+namespace quickstep {
+namespace optimizer {
+
+namespace E = ::quickstep::optimizer::expressions;
+namespace P = ::quickstep::optimizer::physical;
+
+ExtractCommonSubexpression::ExtractCommonSubexpression(
+OptimizerContext *optimizer_context)
+: optimizer_context_(optimizer_context) {
+  const std::vector homogeneous_expr_types = {
+  E::ExpressionType::kAlias,
+  E::ExpressionType::kAttributeReference,
+  E::ExpressionType::kBinaryExpression,
+  E::ExpressionType::kCast,
+  E::ExpressionType::kCommonSubexpression,
+  

[02/11] incubator-quickstep git commit: Add common-subexpression support.

2017-05-01 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/364eb40d/query_optimizer/tests/physical_generator/Select.test
--
diff --git a/query_optimizer/tests/physical_generator/Select.test 
b/query_optimizer/tests/physical_generator/Select.test
index f7de922..614347b 100644
--- a/query_optimizer/tests/physical_generator/Select.test
+++ b/query_optimizer/tests/physical_generator/Select.test
@@ -1022,34 +1022,51 @@ TopLevelPlan
 [Physical Plan]
 TopLevelPlan
 +-plan=Selection
-| +-input=Aggregate
-| | +-input=TableReference[relation=Test,alias=test]
-| | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
-| | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
-| | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
-| | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double NULL]
-| | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
-| | | +-AttributeReference[id=5,name=vchar_col,relation=test,
-| | |   type=VarChar(20) NULL]
-| | +-grouping_expressions=
-| | | +-[]
-| | +-aggregate_expressions=
-| |   +-Alias[id=6,name=,alias=$aggregate0,relation=$aggregate,type=Long]
-| |   | +-AggregateFunction[function=COUNT]
-| |   |   +-[]
-| |   +-Alias[id=7,name=,alias=$aggregate1,relation=$aggregate,type=Long]
-| |   | +-AggregateFunction[function=COUNT]
-| |   |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
-| |   +-Alias[id=8,name=,alias=$aggregate2,relation=$aggregate,type=Long NULL]
-| |   | +-AggregateFunction[function=SUM]
-| |   |   +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
-| |   +-Alias[id=9,name=,alias=$aggregate3,relation=$aggregate,type=Double 
NULL]
-| |   | +-AggregateFunction[function=AVG]
-| |   |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
-| |   +-Alias[id=11,name=,alias=$aggregate4,relation=$aggregate,type=Double 
NULL]
-| | +-AggregateFunction[function=MAX]
-| |   +-AttributeReference[id=3,name=double_col,relation=test,
-| | type=Double NULL]
+| +-input=Selection
+| | +-input=Aggregate
+| | | +-input=TableReference[relation=Test,alias=test]
+| | | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | | | +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | | | +-AttributeReference[id=2,name=float_col,relation=test,type=Float]
+| | | | +-AttributeReference[id=3,name=double_col,relation=test,type=Double 
NULL]
+| | | | +-AttributeReference[id=4,name=char_col,relation=test,type=Char(20)]
+| | | | +-AttributeReference[id=5,name=vchar_col,relation=test,
+| | | |   type=VarChar(20) NULL]
+| | | +-grouping_expressions=
+| | | | +-[]
+| | | +-aggregate_expressions=
+| | |   +-Alias[id=6,name=,alias=$aggregate0,relation=$aggregate,type=Long]
+| | |   | +-AggregateFunction[function=COUNT]
+| | |   |   +-[]
+| | |   +-Alias[id=7,name=,alias=$aggregate1,relation=$aggregate,type=Long]
+| | |   | +-AggregateFunction[function=COUNT]
+| | |   |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | |   +-Alias[id=8,name=,alias=$aggregate2,relation=$aggregate,type=Long 
NULL]
+| | |   | +-AggregateFunction[function=SUM]
+| | |   |   +-AttributeReference[id=1,name=long_col,relation=test,type=Long]
+| | |   +-Alias[id=12,name=,alias=$aggregate3,relation=$aggregate,type=Long 
NULL]
+| | |   | +-AggregateFunction[function=SUM]
+| | |   |   +-AttributeReference[id=0,name=int_col,relation=test,type=Int NULL]
+| | |   +-Alias[id=11,name=,alias=$aggregate4,relation=$aggregate,
+| | | type=Double NULL]
+| | | +-AggregateFunction[function=MAX]
+| | |   +-AttributeReference[id=3,name=double_col,relation=test,
+| | | type=Double NULL]
+| | +-project_expressions=
+| |   +-AttributeReference[id=6,name=,alias=$aggregate0,relation=$aggregate,
+| |   | type=Long]
+| |   +-AttributeReference[id=7,name=,alias=$aggregate1,relation=$aggregate,
+| |   | type=Long]
+| |   +-AttributeReference[id=8,name=,alias=$aggregate2,relation=$aggregate,
+| |   | type=Long NULL]
+| |   +-Alias[id=9,name=,alias=$aggregate3,relation=$aggregate,type=Long NULL]
+| |   | +-Divide
+| |   |   +-AttributeReference[id=12,name=,alias=$aggregate3,
+| |   |   | relation=$aggregate,type=Long NULL]
+| |   |   
+-AttributeReference[id=7,name=,alias=$aggregate1,relation=$aggregate,
+| |   | type=Long]
+| |   +-AttributeReference[id=11,name=,alias=$aggregate4,relation=$aggregate,
+| | type=Double NULL]
 | +-filter_predicate=Greater
 | | +-Add
 | | | +-AttributeReference[id=11,name=,alias=$aggregate4,relation=$aggregate,
@@ -1311,31 +1328,40 @@ TopLevelPlan
 | |   +-Alias[id=8,name=,alias=$aggregate0,relation=$aggregate,type=Long]
 | |   | +-AggregateFunction[function=COUNT]
 | |   |   +-Add
-| |   | +-Add
-| |   | | +-AttributeReference[id=0,name=int_col,relation=test,type=Int 
NULL]
-| |   | | 

[05/11] incubator-quickstep git commit: Add common-subexpression support.

2017-05-01 Thread hakanmemisoglu
Add common-subexpression support.


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

Branch: refs/heads/frontend-backend
Commit: 364eb40dd66cea27b81f10856bb90f67a26e39c3
Parents: a4bfab9
Author: Jianqiao Zhu 
Authored: Thu Apr 20 15:28:12 2017 -0500
Committer: Hakan Memisoglu 
Committed: Tue May 2 00:12:54 2017 -0500

--
 expressions/CMakeLists.txt  |   6 +
 expressions/Expression.hpp  |  53 ++
 expressions/ExpressionFactories.cpp |  10 +
 expressions/Expressions.proto   |   8 +
 expressions/predicate/CMakeLists.txt|   4 +-
 expressions/predicate/ComparisonPredicate.cpp   |  87 ++-
 expressions/predicate/ComparisonPredicate.hpp   |  12 +
 expressions/predicate/NegationPredicate.cpp |  21 +
 expressions/predicate/NegationPredicate.hpp |  12 +
 expressions/predicate/Predicate.cpp |  16 +
 expressions/predicate/Predicate.hpp |  20 +-
 expressions/predicate/PredicateWithList.cpp |  54 ++
 expressions/predicate/PredicateWithList.hpp |  11 +
 expressions/scalar/CMakeLists.txt   |  18 +
 expressions/scalar/Scalar.cpp   |  15 +
 expressions/scalar/Scalar.hpp   |  40 +-
 expressions/scalar/ScalarAttribute.cpp  |  42 +-
 expressions/scalar/ScalarAttribute.hpp  |  22 +-
 expressions/scalar/ScalarBinaryExpression.cpp   | 257 +++---
 expressions/scalar/ScalarBinaryExpression.hpp   |  23 +-
 expressions/scalar/ScalarCaseExpression.cpp | 124 ++-
 expressions/scalar/ScalarCaseExpression.hpp |  33 +-
 expressions/scalar/ScalarLiteral.cpp|  48 +-
 expressions/scalar/ScalarLiteral.hpp|  23 +-
 expressions/scalar/ScalarSharedExpression.cpp   | 141 
 expressions/scalar/ScalarSharedExpression.hpp   | 127 +++
 expressions/scalar/ScalarUnaryExpression.cpp|  84 +-
 expressions/scalar/ScalarUnaryExpression.hpp|  22 +-
 .../tests/ScalarCaseExpression_unittest.cpp |  33 +-
 query_optimizer/CMakeLists.txt  |   3 +
 query_optimizer/PhysicalGenerator.cpp   |  35 +-
 .../expressions/AttributeReference.cpp  |  19 +
 .../expressions/AttributeReference.hpp  |   6 +
 .../expressions/BinaryExpression.cpp|  37 +
 .../expressions/BinaryExpression.hpp|   4 +
 query_optimizer/expressions/CMakeLists.txt  |  32 +-
 query_optimizer/expressions/Cast.cpp|  17 +
 query_optimizer/expressions/Cast.hpp|   4 +
 .../expressions/CommonSubexpression.cpp |  72 ++
 .../expressions/CommonSubexpression.hpp | 141 
 query_optimizer/expressions/ExpressionType.hpp  |   3 +-
 query_optimizer/expressions/ExpressionUtil.hpp  |   6 +-
 query_optimizer/expressions/NamedExpression.hpp |  13 -
 query_optimizer/expressions/PatternMatcher.hpp  |   9 +-
 query_optimizer/expressions/Scalar.hpp  |  41 +
 query_optimizer/expressions/ScalarLiteral.cpp   |  23 +
 query_optimizer/expressions/ScalarLiteral.hpp   |   5 +
 query_optimizer/expressions/SimpleCase.cpp  |  46 ++
 query_optimizer/expressions/SimpleCase.hpp  |   5 +
 query_optimizer/expressions/UnaryExpression.cpp |  17 +
 query_optimizer/expressions/UnaryExpression.hpp |   5 +
 query_optimizer/rules/CMakeLists.txt|  66 ++
 query_optimizer/rules/CollapseSelection.cpp |  59 ++
 query_optimizer/rules/CollapseSelection.hpp |  62 ++
 .../rules/ExtractCommonSubexpression.cpp| 376 +
 .../rules/ExtractCommonSubexpression.hpp| 179 +
 .../rules/ReuseAggregateExpressions.cpp | 349 +
 .../rules/ReuseAggregateExpressions.hpp | 154 
 .../tests/execution_generator/CMakeLists.txt|  12 +
 .../CommonSubexpression.test|  52 ++
 .../tests/physical_generator/CMakeLists.txt |   4 +
 .../physical_generator/CommonSubexpression.test | 772 +++
 .../tests/physical_generator/Select.test| 112 +--
 relational_operators/CMakeLists.txt |   2 +
 relational_operators/HashJoinOperator.cpp   |  51 +-
 .../NestedLoopsJoinOperator.cpp |   6 +-
 storage/AggregationOperationState.cpp   |   4 +-
 storage/CMakeLists.txt  |   3 +
 storage/StorageBlock.cpp|  10 +-
 storage/WindowAggregationOperationState.cpp |   8 +-
 types/containers/CMakeLists.txt |   3 +-
 types/containers/ColumnVector.hpp   |  14 +-
 types/containers/ColumnVectorsValueAccessor.hpp |  23 +-
 

[01/11] incubator-quickstep git commit: Deserialization logic is implemented for relational operators.

2017-05-01 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/frontend-backend 46e411354 -> 79f0e7809


Deserialization logic is implemented for relational operators.


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

Branch: refs/heads/frontend-backend
Commit: 79f0e7809c38b67b0b22f504d297b2806344e320
Parents: 1d94edf
Author: Hakan Memisoglu 
Authored: Tue May 2 00:12:01 2017 -0500
Committer: Hakan Memisoglu 
Committed: Tue May 2 00:12:54 2017 -0500

--
 query_execution/ExecutionDeserializer.cpp | 427 -
 query_execution/ExecutionDeserializer.hpp |   9 +-
 query_optimizer/ExecutionSerializer.cpp   |   5 +-
 relational_operators/DeleteOperator.hpp   |   4 +
 relational_operators/Operator.proto   |   7 +-
 utility/DAG.hpp   |   2 +-
 6 files changed, 430 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/79f0e780/query_execution/ExecutionDeserializer.cpp
--
diff --git a/query_execution/ExecutionDeserializer.cpp 
b/query_execution/ExecutionDeserializer.cpp
index d1e96fa..d4af317 100644
--- a/query_execution/ExecutionDeserializer.cpp
+++ b/query_execution/ExecutionDeserializer.cpp
@@ -17,6 +17,8 @@
  * under the License.
  **/
 
+#include 
+
 #include "query_execution/ExecutionDeserializer.hpp"
 
 namespace quickstep {
@@ -85,103 +87,496 @@ void ExecutionDeserializer::deserializeInternal(const 
S::Vertex ) {
 void ExecutionDeserializer::deserializeAggregation(const 
S::AggregationOperator _operator) {
   const std::size_t query_id = 1;
   const relation_id relation = aggregation_operator.relation_id();
+  const CatalogRelation *catalog = database_.getRelationById(relation);
   const bool is_relation_stored = aggregation_operator.relation_is_stored();
   QueryContext::aggregation_state_id aggregation_state_index = 
aggregation_operator.aggr_state_index();
 
-  std::unique_ptr aggregation = std::make_unique(new 
AggregationOperator())
-  query_plan.addRelationalOperator();
+
+  const AggregationOperator* aggregation
+  = new AggregationOperator(query_id,
+*catalog,
+is_relation_stored,
+aggregation_state_index);
+  query_plan.addRelationalOperator(aggregation);
 }
 
 void ExecutionDeserializer::deserializeBuildAggregationExistenceMap(const 
S::BuildAggregationExistenceMapOperator ) {
-
+  const std::size_t query_id = 1;
+  const relation_id relation = op.relation_id();
+  const CatalogRelation *catalog = database_.getRelationById(relation);
+  const attribute_id build_attribute = op.attribute_id();
+  const bool is_relation_stored = op.relation_is_stored();
+  const QueryContext::aggregation_state_id aggregation_state_index = 
op.aggr_state_index();
+
+  const BuildAggregationExistenceMapOperator* build_aggregation_existence_map
+  = new BuildAggregationExistenceMapOperator(query_id,
+ *catalog,
+ build_attribute,
+ is_relation_stored,
+ aggregation_state_index);
+  query_plan.addRelationalOperator(build_aggregation_existence_map);
 }
 
 void ExecutionDeserializer::deserializeBuildHash(const S::BuildHashOperator 
_hash_operator) {
-
+  const std::size_t query_id = 1;
+  const relation_id relation = build_hash_operator.relation_id();
+  const CatalogRelation *catalog = database_.getRelationById(relation);
+  const is_input_relation_stored = build_hash_operator.relation_is_stored();
+  std::vector join_key_attributes;
+  join_key_attributes.reserve(build_hash_operator.join_key_attributes_size());
+  for (std::size_t i = 0; i < build_hash_operator.join_key_attributes_size(); 
++i) {
+join_key_attributes.push_back(build_hash_operator.join_key_attributes(i));
+  }
+  const bool any_join_key_attributes_nullable = 
build_hash_operator.any_join_key_nullable();
+  const std::size_t num_partitions = build_hash_operator.num_partitions();
+  const QueryContext::join_hash_table_id join_hash_table_index = 
build_hash_operator.hash_table_index();
+
+  const BuildHashOperator* build_hash
+  = new BuildHashOperator(query_id,
+  *catalog,
+  is_input_relation_stored,
+  join_key_attributes,
+  

[07/11] incubator-quickstep git commit: API to get total pending work orders for an operator

2017-05-01 Thread hakanmemisoglu
API to get total pending work orders for an operator

- Total includes normal and rebuild work orders.


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

Branch: refs/heads/frontend-backend
Commit: 6d9eaa35b8a6254811a80b08773a2a7cbcd03577
Parents: 7047d3d
Author: Harshad Deshmukh 
Authored: Wed Apr 19 13:31:08 2017 -0500
Committer: Hakan Memisoglu 
Committed: Tue May 2 00:12:54 2017 -0500

--
 query_execution/WorkOrdersContainer.hpp | 13 +
 1 file changed, 13 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6d9eaa35/query_execution/WorkOrdersContainer.hpp
--
diff --git a/query_execution/WorkOrdersContainer.hpp 
b/query_execution/WorkOrdersContainer.hpp
index c1739bc..1fb3ca6 100644
--- a/query_execution/WorkOrdersContainer.hpp
+++ b/query_execution/WorkOrdersContainer.hpp
@@ -311,6 +311,19 @@ class WorkOrdersContainer {
 return rebuild_workorders_[operator_index].getNumWorkOrders();
   }
 
+  /**
+   * @brief Get the total number of work orders for the given operator.
+   *
+   * @param operator_index The index of the operator.
+   *
+   * @return The total number of WorkOrders (normal + rebuild).
+   **/
+  inline std::size_t getNumTotalWorkOrders(
+  const std::size_t operator_index) const {
+return getNumNormalWorkOrders(operator_index) +
+   getNumRebuildWorkOrders(operator_index);
+  }
+
  private:
   /**
* @brief An internal queue-based container structure to hold the WorkOrders.



incubator-quickstep git commit: Deserialization switch logic is implemented. [Forced Update!]

2017-04-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/frontend-backend 0221d1358 -> 46e411354 (forced update)


Deserialization switch logic is implemented.


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

Branch: refs/heads/frontend-backend
Commit: 46e4113545548e0b40d8773e3949083f3eea1119
Parents: 9690858
Author: Hakan Memisoglu 
Authored: Sun Apr 23 17:38:42 2017 -0500
Committer: Hakan Memisoglu 
Committed: Sun Apr 23 18:53:51 2017 -0500

--
 query_execution/CMakeLists.txt|   2 +
 query_execution/ExecutionDeserializer.cpp | 182 +
 query_execution/ExecutionDeserializer.hpp |  98 +
 query_optimizer/ExecutionSerializer.cpp   |  80 +++
 query_optimizer/Optimizer.cpp |   9 +-
 utility/DAG.hpp   |   4 +-
 6 files changed, 341 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/46e41135/query_execution/CMakeLists.txt
--
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
index eeed791..e4440fc 100644
--- a/query_execution/CMakeLists.txt
+++ b/query_execution/CMakeLists.txt
@@ -29,6 +29,7 @@ if (ENABLE_DISTRIBUTED)
   add_library(quickstep_queryexecution_BlockLocator BlockLocator.cpp 
BlockLocator.hpp)
   add_library(quickstep_queryexecution_BlockLocatorUtil BlockLocatorUtil.cpp 
BlockLocatorUtil.hpp)
 endif(ENABLE_DISTRIBUTED)
+add_library(quickstep_queryexecution_ExecutionDeserializer 
ExecutionDeserializer.cpp ExecutionDeserializer.hpp)
 add_library(quickstep_queryexecution_ForemanBase ../empty_src.cpp 
ForemanBase.hpp)
 if (ENABLE_DISTRIBUTED)
   add_library(quickstep_queryexecution_ForemanDistributed 
ForemanDistributed.cpp ForemanDistributed.hpp)
@@ -357,6 +358,7 @@ 
target_link_libraries(quickstep_queryexecution_WorkerSelectionPolicy
 add_library(quickstep_queryexecution ../empty_src.cpp QueryExecutionModule.hpp)
 target_link_libraries(quickstep_queryexecution
   quickstep_queryexecution_AdmitRequestMessage
+  quickstep_queryexecution_ExecutionDeserializer
   quickstep_queryexecution_ForemanBase
   quickstep_queryexecution_ForemanSingleNode
   quickstep_queryexecution_PolicyEnforcerBase

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/46e41135/query_execution/ExecutionDeserializer.cpp
--
diff --git a/query_execution/ExecutionDeserializer.cpp 
b/query_execution/ExecutionDeserializer.cpp
new file mode 100644
index 000..ddfc2f2
--- /dev/null
+++ b/query_execution/ExecutionDeserializer.cpp
@@ -0,0 +1,182 @@
+/**
+ * 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 "query_execution/ExecutionDeserializer.hpp"
+
+namespace quickstep {
+namespace optimizer {
+
+void ExecutionDeserializer::deserializePlan() {
+  const auto  = query_plan_proto_.vertex();
+  for (const auto  : vertices) {
+deserializeInternal(vertex);
+  }
+}
+
+void ExecutionDeserializer::deserializeInternal(const S::Vertex ) {
+  switch (vertex.operator_type()) {
+  case serialization::OP_AGGREGATION:
+return deserializeAggregation(vertex.aggregation_operator());
+  case serialization::OP_BUILD_AGGREGATION_EXISTENCE_MAP:
+return 
deserializeBuildAggregationExistenceMap(vertex.build_aggregation_existence_map_operator());
+  case serialization::OP_BUILD_HASH:
+return deserializeBuildHash(vertex.build_hash_operator());
+  case serialization::OP_BUILD_LIP_FILTER:
+return deserializeBuildLIPFilter(vertex.build_lip_filter_operator());
+  case serialization::OP_CREATE_INDEX:
+return 

incubator-quickstep git commit: Deserialization switch logic is implemented.

2017-04-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/frontend-backend 96908588b -> 0221d1358


Deserialization switch logic is implemented.


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

Branch: refs/heads/frontend-backend
Commit: 0221d13584ec75e9f51c8527804cd1e761249ef8
Parents: 9690858
Author: Hakan Memisoglu 
Authored: Sun Apr 23 17:38:42 2017 -0500
Committer: Hakan Memisoglu 
Committed: Sun Apr 23 17:38:42 2017 -0500

--
 query_execution/CMakeLists.txt|   2 +
 query_execution/ExecutionDeserializer.cpp | 112 +
 query_execution/ExecutionDeserializer.hpp |  98 ++
 query_optimizer/ExecutionSerializer.cpp   |  80 --
 query_optimizer/Optimizer.cpp |   9 +-
 utility/DAG.hpp   |   4 +-
 6 files changed, 271 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0221d135/query_execution/CMakeLists.txt
--
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
index eeed791..e4440fc 100644
--- a/query_execution/CMakeLists.txt
+++ b/query_execution/CMakeLists.txt
@@ -29,6 +29,7 @@ if (ENABLE_DISTRIBUTED)
   add_library(quickstep_queryexecution_BlockLocator BlockLocator.cpp 
BlockLocator.hpp)
   add_library(quickstep_queryexecution_BlockLocatorUtil BlockLocatorUtil.cpp 
BlockLocatorUtil.hpp)
 endif(ENABLE_DISTRIBUTED)
+add_library(quickstep_queryexecution_ExecutionDeserializer 
ExecutionDeserializer.cpp ExecutionDeserializer.hpp)
 add_library(quickstep_queryexecution_ForemanBase ../empty_src.cpp 
ForemanBase.hpp)
 if (ENABLE_DISTRIBUTED)
   add_library(quickstep_queryexecution_ForemanDistributed 
ForemanDistributed.cpp ForemanDistributed.hpp)
@@ -357,6 +358,7 @@ 
target_link_libraries(quickstep_queryexecution_WorkerSelectionPolicy
 add_library(quickstep_queryexecution ../empty_src.cpp QueryExecutionModule.hpp)
 target_link_libraries(quickstep_queryexecution
   quickstep_queryexecution_AdmitRequestMessage
+  quickstep_queryexecution_ExecutionDeserializer
   quickstep_queryexecution_ForemanBase
   quickstep_queryexecution_ForemanSingleNode
   quickstep_queryexecution_PolicyEnforcerBase

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0221d135/query_execution/ExecutionDeserializer.cpp
--
diff --git a/query_execution/ExecutionDeserializer.cpp 
b/query_execution/ExecutionDeserializer.cpp
new file mode 100644
index 000..bb2b4b0
--- /dev/null
+++ b/query_execution/ExecutionDeserializer.cpp
@@ -0,0 +1,112 @@
+/**
+ * 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 "query_execution/ExecutionDeserializer.hpp"
+
+namespace quickstep {
+namespace optimizer {
+
+void ExecutionDeserializer::deserializePlan() const {
+
+}
+
+void ExecutionDeserializer::deserializeInternal(const RelationalOperator 
_operator) {
+  switch (relational_operator.getOperatorType()) {
+  case RelationalOperator::kAggregation:
+deserializeAggregation(
+static_cast(relational_operator));
+  case RelationalOperator::kBuildAggregationExistenceMap:
+deserializeBuildAggregationExistenceMap(
+
static_cast(relational_operator));
+  case RelationalOperator::kBuildHash:
+deserializeBuildHash(
+static_cast(relational_operator));
+  case RelationalOperator::kBuildLIPFilter:
+deserializeBuildLIPFilter(
+static_cast(relational_operator));
+  case 

incubator-quickstep git commit: API to get total pending work orders for an operator

2017-04-19 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 6e3499a80 -> 3c83c937a


API to get total pending work orders for an operator

- Total includes normal and rebuild work orders.


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

Branch: refs/heads/master
Commit: 3c83c937acd6d2484cfa7c96c21e695fd3cdaba3
Parents: 6e3499a
Author: Harshad Deshmukh 
Authored: Wed Apr 19 13:31:08 2017 -0500
Committer: Harshad Deshmukh 
Committed: Wed Apr 19 14:38:24 2017 -0500

--
 query_execution/WorkOrdersContainer.hpp | 13 +
 1 file changed, 13 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c83c937/query_execution/WorkOrdersContainer.hpp
--
diff --git a/query_execution/WorkOrdersContainer.hpp 
b/query_execution/WorkOrdersContainer.hpp
index c1739bc..1fb3ca6 100644
--- a/query_execution/WorkOrdersContainer.hpp
+++ b/query_execution/WorkOrdersContainer.hpp
@@ -311,6 +311,19 @@ class WorkOrdersContainer {
 return rebuild_workorders_[operator_index].getNumWorkOrders();
   }
 
+  /**
+   * @brief Get the total number of work orders for the given operator.
+   *
+   * @param operator_index The index of the operator.
+   *
+   * @return The total number of WorkOrders (normal + rebuild).
+   **/
+  inline std::size_t getNumTotalWorkOrders(
+  const std::size_t operator_index) const {
+return getNumNormalWorkOrders(operator_index) +
+   getNumRebuildWorkOrders(operator_index);
+  }
+
  private:
   /**
* @brief An internal queue-based container structure to hold the WorkOrders.



incubator-quickstep git commit: Topological sort functionality in DAG

2017-04-19 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 563abe043 -> 6e3499a80


Topological sort functionality in DAG

- Implemented a very simple Kahn's algorithm for topological sorting of nodes
  in the DAG class.


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

Branch: refs/heads/master
Commit: 6e3499a80c559cb3ab11b9800cf5813b0f233f77
Parents: 563abe0
Author: Harshad Deshmukh 
Authored: Tue Apr 18 15:34:16 2017 -0500
Committer: Harshad Deshmukh 
Committed: Wed Apr 19 11:06:38 2017 -0500

--
 utility/DAG.hpp| 51 +++
 utility/tests/DAG_unittest.cpp | 82 +
 2 files changed, 133 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6e3499a8/utility/DAG.hpp
--
diff --git a/utility/DAG.hpp b/utility/DAG.hpp
index a1f2619..c286880 100644
--- a/utility/DAG.hpp
+++ b/utility/DAG.hpp
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -246,6 +247,11 @@ class DAG {
 return nodes_[node_index].getDependents().end();
   }
 
+  /**
+   * @brief Get a topologically sorted list of node IDs.
+   **/
+  std::vector getTopologicalSorting() const;
+
  private:
   /**
* @brief A node in the DAG which contains a payload. DAGNode owns its
@@ -489,6 +495,51 @@ bool DAG::hasCycleHelper(const typename 
DAG:
   return false;
 }
 
+template 
+std::vector::size_type_nodes>
+DAG::getTopologicalSorting() const {
+  // As a clarification, if A->B then A is the dependency for B and B is 
dependent on A.
+  // We implement "Kahn's algorithm" for the sorting.
+  DCHECK(!hasCycle());
+  // This list is going to be the topologically sorted output.
+  std::unique_ptr>
+  sorted_list(new std::vector());
+  sorted_list->reserve(this->size());
+  // Key = node ID, value = # incoming edges for this node.
+  // NOTE(harshad) - We modify the "values" in this map as we go along.
+  std::unordered_map::size_type_nodes,
+ std::size_t> num_dependencies;
+  std::queue::size_type_nodes> 
nodes_with_no_dependencies;
+  // First store the nodes without any dependencies in a list.
+  // Also remember the number of dependencies for each node in a map.
+  for (auto node_id = 0u; node_id < this->size(); ++node_id) {
+if (nodes_[node_id].getDependencies().empty()) {
+  nodes_with_no_dependencies.emplace(node_id);
+}
+num_dependencies[node_id] = nodes_[node_id].getDependencies().size();
+  }
+  // The algorithm begins now.
+  while (!nodes_with_no_dependencies.empty()) {
+// For a node with no dependencies ...
+auto curr_node = nodes_with_no_dependencies.front();
+nodes_with_no_dependencies.pop();
+// Add the node to the sorted list.
+sorted_list->emplace_back(curr_node);
+auto dependents_of_curr_node = getDependents(curr_node);
+for (auto dependent_iterator : dependents_of_curr_node) {
+  // For each dependent of the current node ...
+  auto dependent_node_id = dependent_iterator.first;
+  // Remove the incoming edge from curr_node.
+  DCHECK_GE(num_dependencies[dependent_node_id], 1u);
+  if (--num_dependencies[dependent_node_id] == 0) {
+// Now this node has no children.
+nodes_with_no_dependencies.emplace(dependent_node_id);
+  }
+}
+  }
+  return *(sorted_list.release());
+}
+
 /** @} */
 
 }  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6e3499a8/utility/tests/DAG_unittest.cpp
--
diff --git a/utility/tests/DAG_unittest.cpp b/utility/tests/DAG_unittest.cpp
index 3fe2990..3e8d167 100644
--- a/utility/tests/DAG_unittest.cpp
+++ b/utility/tests/DAG_unittest.cpp
@@ -490,6 +490,88 @@ TEST(DAGTest, LinkMetadataBoolTest) {
   EXPECT_FALSE(dag_.getLinkMetadata(1, 0));
 }
 
+TEST(DAGTest, TopoSortTest) {
+  const int kNodeSize = 5;
+  DAG dag_;
+
+  for (int node_index = 0; node_index < kNodeSize; ++node_index) {
+ASSERT_EQ(static_cast(node_index),
+  dag_.createNode(new DummyPayload(node_index)));
+  }
+
+  /*
+   *0
+   *   / \
+   *  v   v
+   *  1   2
+   *   \ /
+   *v
+   *3
+   *|
+   *v
+   *4
+   *
+   */
+
+  dag_.createLink(0, 1, 2);
+  dag_.createLink(0, 2, 1);
+  dag_.createLink(1, 3, 1);
+  dag_.createLink(2, 3, 1);
+  

incubator-quickstep git commit: Implemented serialization logic of all relational operators.

2017-04-17 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/frontend-backend 596cb529f -> 96908588b


Implemented serialization logic of all relational operators.


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

Branch: refs/heads/frontend-backend
Commit: 96908588b2464674b6f5dfcaa8a2a4dc4b3908c2
Parents: 596cb52
Author: Hakan Memisoglu 
Authored: Mon Apr 17 13:25:16 2017 -0500
Committer: Hakan Memisoglu 
Committed: Mon Apr 17 13:25:16 2017 -0500

--
 query_optimizer/CMakeLists.txt  |   6 +
 query_optimizer/ExecutionGenerator.cpp  |   4 +-
 query_optimizer/ExecutionGenerator.hpp  |   2 +-
 query_optimizer/ExecutionSerializer.cpp | 442 +++
 query_optimizer/ExecutionSerializer.hpp | 105 +
 query_optimizer/Optimizer.cpp   |   5 +-
 query_optimizer/QueryPlan.proto |  82 ++--
 relational_operators/AggregationOperator.hpp|   5 +-
 .../BuildAggregationExistenceMapOperator.hpp|   8 +
 relational_operators/BuildHashOperator.hpp  |  16 +
 relational_operators/BuildLIPFilterOperator.hpp |   4 +
 relational_operators/CreateIndexOperator.hpp|  12 +
 relational_operators/CreateTableOperator.hpp|   4 +
 relational_operators/DeleteOperator.hpp |   4 +
 .../DestroyAggregationStateOperator.hpp |   4 +
 relational_operators/DestroyHashOperator.hpp|   8 +
 relational_operators/DropTableOperator.hpp  |  10 +-
 .../FinalizeAggregationOperator.hpp |   4 +
 relational_operators/HashJoinOperator.hpp   |  28 ++
 .../InitializeAggregationOperator.hpp   |   4 +
 relational_operators/InsertOperator.hpp |   4 +
 .../NestedLoopsJoinOperator.hpp |  16 +
 relational_operators/Operator.proto | 301 +++--
 relational_operators/SampleOperator.hpp |  12 +
 relational_operators/SaveBlocksOperator.hpp |   8 +
 relational_operators/SelectOperator.hpp |  12 +
 relational_operators/SortMergeRunOperator.hpp   |  24 +
 .../SortRunGenerationOperator.hpp   |   8 +
 relational_operators/TableGeneratorOperator.hpp |   4 +
 relational_operators/TextScanOperator.hpp   |  12 +
 relational_operators/UpdateOperator.hpp |   8 +
 .../WindowAggregationOperator.hpp   |   8 +
 32 files changed, 1006 insertions(+), 168 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/96908588/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index abe59e2..79710fb 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -41,6 +41,7 @@ add_subdirectory(tests)
 
 # Declare micro-libs:
 add_library(quickstep_queryoptimizer_ExecutionGenerator ExecutionGenerator.cpp 
ExecutionGenerator.hpp)
+add_library(quickstep_queryoptimizer_ExecutionSerializer 
ExecutionSerializer.cpp ExecutionSerializer.hpp)
 add_library(quickstep_queryoptimizer_LIPFilterGenerator LIPFilterGenerator.cpp 
LIPFilterGenerator.hpp)
 add_library(quickstep_queryoptimizer_LogicalGenerator LogicalGenerator.cpp 
LogicalGenerator.hpp)
 add_library(quickstep_queryoptimizer_LogicalToPhysicalMapper
@@ -165,6 +166,10 @@ if (ENABLE_DISTRIBUTED)
   target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
 quickstep_catalog_Catalog_proto)
 endif()
+target_link_libraries(quickstep_queryoptimizer_ExecutionSerializer
+  quickstep_queryoptimizer_QueryPlan_proto
+  quickstep_relationaloperators_AggregationOperator
+  quickstep_relationaloperators_Operator_proto)
 target_link_libraries(quickstep_queryoptimizer_LIPFilterGenerator
   glog
   quickstep_catalog_CatalogAttribute
@@ -203,6 +208,7 @@ 
target_link_libraries(quickstep_queryoptimizer_LogicalToPhysicalMapper
   quickstep_utility_Macros)
 target_link_libraries(quickstep_queryoptimizer_Optimizer
   quickstep_queryoptimizer_ExecutionGenerator
+  quickstep_queryoptimizer_ExecutionSerializer
   quickstep_queryoptimizer_LogicalGenerator
   quickstep_queryoptimizer_PhysicalGenerator
   quickstep_utility_Macros)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/96908588/query_optimizer/ExecutionGenerator.cpp

incubator-quickstep git commit: First commit for frontend-backend separation.

2017-04-10 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/frontend-backend [created] 596cb529f


First commit for frontend-backend separation.


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

Branch: refs/heads/frontend-backend
Commit: 596cb529f0928964d19e55f9da761cebbd08f4a7
Parents: 5b7b5cb
Author: Hakan Memisoglu 
Authored: Mon Apr 10 21:02:00 2017 -0500
Committer: Hakan Memisoglu 
Committed: Mon Apr 10 21:02:00 2017 -0500

--
 query_optimizer/CMakeLists.txt  |  10 ++
 query_optimizer/Optimizer.cpp   |   5 +
 query_optimizer/QueryPlan.proto |  44 +++
 relational_operators/CMakeLists.txt |   6 +
 relational_operators/Operator.proto | 198 +++
 5 files changed, 263 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/596cb529/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 9bdb753..abe59e2 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -24,6 +24,10 @@ configure_file (
   "${CMAKE_CURRENT_BINARY_DIR}/QueryOptimizerConfig.h"
 )
 
+QS_PROTOBUF_GENERATE_CPP(queryoptimizer_QueryPlan_proto_srcs
+ queryoptimizer_QueryPlan_proto_hdrs
+ QueryPlan.proto)
+
 set_gflags_lib_name ()
 
 add_subdirectory(cost_model)
@@ -48,6 +52,9 @@ add_library(quickstep_queryoptimizer_OptimizerTree 
../empty_src.cpp OptimizerTre
 add_library(quickstep_queryoptimizer_PhysicalGenerator PhysicalGenerator.cpp 
PhysicalGenerator.hpp)
 add_library(quickstep_queryoptimizer_QueryHandle ../empty_src.cpp 
QueryHandle.hpp)
 add_library(quickstep_queryoptimizer_QueryPlan ../empty_src.cpp QueryPlan.hpp)
+add_library(quickstep_queryoptimizer_QueryPlan_proto
+${queryoptimizer_QueryPlan_proto_srcs}
+${queryoptimizer_QueryPlan_proto_hdrs})
 add_library(quickstep_queryoptimizer_QueryProcessor QueryProcessor.cpp 
QueryProcessor.hpp)
 add_library(quickstep_queryoptimizer_Validator ../empty_src.cpp Validator.hpp)
 
@@ -239,6 +246,9 @@ target_link_libraries(quickstep_queryoptimizer_QueryPlan
   quickstep_relationaloperators_RelationalOperator
   quickstep_utility_DAG
   quickstep_utility_Macros)
+target_link_libraries(quickstep_queryoptimizer_QueryPlan_proto
+  quickstep_relationaloperators_Operator_proto
+  ${PROTOBUF_LIBRARY})
 target_link_libraries(quickstep_queryoptimizer_QueryProcessor
   quickstep_catalog_Catalog
   quickstep_catalog_Catalog_proto

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/596cb529/query_optimizer/Optimizer.cpp
--
diff --git a/query_optimizer/Optimizer.cpp b/query_optimizer/Optimizer.cpp
index 1b91574..9ce517f 100644
--- a/query_optimizer/Optimizer.cpp
+++ b/query_optimizer/Optimizer.cpp
@@ -36,6 +36,11 @@ void Optimizer::generateQueryHandle(const ParseStatement 
_statement,
   execution_generator.generatePlan(
   physical_generator.generatePlan(
   logical_generator.generatePlan(*catalog_database, parse_statement)));
+
+  // TODO(Hakan): Break at this point.
+  // execution_serializer.serializePlan(
+  // physical_generator.generatePlan(
+  // logical_generator.generatePlan(*catalog_database, 
parse_statement)));
 }
 
 }  // namespace optimizer

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/596cb529/query_optimizer/QueryPlan.proto
--
diff --git a/query_optimizer/QueryPlan.proto b/query_optimizer/QueryPlan.proto
new file mode 100644
index 000..a255b34
--- /dev/null
+++ b/query_optimizer/QueryPlan.proto
@@ -0,0 +1,44 @@
+syntax = "proto2";
+
+package quickstep.serialization;
+
+import "relational_operators/Operator.proto";
+
+message Vertex {
+required OperatorType = 1;
+oneof operator {
+AggregationOperator aggregate_operator = 2;
+BuildHashOperator build_hash_operator = 3;
+BuildLIPFilterOperator build_lip_filter_operator = 4;
+CreateIndexOperator create_index_operator = 5;
+CreateTableOperator create_table_operator = 6;
+DeleteOperator delete_operator = 7;
+DestroyAggregationStateOperator destroy_aggregation_state_operator = 8;
+DestroyHashOperator 

[incubator-quickstep] Git Push Summary

2017-02-24 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/parallel-distinct-agg [deleted] 17477f575


incubator-quickstep git commit: Use partitioned aggregation for single-function DISTINCT aggregation.

2017-02-24 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 4be8e91a4 -> 17477f575


Use partitioned aggregation for single-function DISTINCT aggregation.


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

Branch: refs/heads/master
Commit: 17477f5756e599b4276d6d366c3144cad0be536f
Parents: 4be8e91
Author: Jianqiao Zhu 
Authored: Mon Feb 20 20:05:08 2017 -0600
Committer: Jianqiao Zhu 
Committed: Fri Feb 24 11:10:56 2017 -0600

--
 storage/AggregationOperationState.cpp | 158 -
 storage/AggregationOperationState.hpp |   3 +
 storage/CMakeLists.txt|   3 +-
 storage/PackedPayloadHashTable.cpp|  33 +++---
 storage/PackedPayloadHashTable.hpp|  32 --
 utility/TemplateUtil.hpp  |  74 +-
 6 files changed, 228 insertions(+), 75 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/17477f57/storage/AggregationOperationState.cpp
--
diff --git a/storage/AggregationOperationState.cpp 
b/storage/AggregationOperationState.cpp
index 0f39b41..eef2c9d 100644
--- a/storage/AggregationOperationState.cpp
+++ b/storage/AggregationOperationState.cpp
@@ -19,8 +19,10 @@
 
 #include "storage/AggregationOperationState.hpp"
 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,6 +89,8 @@ AggregationOperationState::AggregationOperationState(
   is_aggregate_partitioned_(false),
   predicate_(predicate),
   is_distinct_(std::move(is_distinct)),
+  all_distinct_(std::accumulate(is_distinct_.begin(), is_distinct_.end(),
+!is_distinct_.empty(), 
std::logical_and())),
   storage_manager_(storage_manager) {
   if (!group_by.empty()) {
 if (hash_table_impl_type == HashTableImplType::kCollisionFreeVector) {
@@ -163,11 +167,6 @@ AggregationOperationState::AggregationOperationState(
 handles_.emplace_back((*agg_func_it)->createHandle(argument_types));
 
 if (!group_by_key_ids_.empty()) {
-  // Aggregation with GROUP BY: combined payload is partially updated in
-  // the presence of DISTINCT.
-  if (*is_distinct_it) {
-handles_.back()->blockUpdate();
-  }
   group_by_handles.emplace_back(handles_.back().get());
 } else {
   // Aggregation without GROUP BY: create a single global state.
@@ -180,17 +179,32 @@ AggregationOperationState::AggregationOperationState(
   std::vector key_types(group_by_types_);
   key_types.insert(
   key_types.end(), argument_types.begin(), argument_types.end());
+
   // TODO(jianqiao): estimated_num_entries is quite inaccurate for
   // estimating the number of entries in the distinctify hash table.
   // We need to estimate for each distinct aggregation an
   // estimated_num_distinct_keys value during query optimization.
-  distinctify_hashtables_.emplace_back(
-  AggregationStateHashTableFactory::CreateResizable(
-  *distinctify_hash_table_impl_types_it,
-  key_types,
-  estimated_num_entries,
-  {} /* handles */,
-  storage_manager));
+  if (is_aggregate_partitioned_) {
+DCHECK(partitioned_group_by_hashtable_pool_ == nullptr);
+partitioned_group_by_hashtable_pool_.reset(
+new PartitionedHashTablePool(estimated_num_entries,
+ FLAGS_num_aggregation_partitions,
+ *distinctify_hash_table_impl_types_it,
+ key_types,
+ {},
+ storage_manager));
+  } else {
+distinctify_hashtables_.emplace_back(
+AggregationStateHashTableFactory::CreateResizable(
+*distinctify_hash_table_impl_types_it,
+key_types,
+estimated_num_entries,
+{} /* handles */,
+storage_manager));
+
+// Combined payload is partially updated in the presence of DISTINCT.
+handles_.back()->blockUpdate();
+  }
   ++distinctify_hash_table_impl_types_it;
 } else {
   distinctify_hashtables_.emplace_back(nullptr);
@@ -208,13 +222,24 @@ AggregationOperationState::AggregationOperationState(
   group_by_handles,
   storage_manager));
 } else if (is_aggregate_partitioned_) {
-  partitioned_group_by_hashtable_pool_.reset(
-

incubator-quickstep git commit: QUICKSTEP-65 Fix Quickstep build failure on Mac OSX 10.12 by turning off deprecation errors

2016-12-06 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master b949c5045 -> 6ae0cdd3d


QUICKSTEP-65 Fix Quickstep build failure on Mac OSX 10.12 by turning off 
deprecation errors


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

Branch: refs/heads/master
Commit: 6ae0cdd3d5db40febc98be00ce94baeed31ba680
Parents: b949c50
Author: Saket Saurabh 
Authored: Tue Dec 6 09:53:57 2016 -0600
Committer: Saket Saurabh 
Committed: Tue Dec 6 10:05:42 2016 -0600

--
 CMakeLists.txt | 19 +++
 1 file changed, 19 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6ae0cdd3/CMakeLists.txt
--
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 391cb26..4dcc56a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -291,6 +291,25 @@ else()
 endif()
   endif()
 
+  # OSX 10.12 has deprecated certain system-level APIs which causes protobuf & 
glog
+  # builds to fail. As a short-term workaround for now, we turn off deprecated
+  # warnings so that they do not cause build failures anymore.
+  # TODO: Remove this workaround by fixing the protobuf_cmake and glog_cmake.
+  if (${CMAKE_SYSTEM} MATCHES "Darwin-16.1.0")
+if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
+  CHECK_CXX_COMPILER_FLAG("-Wno-error=deprecated-declarations" 
COMPILER_HAS_WNO_DEPRECATED)
+  if (COMPILER_HAS_WNO_DEPRECATED)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} 
-Wno-error=deprecated-declarations")
+  endif()
+endif()
+if(CMAKE_COMPILER_IS_GNUCXX)
+  CHECK_CXX_COMPILER_FLAG("-Wno-deprecated-declarations" 
COMPILER_HAS_WNO_DEPRECATED)
+  if (COMPILER_HAS_WNO_DEPRECATED)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
+  endif()
+endif()
+  endif()
+
   # One of the protobuf headers includes a nested anonymous union within
   # another anonymous type. Ordinarily we work around this by compiling the
   # protobuf libraries themselves with "-Wno-nested-anon-types" and including



[incubator-quickstep] Git Push Summary

2016-11-05 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/auto-worker-pinning [deleted] 248cec273


incubator-quickstep git commit: Auto pin workers to CPU cores

2016-11-05 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master 5a3037f2e -> 1340fcb7f


Auto pin workers to CPU cores

- Automatically pin worker threads to CPU cores.
- Use auto pinning when either there are no affinities provided, or the
  provided affinities are incorrect.
- Try to balance CPU cores across multiple sockets, when maximum
  paralellism is not used.


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

Branch: refs/heads/master
Commit: 1340fcb7f47f8be0f5f8f397fdc9c9f08db120b3
Parents: 5a3037f
Author: Harshad Deshmukh 
Authored: Thu Nov 3 23:34:37 2016 -0500
Committer: Hakan Memisoglu 
Committed: Sat Nov 5 14:59:53 2016 -0500

--
 cli/InputParserUtil.cpp | 68 ++--
 1 file changed, 59 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1340fcb7/cli/InputParserUtil.cpp
--
diff --git a/cli/InputParserUtil.cpp b/cli/InputParserUtil.cpp
index 0538afc..e45605c 100644
--- a/cli/InputParserUtil.cpp
+++ b/cli/InputParserUtil.cpp
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -44,23 +45,72 @@ std::vector InputParserUtil::ParseWorkerAffinities(
 const int num_workers,
 const string _string) {
   std::vector affinities;
+  bool switch_to_default_affinities = false;
   if (affinity_string.empty()) {
-affinities.resize(num_workers, -1);
-return affinities;
-  }
-
-  if (!ParseIntString(affinity_string, ',', )) {
-LOG(FATAL) << "--worker_affinities must be a comma-separated list of "
-   << "integer CPU ids.\n";
+switch_to_default_affinities = true;
+LOG(INFO) << "Empty worker affinities provided, switching to default "
+ "worker affinities";
+  } else if (!ParseIntString(affinity_string, ',', )) {
+  switch_to_default_affinities = true;
+  LOG(INFO) << "Invalid worker affinities provided, switching to default "
+   "affinities";
   }
 
   for (const int affinity : affinities) {
 if (affinity < -1) {
-  LOG(FATAL) << "CPU affinities specified by --worker_affinities must be "
- << "non-negative, or -1 to specify no affinity.\n";
+  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 cpus_from_sockets;
+cpus_from_sockets.resize(num_sockets);
+for (int curr_socket = 0; curr_socket < num_sockets; ++curr_socket) {
+  std::unique_ptr 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(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);
+   

incubator-quickstep git commit: Suppress glog compilation warnings.

2016-10-29 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/glog-fix-apple [created] 8baa8c375


Suppress glog compilation warnings.


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

Branch: refs/heads/glog-fix-apple
Commit: 8baa8c375b9797c8d6488dc6e676af98385d6996
Parents: 7f0067b
Author: Hakan Memisoglu 
Authored: Sat Oct 29 01:21:36 2016 -0500
Committer: Hakan Memisoglu 
Committed: Sat Oct 29 01:23:15 2016 -0500

--
 CMakeLists.txt | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8baa8c37/CMakeLists.txt
--
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 487aaf9..ab22ba3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -670,6 +670,11 @@ if (WIN32)
 APPEND PROPERTY COMPILE_DEFINITIONS GOOGLE_GLOG_DLL_DECL=
   )
   include_directories(${THIRD_PARTY_SOURCE_DIR}/glog/src/windows)
+elseif (APPLE)
+  set_property(
+TARGET glog
+APPEND PROPERTY COMPILE_OPTIONS " -Wno-deprecated-declarations "
+  )
 else()
   include_directories(${THIRD_PARTY_SOURCE_DIR}/glog/src)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party)



incubator-quickstep git commit: Added the print statement

2016-10-13 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/chaining 8729df822 -> b624413b9


Added the print statement


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

Branch: refs/heads/chaining
Commit: b624413b997df74d17c50341e31ad1fabeda857d
Parents: 8729df8
Author: Hakan Memisoglu 
Authored: Thu Oct 13 14:37:38 2016 -0500
Committer: Hakan Memisoglu 
Committed: Thu Oct 13 14:37:38 2016 -0500

--
 storage/SeparateChainingHashTable.hpp | 42 +-
 1 file changed, 1 insertion(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b624413b/storage/SeparateChainingHashTable.hpp
--
diff --git a/storage/SeparateChainingHashTable.hpp 
b/storage/SeparateChainingHashTable.hpp
index 4b46e30..b8f62dd 100644
--- a/storage/SeparateChainingHashTable.hpp
+++ b/storage/SeparateChainingHashTable.hpp
@@ -719,7 +719,7 @@ HashTablePutResult
   for (;;) {
 // Save the address;
 std::size_t existing_chain_ptr = 
pending_chain_ptr->load(std::memory_order_release);
-
+std::cout << "CAS" << std::endl;
 // Make bucket's (new head) ptr to hold address of old head.
 buckets_next_ptr->store(existing_chain_ptr, std::memory_order_release);
 if (pending_chain_ptr->compare_exchange_strong(existing_chain_ptr,
@@ -729,46 +729,6 @@ HashTablePutResult
 }
   }
   return HashTablePutResult::kOK;
-  
-  // OLD CODE
-  // for (;;) {
-  //   if (locateBucketForInsertion(hash_code,
-  //0,
-  //,
-  //_chain_ptr,
-  //_chain_ptr_finish_value,
-  //prealloc_state)) {
-  // // Found an empty bucket.
-  // break;
-  //   } else if (bucket == nullptr) {
-  // // Ran out of buckets. Deallocate any variable space that we were 
unable
-  // // to use.
-  // DEBUG_ASSERT(prealloc_state == nullptr);
-  // key_manager_.deallocateVariableLengthKeyStorage(variable_key_size);
-  // return HashTablePutResult::kOutOfSpace;
-  //   } else {
-  // // Hash collision found, and duplicates aren't allowed.
-  // DEBUG_ASSERT(!allow_duplicate_keys);
-  // DEBUG_ASSERT(prealloc_state == nullptr);
-  // if (key_manager_.scalarKeyCollisionCheck(key, bucket)) {
-  //   // Duplicate key. Deallocate any variable storage space and return.
-  //   key_manager_.deallocateVariableLengthKeyStorage(variable_key_size);
-  //   return HashTablePutResult::kDuplicateKey;
-  // }
-  //   }
-  // }
-
-  // // Write the key and hash.
-  // writeScalarKeyToBucket(key, hash_code, bucket, prealloc_state);
-
-  // // Store the value by using placement new with ValueT's copy constructor.
-  // new(static_cast(bucket) + kValueOffset) ValueT(value);
-
-  // // Update the previous chain pointer to point to the new bucket.
-  // pending_chain_ptr->store(pending_chain_ptr_finish_value, 
std::memory_order_release);
-
-  // We're all done.
-  //return HashTablePutResult::kOK;
 }
 
 template 

incubator-quickstep git commit: Changed hash table insertion method to add new bucket to the beginning of the chain.

2016-10-11 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/chaining [created] 8729df822


Changed hash table insertion method to add new bucket to the beginning of the 
chain.


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

Branch: refs/heads/chaining
Commit: 8729df8226eef10345d366fc050c3c1b8fe87077
Parents: 80af233
Author: Hakan Memisoglu 
Authored: Tue Oct 11 18:53:57 2016 -0500
Committer: Hakan Memisoglu 
Committed: Tue Oct 11 18:53:57 2016 -0500

--
 storage/SeparateChainingHashTable.hpp | 101 +++--
 1 file changed, 68 insertions(+), 33 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8729df82/storage/SeparateChainingHashTable.hpp
--
diff --git a/storage/SeparateChainingHashTable.hpp 
b/storage/SeparateChainingHashTable.hpp
index 3ca060d..4b46e30 100644
--- a/storage/SeparateChainingHashTable.hpp
+++ b/storage/SeparateChainingHashTable.hpp
@@ -695,45 +695,80 @@ HashTablePutResult
   const std::size_t hash_code = key.getHash();
   void *bucket = nullptr;
   std::atomic *pending_chain_ptr;
-  std::size_t pending_chain_ptr_finish_value;
-  for (;;) {
-if (locateBucketForInsertion(hash_code,
- 0,
- ,
- _chain_ptr,
- _chain_ptr_finish_value,
- prealloc_state)) {
-  // Found an empty bucket.
-  break;
-} else if (bucket == nullptr) {
-  // Ran out of buckets. Deallocate any variable space that we were unable
-  // to use.
-  DEBUG_ASSERT(prealloc_state == nullptr);
-  key_manager_.deallocateVariableLengthKeyStorage(variable_key_size);
-  return HashTablePutResult::kOutOfSpace;
-} else {
-  // Hash collision found, and duplicates aren't allowed.
-  DEBUG_ASSERT(!allow_duplicate_keys);
-  DEBUG_ASSERT(prealloc_state == nullptr);
-  if (key_manager_.scalarKeyCollisionCheck(key, bucket)) {
-// Duplicate key. Deallocate any variable storage space and return.
-key_manager_.deallocateVariableLengthKeyStorage(variable_key_size);
-return HashTablePutResult::kDuplicateKey;
-  }
-}
+  //std::size_t pending_chain_ptr_finish_value;
+ 
+  const std::size_t allocated_bucket_num
+= (prealloc_state == nullptr)
+? header_->buckets_allocated.fetch_add(1, std::memory_order_relaxed)
+: (prealloc_state->bucket_position)++;
+
+  if (allocated_bucket_num >= header_->num_buckets) {
+header_->buckets_allocated.fetch_sub(1, std::memory_order_relaxed);
+key_manager_.deallocateVariableLengthKeyStorage(variable_key_size);
+return HashTablePutResult::kOutOfSpace;
   }
-
-  // Write the key and hash.
+  bucket = static_cast(buckets_) + allocated_bucket_num * bucket_size_;
+  
+  // Why is prealloc taken as an argument?
   writeScalarKeyToBucket(key, hash_code, bucket, prealloc_state);
-
-  // Store the value by using placement new with ValueT's copy constructor.
   new(static_cast(bucket) + kValueOffset) ValueT(value);
+  
+  std::atomic* buckets_next_ptr = 
static_cast(bucket);
 
-  // Update the previous chain pointer to point to the new bucket.
-  pending_chain_ptr->store(pending_chain_ptr_finish_value, 
std::memory_order_release);
+  pending_chain_ptr = &(slots_[hash_code % header_->num_slots]);
+  for (;;) {
+// Save the address;
+std::size_t existing_chain_ptr = 
pending_chain_ptr->load(std::memory_order_release);
+
+// Make bucket's (new head) ptr to hold address of old head.
+buckets_next_ptr->store(existing_chain_ptr, std::memory_order_release);
+if (pending_chain_ptr->compare_exchange_strong(existing_chain_ptr,
+  allocated_bucket_num + 1,
+  std::memory_order_acq_rel)) {
+  break;
+}
+  }
+  return HashTablePutResult::kOK;
+  
+  // OLD CODE
+  // for (;;) {
+  //   if (locateBucketForInsertion(hash_code,
+  //0,
+  //,
+  //_chain_ptr,
+  //_chain_ptr_finish_value,
+  //prealloc_state)) {
+  // // Found an empty bucket.
+  // break;
+  //   } else if (bucket == nullptr) {
+  // // Ran out of buckets. Deallocate any variable space that we were 
unable
+  // // 

incubator-quickstep git commit: Intial commit for new branch

2016-09-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master ac3512ceb -> 0280a7eca


Intial commit for new branch


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

Branch: refs/heads/master
Commit: 0280a7eca39c6828c6c39c92eeaa40b83423be8b
Parents: ac3512c
Author: Hakan Memisoglu 
Authored: Fri Sep 23 13:22:55 2016 -0500
Committer: Hakan Memisoglu 
Committed: Fri Sep 23 13:22:55 2016 -0500

--
 storage/CMakeLists.txt| 14 +++
 storage/tests/SplitRowStoreRegression.cpp | 52 ++
 2 files changed, 66 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0280a7ec/storage/CMakeLists.txt
--
diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt
index f05cc46..c619d31 100644
--- a/storage/CMakeLists.txt
+++ b/storage/CMakeLists.txt
@@ -1554,6 +1554,20 @@ target_link_libraries(EvictionPolicy_unittest
   ${LIBS})
 add_test(EvictionPolicy_unittest EvictionPolicy_unittest)
 
+add_executable(SplitRowStoreRegression_unittest
+  "${CMAKE_CURRENT_SOURCE_DIR}/tests/SplitRowStoreRegression.cpp")
+target_link_libraries(SplitRowStoreRegression_unittest
+  gtest
+  gtest_main
+  quickstep_catalog_CatalogAttribute
+  quickstep_catalog_CatalogRelation
+  quickstep_storage_SplitRowStoreTupleStorageSubBlock
+  quickstep_storage_StorageBlockLayout_proto
+  quickstep_types_TypeFactory
+  quickstep_utility_ScopedBuffer
+  ${LIBS})
+add_test(SplitRowStoreRegression_unittest SplitRowStoreRegression_unittest)
+
 if (QUICKSTEP_HAVE_FILE_MANAGER_HDFS)
 add_executable(FileManagerHdfs_unittest

"${CMAKE_CURRENT_SOURCE_DIR}/tests/FileManagerHdfs_unittest.cpp")

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0280a7ec/storage/tests/SplitRowStoreRegression.cpp
--
diff --git a/storage/tests/SplitRowStoreRegression.cpp 
b/storage/tests/SplitRowStoreRegression.cpp
new file mode 100644
index 000..a21f9a8
--- /dev/null
+++ b/storage/tests/SplitRowStoreRegression.cpp
@@ -0,0 +1,52 @@
+#include 
+#include 
+
+#include "catalog/CatalogAttribute.hpp"
+#include "catalog/CatalogRelation.hpp"
+#include "storage/SplitRowStoreTupleStorageSubBlock.hpp"
+#include "storage/StorageBlockLayout.hpp"
+#include "storage/StorageBlockLayout.pb.h"
+#include "types/TypeFactory.hpp"
+#include "utility/ScopedBuffer.hpp"
+
+#include "gtest/gtest.h"
+
+namespace quickstep {
+
+class SplitRowStoreRegression : public ::testing::TestWithParam {
+ protected:
+  static const size_t kSubBlockSize = 0x100;  // 16 MB.
+
+  virtual void SetUp() {
+relation_.reset(new CatalogRelation(nullptr, "RegressionRelation"));
+
+std::size_t num_of_attributes = GetParam();
+for (std::size_t i = 0; num_of_attributes; ++i) {
+  std::string name_of_attribute = "double_attr" + std::to_string(i);
+  CatalogAttribute *double_attr = new CatalogAttribute(relation_.get(),
+   name_of_attribute,
+   
TypeFactory::GetType(kDouble, false));
+  ASSERT_EQ(i, relation_->addAttribute(double_attr));
+}
+
+tuple_store_description_.reset();
+tuple_store_.reset();
+tuple_store_memory_.reset();
+  }
+
+  std::unique_ptr relation_;
+  ScopedBuffer tuple_store_memory_;
+  std::unique_ptr tuple_store_description_;
+  std::unique_ptr tuple_store_;
+};
+
+TEST_P(SplitRowStoreRegression, StrideAccess) {
+  std::size_t param = GetParam();
+  ASSERT_LT(param, 10);
+}
+
+INSTANTIATE_TEST_CASE_P(SplitRowStoreRegressionStrideTest,
+SplitRowStoreRegression,
+::testing::Values(1, 2, 4, 8, 16, 32, 64, 128, 256),);
+
+}



incubator-quickstep git commit: Fixed the bug in SetUp.

2016-09-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/regression 0280a7eca -> c6a0cb25c


Fixed the bug in SetUp.


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

Branch: refs/heads/regression
Commit: c6a0cb25c6d1ed6ca8c2b05024a03d356ae50b6e
Parents: 0280a7e
Author: Hakan Memisoglu 
Authored: Fri Sep 23 14:00:17 2016 -0500
Committer: Hakan Memisoglu 
Committed: Fri Sep 23 14:00:17 2016 -0500

--
 storage/tests/SplitRowStoreRegression.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c6a0cb25/storage/tests/SplitRowStoreRegression.cpp
--
diff --git a/storage/tests/SplitRowStoreRegression.cpp 
b/storage/tests/SplitRowStoreRegression.cpp
index a21f9a8..2fbe9c3 100644
--- a/storage/tests/SplitRowStoreRegression.cpp
+++ b/storage/tests/SplitRowStoreRegression.cpp
@@ -21,7 +21,7 @@ class SplitRowStoreRegression : public 
::testing::TestWithParam {
 relation_.reset(new CatalogRelation(nullptr, "RegressionRelation"));
 
 std::size_t num_of_attributes = GetParam();
-for (std::size_t i = 0; num_of_attributes; ++i) {
+for (std::size_t i = 0; i < num_of_attributes; ++i) {
   std::string name_of_attribute = "double_attr" + std::to_string(i);
   CatalogAttribute *double_attr = new CatalogAttribute(relation_.get(),
name_of_attribute,



incubator-quickstep git commit: [QUICKSTEP-53] New representation and faster comparison operators for DateLit [Forced Update!]

2016-09-06 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/date-representation 92555fc43 -> 5a9c29004 (forced update)


[QUICKSTEP-53] New representation and faster comparison operators for DateLit

- New representation for DateLit.
- New comparison implementations for DateLit.

Closes #98


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

Branch: refs/heads/date-representation
Commit: 5a9c290043051dab9c4fd40db220f266479cf419
Parents: 1d10422
Author: Hakan Memisoglu 
Authored: Tue Sep 6 19:59:26 2016 -0500
Committer: Hakan Memisoglu 
Committed: Tue Sep 6 20:01:57 2016 -0500

--
 types/DateOperatorOverloads.hpp | 12 ++--
 types/DateType.cpp  |  8 +--
 types/DatetimeLit.hpp   | 62 +---
 types/TypedValue.cpp|  9 +--
 types/TypedValue.hpp|  4 +-
 types/TypedValue.proto  |  8 +--
 .../unary_operations/DateExtractOperation.cpp   |  2 +-
 7 files changed, 58 insertions(+), 47 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5a9c2900/types/DateOperatorOverloads.hpp
--
diff --git a/types/DateOperatorOverloads.hpp b/types/DateOperatorOverloads.hpp
index b04f44e..e2e5f6a 100644
--- a/types/DateOperatorOverloads.hpp
+++ b/types/DateOperatorOverloads.hpp
@@ -122,8 +122,8 @@ inline DatetimeLit operator+(const YearMonthIntervalLit 
, const DatetimeLit
 }
 
 inline DateLit operator+(const DateLit , const YearMonthIntervalLit ) {
-  std::int32_t result_year = lhs.year + (rhs.months / 12);
-  std::uint8_t result_month = lhs.month + (rhs.months % 12);
+  std::int32_t result_year = lhs.yearField() + (rhs.months / 12);
+  std::uint8_t result_month = static_cast(lhs.monthField()) + 
(rhs.months % 12);
 
   if (result_month > 11) {
 result_month -= 12;
@@ -131,7 +131,7 @@ inline DateLit operator+(const DateLit , const 
YearMonthIntervalLit ) {
   }
 
   const std::uint8_t result_day = static_cast(
-  ClampDayOfMonth(result_year, result_month, lhs.day));
+  ClampDayOfMonth(result_year, result_month, lhs.dayField()));
 
   return DateLit::Create(result_year, result_month, result_day);
 }
@@ -187,8 +187,8 @@ inline DatetimeLit operator-(const DatetimeLit , const 
YearMonthIntervalLit
 }
 
 inline DateLit operator-(const DateLit , const YearMonthIntervalLit ) {
-  std::int32_t result_year = lhs.year - (rhs.months / 12);
-  std::int8_t result_month = lhs.month - (rhs.months % 12);
+  std::int32_t result_year = lhs.yearField() - (rhs.months / 12);
+  std::int8_t result_month = static_cast(lhs.monthField()) - 
(rhs.months % 12);
 
   if (result_month < 0) {
 --result_year;
@@ -196,7 +196,7 @@ inline DateLit operator-(const DateLit , const 
YearMonthIntervalLit ) {
   }
 
   const std::uint8_t result_day = static_cast(
-  ClampDayOfMonth(result_year, result_month, lhs.day));
+  ClampDayOfMonth(result_year, result_month, lhs.dayField()));
 
   return DateLit::Create(result_year, result_month, result_day);
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5a9c2900/types/DateType.cpp
--
diff --git a/types/DateType.cpp b/types/DateType.cpp
index 5bb982c..388898e 100644
--- a/types/DateType.cpp
+++ b/types/DateType.cpp
@@ -60,7 +60,7 @@ std::string DateType::printValueToString(const TypedValue 
) const {
   DCHECK(!value.isNull());
 
   const DateLit literal = value.getLiteral();
-  const std::int32_t year = literal.year;
+  const std::int32_t year = literal.yearField();
 
   char datebuf[DateLit::kIsoChars + 1];
   std::size_t chars_written = 0;
@@ -78,9 +78,9 @@ std::string DateType::printValueToString(const TypedValue 
) const {
   // All the rest of the ISO 8601 date/time parts.
   snprintf_result = snprintf(datebuf + chars_written,
  sizeof(datebuf) - chars_written,
- "%02d-%02d",
- literal.month,
- literal.day);
+ "%02u-%02u",
+ literal.monthField(),
+ literal.dayField());
   CheckSnprintf(snprintf_result, sizeof(datebuf), _written);
 
   return std::string(datebuf);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5a9c2900/types/DatetimeLit.hpp

incubator-quickstep git commit: Some additional changes for the size change.

2016-09-06 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/date-representation 2f5b6ddfd -> 92555fc43


Some additional changes for the size change.


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

Branch: refs/heads/date-representation
Commit: 92555fc4311d8efdee4b66faeb4fb0cd48938595
Parents: 2f5b6dd
Author: Hakan Memisoglu 
Authored: Tue Sep 6 09:02:40 2016 -0500
Committer: Hakan Memisoglu 
Committed: Tue Sep 6 09:02:40 2016 -0500

--
 types/DatetimeLit.hpp  | 6 ++
 types/TypedValue.cpp   | 9 ++---
 types/TypedValue.hpp   | 4 +++-
 types/TypedValue.proto | 8 +---
 4 files changed, 12 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/DatetimeLit.hpp
--
diff --git a/types/DatetimeLit.hpp b/types/DatetimeLit.hpp
index 7ce7177..c99dae4 100644
--- a/types/DatetimeLit.hpp
+++ b/types/DatetimeLit.hpp
@@ -73,6 +73,12 @@ struct DateLit {
 return date;
   }
 
+  static DateLit Create(const std::uint32_t serialized) {
+DateLit date;
+date.year_month_day = serialized;
+return date;
+  }
+
   inline bool operator< (const DateLit& rhs) const {
 return year_month_day < rhs.year_month_day;
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/TypedValue.cpp
--
diff --git a/types/TypedValue.cpp b/types/TypedValue.cpp
index d7b4956..ada69c6 100644
--- a/types/TypedValue.cpp
+++ b/types/TypedValue.cpp
@@ -110,10 +110,7 @@ serialization::TypedValue TypedValue::getProto() const {
 case kDate:
   proto.set_type_id(serialization::Type::DATE);
   if (!isNull()) {
-serialization::TypedValue::DateLit *literal_date_proto = 
proto.mutable_date_value();
-literal_date_proto->set_year(value_union_.date_value.yearField());
-literal_date_proto->set_month(value_union_.date_value.monthField());
-literal_date_proto->set_day(value_union_.date_value.dayField());
+proto.set_date_value(getLiteral().year_month_day);
   }
   break;
 case kDatetime:
@@ -185,9 +182,7 @@ TypedValue TypedValue::ReconstructFromProto(const 
serialization::TypedValue 
   TypedValue(kDouble);
 case serialization::Type::DATE:
   if (proto.has_date_value()) {
-return TypedValue(DateLit::Create(proto.date_value().year(),
-  proto.date_value().month(),
-  proto.date_value().day()));
+return TypedValue(DateLit::Create(proto.date_value()));
   } else {
 return TypedValue(kDate);
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/TypedValue.hpp
--
diff --git a/types/TypedValue.hpp b/types/TypedValue.hpp
index d75720a..dae8bd8 100644
--- a/types/TypedValue.hpp
+++ b/types/TypedValue.hpp
@@ -393,10 +393,10 @@ class TypedValue {
 switch (getTypeID()) {
   case kInt:
   case kFloat:
+  case kDate:
 return sizeof(int);
   case kLong:
   case kDouble:
-  case kDate:
   case kDatetime:
   case kDatetimeInterval:
   case kYearMonthInterval:
@@ -552,6 +552,8 @@ class TypedValue {
   // 4 bytes byte-for-byte copy.
   *static_cast(destination) = value_union_.int_value;
   break;
+case kDate:
+  *static_cast(destination) = value_union_.date_value;
 default:
   // 8 bytes byte-for-byte copy.
   *static_cast(destination) = value_union_;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/TypedValue.proto
--
diff --git a/types/TypedValue.proto b/types/TypedValue.proto
index 7f3ab7a..0164688 100644
--- a/types/TypedValue.proto
+++ b/types/TypedValue.proto
@@ -34,11 +34,5 @@ message TypedValue {
   optional int64 datetime_interval_value = 8;
   optional int64 year_month_interval_value = 9;
 
-  message DateLit {
-required int32 year = 1;
-required uint32 month = 2;
-required uint32 day = 3;
-  }
-
-  optional DateLit date_value = 10;
+  optional uint32 date_value = 10;
 }



[3/4] incubator-quickstep git commit: Separate Date type from Datetime type.

2016-09-05 Thread hakanmemisoglu
Separate Date type from Datetime type.

- Beginning from the parser to the operator execution level, treat Date type
  sepearately than the Datetime type.
- Provide support for the extract function when applied on the Date
  type, implemented in the DateExtractOperation.
- Modified the tests.


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

Branch: refs/heads/date-representation
Commit: 283e53646140c034a967f22e43c7e5d47affd379
Parents: 1d10422
Author: Harshad Deshmukh 
Authored: Mon Aug 29 14:03:52 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Sep 5 14:51:14 2016 -0500

--
 types/operations/unary_operations/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/283e5364/types/operations/unary_operations/CMakeLists.txt
--
diff --git a/types/operations/unary_operations/CMakeLists.txt 
b/types/operations/unary_operations/CMakeLists.txt
index 6e1923a..4a7af91 100644
--- a/types/operations/unary_operations/CMakeLists.txt
+++ b/types/operations/unary_operations/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one
+# Licensed to the Agache 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



[2/4] incubator-quickstep git commit: Separate Date type from Datetime type.

2016-09-05 Thread hakanmemisoglu
Separate Date type from Datetime type.

- Beginning from the parser to the operator execution level, treat Date type
  sepearately than the Datetime type.
- Provide support for the extract function when applied on the Date
  type, implemented in the DateExtractOperation.
- Modified the tests.


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

Branch: refs/heads/date-representation
Commit: 1d10422913d7b2ea613c5853585fcea333534ec5
Parents: cdc1e05
Author: Harshad Deshmukh 
Authored: Mon Aug 29 14:03:52 2016 -0500
Committer: Harshad Deshmukh 
Committed: Mon Sep 5 11:02:26 2016 -0500

--
 parser/SqlParser.ypp|   2 +-
 parser/tests/Select.test|  28 +--
 parser/tests/TPCH.test  |  47 ++--
 .../tests/execution_generator/Insert.test   |  19 ++
 .../tests/execution_generator/Select.test   |  32 +--
 query_optimizer/tests/resolver/Select.test  |  71 --
 types/DateOperatorOverloads.hpp |  63 -
 types/DatetimeLit.hpp   |   8 +
 .../binary_operations/AddBinaryOperation.cpp|  84 ++-
 .../operations/binary_operations/CMakeLists.txt |   2 +
 .../SubtractBinaryOperation.cpp |  81 +-
 .../tests/AddBinaryOperation_unittest.cpp   |  23 +-
 .../tests/BinaryOperationTestUtil.hpp   |   4 +-
 .../tests/SubtractBinaryOperation_unittest.cpp  |  23 +-
 .../operations/unary_operations/CMakeLists.txt  |   2 +
 .../unary_operations/DateExtractOperation.cpp   | 246 ---
 .../unary_operations/DateExtractOperation.hpp   |  52 +++-
 .../tests/DateExtractOperation_unittest.cpp |  93 +--
 18 files changed, 708 insertions(+), 172 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1d104229/parser/SqlParser.ypp
--
diff --git a/parser/SqlParser.ypp b/parser/SqlParser.ypp
index 3f0cc80..547bb40 100644
--- a/parser/SqlParser.ypp
+++ b/parser/SqlParser.ypp
@@ -760,7 +760,7 @@ data_type:
 YYERROR;
   }
   | TOKEN_DATE {
-$$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetime));
+$$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDate));
   }
   | TOKEN_DATETIME {
 $$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetime));

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1d104229/parser/tests/Select.test
--
diff --git a/parser/tests/Select.test b/parser/tests/Select.test
index b614a99..8e47519 100644
--- a/parser/tests/Select.test
+++ b/parser/tests/Select.test
@@ -961,7 +961,7 @@ SelectStatement
   | |   +-StringLiteral[value=1998-12-01]
   | +-SelectListItem
   |   +-Literal
-  | +-StringLiteral[value=1998-12-01,explicit_type=Datetime]
+  | +-StringLiteral[value=1998-12-01,explicit_type=Date]
   +-from_clause=
 +-TableReference[table=test]
 ==
@@ -975,10 +975,10 @@ SelectStatement
   +-select_clause=SelectList
   | +-SelectListItem
   | | +-Literal
-  | |   +-StringLiteral[value=1960-12-12,explicit_type=Datetime]
+  | |   +-StringLiteral[value=1960-12-12,explicit_type=Date]
   | +-SelectListItem
   |   +-Literal
-  | +-StringLiteral[value=1901-12-14,explicit_type=Datetime]
+  | +-StringLiteral[value=1901-12-14,explicit_type=Date]
   +-from_clause=
 +-TableReference[table=test]
 ==
@@ -990,10 +990,10 @@ SelectStatement
   +-select_clause=SelectList
   | +-SelectListItem
   | | +-Literal
-  | |   +-StringLiteral[value=1998-2-12,explicit_type=Datetime]
+  | |   +-StringLiteral[value=1998-2-12,explicit_type=Date]
   | +-SelectListItem
   |   +-Literal
-  | +-StringLiteral[value=1998-12-2,explicit_type=Datetime]
+  | +-StringLiteral[value=1998-12-2,explicit_type=Date]
   +-from_clause=
 +-TableReference[table=test]
 ==
@@ -1007,10 +1007,10 @@ SelectStatement
   +-select_clause=SelectList
   | +-SelectListItem
   | | +-Literal
-  | |   +-StringLiteral[value=+1921-12-12,explicit_type=Datetime]
+  | |   +-StringLiteral[value=+1921-12-12,explicit_type=Date]
   | +-SelectListItem
   |   +-Literal
-  | +-StringLiteral[value=+10001-12-12,explicit_type=Datetime]
+  | +-StringLiteral[value=+10001-12-12,explicit_type=Date]
   +-from_clause=
 +-TableReference[table=test]
 ==
@@ -1059,13 +1059,13 @@ SelectStatement
   +-select_clause=SelectList
   | +-SelectListItem
   | | +-Literal
-  | |   

[1/4] incubator-quickstep git commit: Separate Date type from Datetime type. [Forced Update!]

2016-09-05 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/date-representation 8b450062a -> 2f5b6ddfd (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1d104229/types/operations/unary_operations/tests/DateExtractOperation_unittest.cpp
--
diff --git 
a/types/operations/unary_operations/tests/DateExtractOperation_unittest.cpp 
b/types/operations/unary_operations/tests/DateExtractOperation_unittest.cpp
index ec14408..8f4dfc4 100644
--- a/types/operations/unary_operations/tests/DateExtractOperation_unittest.cpp
+++ b/types/operations/unary_operations/tests/DateExtractOperation_unittest.cpp
@@ -31,6 +31,7 @@
 #include "types/operations/unary_operations/DateExtractOperation.hpp"
 #include "types/operations/unary_operations/UnaryOperation.hpp"
 #include "types/operations/unary_operations/UnaryOperationFactory.hpp"
+#include "utility/EqualsAnyConstant.hpp"
 
 #include "gtest/gtest.h"
 
@@ -44,10 +45,13 @@ namespace quickstep {
 class DateExtractOperationTest : public ::testing::Test {
  protected:
   virtual void SetUp() {
-dt_literal_.ticks = 1431359664 * DatetimeLit::kTicksPerSecond;  // Mon, 11 
May 2015 15:54:24 GMT.
-datetime_.reset(new TypedValue(dt_literal_));
-
+datetime_literal_.ticks = 1431359664 * DatetimeLit::kTicksPerSecond;  // 
Mon, 11 May 2015 15:54:24 GMT.
+datetime_.reset(new TypedValue(datetime_literal_));
 datetime_null_.reset(new TypedValue(kDatetime));
+
+date_literal_ = DateLit::Create(2015, 05, 11);  // 11 May 2015.
+date_.reset(new TypedValue(date_literal_));
+date_null_.reset(new TypedValue(kDate));
   }
 
   void checkDateExtractOperationSerialization(const DateExtractOperation 
) {
@@ -57,7 +61,7 @@ class DateExtractOperationTest : public ::testing::Test {
 
EXPECT_TRUE(operation.equals(UnaryOperationFactory::ReconstructFromProto(proto)));
   }
 
-  void checkDateExtract(int64_t expected, const DateExtractUnit unit) {
+  void checkDatetimeExtract(int64_t expected, const DateExtractUnit unit) {
 const DateExtractOperation  = 
DateExtractOperation::Instance(unit);
 checkDateExtractOperationSerialization(operation);
 
@@ -74,22 +78,42 @@ class DateExtractOperationTest : public ::testing::Test {
 
EXPECT_TRUE(unchecked_operator_->applyToTypedValue(*datetime_null_).isNull());
   }
 
+  void checkDateExtract(int32_t expected, const DateExtractUnit unit) {
+const DateExtractOperation  = 
DateExtractOperation::Instance(unit);
+checkDateExtractOperationSerialization(operation);
+
+EXPECT_EQ(expected,
+  operation.applyToChecked(*date_,
+   TypeFactory::GetType(kDate, 
true)).getLiteral());
+EXPECT_TRUE(operation.applyToChecked(*date_null_,
+ TypeFactory::GetType(kDate, 
true)).isNull());
+
+unchecked_operator_.reset(
+
operation.makeUncheckedUnaryOperatorForType(TypeFactory::GetType(kDate, true)));
+EXPECT_EQ(expected, 
unchecked_operator_->applyToTypedValue(*date_).getLiteral());
+
+EXPECT_TRUE(unchecked_operator_->applyToTypedValue(*date_null_).isNull());
+  }
+
   static void CheckFixedNullableResultTypeForField(const DateExtractUnit 
field) {
 const Type *fixed_result_type
 = DateExtractOperation::Instance(field).fixedNullableResultType();
-ASSERT_NE(fixed_result_type, nullptr);
-EXPECT_TRUE(TypeFactory::GetType(kLong, true).equals(*fixed_result_type));
+ASSERT_EQ(fixed_result_type, nullptr);
   }
 
   static void CheckResultTypeIsPlausibleForField(const DateExtractUnit field) {
-// Only Long is plausible.
+// Long and Int are plausible.
 EXPECT_TRUE(DateExtractOperation::Instance(field).resultTypeIsPlausible(
 TypeFactory::GetType(kLong, false)));
 EXPECT_TRUE(DateExtractOperation::Instance(field).resultTypeIsPlausible(
 TypeFactory::GetType(kLong, true)));
+EXPECT_TRUE(DateExtractOperation::Instance(field).resultTypeIsPlausible(
+TypeFactory::GetType(kInt, false)));
+EXPECT_TRUE(DateExtractOperation::Instance(field).resultTypeIsPlausible(
+TypeFactory::GetType(kInt, true)));
 
 for (const TypeID type_id
- : {kInt, kFloat, kDouble, kDatetime, kDatetimeInterval, 
kYearMonthInterval}) {
+ : {kFloat, kDouble, kDatetime, kDatetimeInterval, 
kYearMonthInterval}) {
   EXPECT_FALSE(DateExtractOperation::Instance(field).resultTypeIsPlausible(
   TypeFactory::GetType(type_id, false)));
   EXPECT_FALSE(DateExtractOperation::Instance(field).resultTypeIsPlausible(
@@ -109,16 +133,34 @@ class DateExtractOperationTest : public ::testing::Test {
   static void CheckPushDownTypeHintForField(const DateExtractUnit field) {
 const UnaryOperation  = DateExtractOperation::Instance(field);
 
-// If hint is Long, then the argument is a Datetime with the same
-// nullability.
+// For nullable types.
 const 

incubator-quickstep git commit: New representation and comparison operators for DateLit. [Forced Update!]

2016-09-02 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/date-representation 998994eee -> 8b450062a (forced update)


New representation and comparison operators for DateLit.


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

Branch: refs/heads/date-representation
Commit: 8b450062ad294f0362f20623825b2c49b1ecfe21
Parents: 3c8708d
Author: Hakan Memisoglu 
Authored: Fri Sep 2 14:53:47 2016 -0500
Committer: Hakan Memisoglu 
Committed: Fri Sep 2 20:43:16 2016 -0500

--
 types/DateOperatorOverloads.hpp | 12 ++---
 types/DateType.cpp  |  8 ++--
 types/DatetimeLit.hpp   | 49 +++-
 types/TypedValue.cpp|  6 +--
 .../unary_operations/DateExtractOperation.cpp   |  2 +-
 5 files changed, 41 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8b450062/types/DateOperatorOverloads.hpp
--
diff --git a/types/DateOperatorOverloads.hpp b/types/DateOperatorOverloads.hpp
index b04f44e..e2e5f6a 100644
--- a/types/DateOperatorOverloads.hpp
+++ b/types/DateOperatorOverloads.hpp
@@ -122,8 +122,8 @@ inline DatetimeLit operator+(const YearMonthIntervalLit 
, const DatetimeLit
 }
 
 inline DateLit operator+(const DateLit , const YearMonthIntervalLit ) {
-  std::int32_t result_year = lhs.year + (rhs.months / 12);
-  std::uint8_t result_month = lhs.month + (rhs.months % 12);
+  std::int32_t result_year = lhs.yearField() + (rhs.months / 12);
+  std::uint8_t result_month = static_cast(lhs.monthField()) + 
(rhs.months % 12);
 
   if (result_month > 11) {
 result_month -= 12;
@@ -131,7 +131,7 @@ inline DateLit operator+(const DateLit , const 
YearMonthIntervalLit ) {
   }
 
   const std::uint8_t result_day = static_cast(
-  ClampDayOfMonth(result_year, result_month, lhs.day));
+  ClampDayOfMonth(result_year, result_month, lhs.dayField()));
 
   return DateLit::Create(result_year, result_month, result_day);
 }
@@ -187,8 +187,8 @@ inline DatetimeLit operator-(const DatetimeLit , const 
YearMonthIntervalLit
 }
 
 inline DateLit operator-(const DateLit , const YearMonthIntervalLit ) {
-  std::int32_t result_year = lhs.year - (rhs.months / 12);
-  std::int8_t result_month = lhs.month - (rhs.months % 12);
+  std::int32_t result_year = lhs.yearField() - (rhs.months / 12);
+  std::int8_t result_month = static_cast(lhs.monthField()) - 
(rhs.months % 12);
 
   if (result_month < 0) {
 --result_year;
@@ -196,7 +196,7 @@ inline DateLit operator-(const DateLit , const 
YearMonthIntervalLit ) {
   }
 
   const std::uint8_t result_day = static_cast(
-  ClampDayOfMonth(result_year, result_month, lhs.day));
+  ClampDayOfMonth(result_year, result_month, lhs.dayField()));
 
   return DateLit::Create(result_year, result_month, result_day);
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8b450062/types/DateType.cpp
--
diff --git a/types/DateType.cpp b/types/DateType.cpp
index 5bb982c..388898e 100644
--- a/types/DateType.cpp
+++ b/types/DateType.cpp
@@ -60,7 +60,7 @@ std::string DateType::printValueToString(const TypedValue 
) const {
   DCHECK(!value.isNull());
 
   const DateLit literal = value.getLiteral();
-  const std::int32_t year = literal.year;
+  const std::int32_t year = literal.yearField();
 
   char datebuf[DateLit::kIsoChars + 1];
   std::size_t chars_written = 0;
@@ -78,9 +78,9 @@ std::string DateType::printValueToString(const TypedValue 
) const {
   // All the rest of the ISO 8601 date/time parts.
   snprintf_result = snprintf(datebuf + chars_written,
  sizeof(datebuf) - chars_written,
- "%02d-%02d",
- literal.month,
- literal.day);
+ "%02u-%02u",
+ literal.monthField(),
+ literal.dayField());
   CheckSnprintf(snprintf_result, sizeof(datebuf), _written);
 
   return std::string(datebuf);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8b450062/types/DatetimeLit.hpp
--
diff --git a/types/DatetimeLit.hpp b/types/DatetimeLit.hpp
index 58c852f..f766b59 100644
--- a/types/DatetimeLit.hpp
+++ b/types/DatetimeLit.hpp
@@ -36,10 +36,13 @@ namespace quickstep {
  * @brief A literal representing 

[4/6] incubator-quickstep git commit: Added unit tests for the distributed version.

2016-08-23 Thread hakanmemisoglu
Added unit tests for the distributed version.


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

Branch: refs/heads/fuse-join-with-select
Commit: cdc1e053b34aff46104397405642cd9c64b7d5f1
Parents: 59f4dab
Author: Zuyu Zhang 
Authored: Sun Aug 14 00:02:20 2016 -0700
Committer: Zuyu Zhang 
Committed: Tue Aug 16 13:33:54 2016 -0700

--
 query_optimizer/tests/CMakeLists.txt|  35 
 .../tests/DistributedExecutionGeneratorTest.cpp |  62 +++
 .../DistributedExecutionGeneratorTestRunner.cpp | 162 +++
 .../DistributedExecutionGeneratorTestRunner.hpp | 118 ++
 .../tests/execution_generator/CMakeLists.txt|  70 
 5 files changed, 447 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cdc1e053/query_optimizer/tests/CMakeLists.txt
--
diff --git a/query_optimizer/tests/CMakeLists.txt 
b/query_optimizer/tests/CMakeLists.txt
index 4969ada..597dbe0 100644
--- a/query_optimizer/tests/CMakeLists.txt
+++ b/query_optimizer/tests/CMakeLists.txt
@@ -80,6 +80,14 @@ 
target_link_libraries(quickstep_queryoptimizer_tests_TestDatabaseLoader
   quickstep_utility_Macros
   tmb)
 
+if (ENABLE_DISTRIBUTED)
+  
add_executable(quickstep_queryoptimizer_tests_DistributedExecutionGeneratorTest
+ DistributedExecutionGeneratorTest.cpp
+ DistributedExecutionGeneratorTestRunner.cpp
+ DistributedExecutionGeneratorTestRunner.hpp
+ 
"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp"
+ 
"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp")
+endif(ENABLE_DISTRIBUTED)
 add_executable(quickstep_queryoptimizer_tests_ExecutionGeneratorTest
ExecutionGeneratorTest.cpp
ExecutionGeneratorTestRunner.cpp
@@ -109,6 +117,33 @@ 
add_executable(quickstep_queryoptimizer_tests_OptimizerTextTest
"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp"

"${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp")
 
+if (ENABLE_DISTRIBUTED)
+  
target_link_libraries(quickstep_queryoptimizer_tests_DistributedExecutionGeneratorTest
+glog
+gtest
+quickstep_catalog_CatalogTypedefs
+quickstep_cli_DropRelation
+quickstep_cli_PrintToScreen
+quickstep_parser_ParseStatement
+quickstep_parser_SqlParserWrapper
+quickstep_queryexecution_ForemanDistributed
+quickstep_queryexecution_QueryExecutionTypedefs
+quickstep_queryexecution_QueryExecutionUtil
+quickstep_queryexecution_Shiftboss
+quickstep_queryexecution_Worker
+quickstep_queryexecution_WorkerDirectory
+quickstep_queryoptimizer_Optimizer
+quickstep_queryoptimizer_OptimizerContext
+quickstep_queryoptimizer_QueryHandle
+quickstep_queryoptimizer_tests_TestDatabaseLoader
+quickstep_utility_Macros
+quickstep_utility_MemStream
+quickstep_utility_SqlError
+quickstep_utility_TextBasedTestDriver
+tmb
+${GFLAGS_LIB_NAME}
+${LIBS})
+endif(ENABLE_DISTRIBUTED)
 target_link_libraries(quickstep_queryoptimizer_tests_ExecutionGeneratorTest
   glog
   gtest

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cdc1e053/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp
--
diff --git a/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp 
b/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp
new file mode 100644
index 000..af310bc
--- /dev/null
+++ b/query_optimizer/tests/DistributedExecutionGeneratorTest.cpp
@@ -0,0 +1,62 @@
+/**
+ * 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
+ * 

[2/6] incubator-quickstep git commit: Refactored OptimizerContext and Optimizer.

2016-08-23 Thread hakanmemisoglu
Refactored OptimizerContext and Optimizer.

  * Construct physical generator in query_optimizer once for all queries.


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

Branch: refs/heads/fuse-join-with-select
Commit: 8c811c85e64ddb9889780ad3467dfc5abbfc9f28
Parents: 8ec99ed
Author: Zuyu Zhang 
Authored: Sat Aug 13 01:49:03 2016 -0700
Committer: Zuyu Zhang 
Committed: Tue Aug 16 13:26:38 2016 -0700

--
 cli/tests/CMakeLists.txt|  8 +---
 cli/tests/CommandExecutorTestRunner.cpp | 35 ++
 cli/tests/CommandExecutorTestRunner.hpp |  2 +
 query_optimizer/CMakeLists.txt  |  2 +-
 query_optimizer/ExecutionGenerator.cpp  | 35 +-
 query_optimizer/ExecutionGenerator.hpp  | 12 +++---
 query_optimizer/LogicalGenerator.cpp|  3 +-
 query_optimizer/LogicalGenerator.hpp|  5 ++-
 query_optimizer/Optimizer.cpp   | 12 +++---
 query_optimizer/Optimizer.hpp   | 26 +
 query_optimizer/OptimizerContext.hpp| 39 +---
 query_optimizer/QueryProcessor.cpp  |  7 ++--
 query_optimizer/QueryProcessor.hpp  |  3 ++
 query_optimizer/resolver/Resolver.cpp   |  4 +-
 query_optimizer/resolver/Resolver.hpp   |  8 +++-
 query_optimizer/tests/CMakeLists.txt| 12 +-
 .../tests/ExecutionGeneratorTestRunner.cpp  | 35 +-
 .../tests/ExecutionGeneratorTestRunner.hpp  |  3 +-
 query_optimizer/tests/OptimizerTest.cpp |  3 +-
 .../tests/OptimizerTextTestRunner.cpp   |  9 ++---
 20 files changed, 93 insertions(+), 170 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8c811c85/cli/tests/CMakeLists.txt
--
diff --git a/cli/tests/CMakeLists.txt b/cli/tests/CMakeLists.txt
index 3bceba8..99fa3a3 100644
--- a/cli/tests/CMakeLists.txt
+++ b/cli/tests/CMakeLists.txt
@@ -36,19 +36,13 @@ 
target_link_libraries(quickstep_cli_tests_CommandExecutorTest
   quickstep_parser_SqlParserWrapper
   quickstep_queryexecution_AdmitRequestMessage
   quickstep_queryexecution_ForemanSingleNode
-  quickstep_queryexecution_QueryContext
   quickstep_queryexecution_QueryExecutionTypedefs
   quickstep_queryexecution_QueryExecutionUtil
   quickstep_queryexecution_Worker
   quickstep_queryexecution_WorkerDirectory
-  quickstep_queryexecution_WorkerMessage
-  quickstep_queryoptimizer_ExecutionGenerator
-  quickstep_queryoptimizer_LogicalGenerator
+  quickstep_queryoptimizer_Optimizer
   quickstep_queryoptimizer_OptimizerContext
-  quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_QueryHandle
-  quickstep_queryoptimizer_QueryPlan
-  quickstep_queryoptimizer_physical_Physical
   quickstep_queryoptimizer_tests_TestDatabaseLoader
   quickstep_utility_Macros
   quickstep_utility_MemStream

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8c811c85/cli/tests/CommandExecutorTestRunner.cpp
--
diff --git a/cli/tests/CommandExecutorTestRunner.cpp 
b/cli/tests/CommandExecutorTestRunner.cpp
index 9c701cd..41cc9da 100644
--- a/cli/tests/CommandExecutorTestRunner.cpp
+++ b/cli/tests/CommandExecutorTestRunner.cpp
@@ -31,17 +31,10 @@
 #include "query_execution/AdmitRequestMessage.hpp"
 #include "query_execution/ForemanSingleNode.hpp"
 #include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/Worker.hpp"
-#include "query_optimizer/ExecutionGenerator.hpp"
-#include "query_optimizer/LogicalGenerator.hpp"
+#include "query_optimizer/Optimizer.hpp"
 #include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/PhysicalGenerator.hpp"
 #include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Macros.hpp"
 #include "utility/MemStream.hpp"
-#include "utility/PtrList.hpp"
 #include "utility/SqlError.hpp"
 
 #include "glog/logging.h"
@@ -53,8 +46,6 @@ namespace quickstep {
 

[5/6] incubator-quickstep git commit: Initial commit.

2016-08-23 Thread hakanmemisoglu
Initial commit.


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

Branch: refs/heads/fuse-join-with-select
Commit: 8427d06842a38c8f97bc5a0115b9e48ee97784aa
Parents: cdc1e05
Author: Hakan Memisoglu 
Authored: Tue Aug 16 16:40:27 2016 -0500
Committer: hakanmem 

Committed: Tue Aug 23 13:57:22 2016 -0500

--
 query_optimizer/CMakeLists.txt|  1 +
 query_optimizer/ExecutionGenerator.cpp|  9 ++
 query_optimizer/PhysicalGenerator.cpp |  2 ++
 query_optimizer/physical/HashJoin.cpp |  5 +++
 query_optimizer/physical/HashJoin.hpp | 18 ---
 query_optimizer/rules/CMakeLists.txt  | 11 +++
 query_optimizer/rules/FuseJoinSelect.cpp  | 43 ++
 query_optimizer/rules/FuseJoinSelect.hpp  | 33 
 relational_operators/HashJoinOperator.cpp | 13 +++-
 relational_operators/HashJoinOperator.hpp | 12 +++
 relational_operators/WorkOrder.proto  |  1 +
 storage/StorageBlock.hpp  | 10 --
 12 files changed, 151 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8427d068/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 56ae52f..b0bc38b 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -195,6 +195,7 @@ 
target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_LogicalToPhysicalMapper
   quickstep_queryoptimizer_logical_Logical
   quickstep_queryoptimizer_physical_Physical
+  quickstep_queryoptimizer_rules_FuseJoinSelect
   quickstep_queryoptimizer_rules_PruneColumns
   
quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
   quickstep_queryoptimizer_rules_SwapProbeBuild

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8427d068/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 2e03e09..c5f3005 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -683,6 +683,14 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 
query_context_proto_->add_predicates()->CopyFrom(residual_predicate->getProto());
   }
 
+  // Convert the left filter predicate proto.
+  QueryContext::predicate_id left_filter_predicate_index = 
QueryContext::kInvalidPredicateId;
+  if (physical_plan->residual_predicate()) {
+left_filter_predicate_index = query_context_proto_->predicates_size();
+unique_ptr 
left_filter_predicate(convertPredicate(physical_plan->left_filter_predicate()));
+
query_context_proto_->add_predicates()->CopyFrom(left_filter_predicate->getProto());
+  }
+
   // Convert the project expressions proto.
   const QueryContext::scalar_group_id project_expressions_group_index =
   query_context_proto_->scalar_groups_size();
@@ -787,6 +795,7 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
   insert_destination_index,
   join_hash_table_index,
   residual_predicate_index,
+  left_filter_predicate_index,
   project_expressions_group_index,
   is_selection_on_build.get(),
   join_type));

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8427d068/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 8f19702..6ad1f8c 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -26,6 +26,7 @@
 #include "query_optimizer/Validator.hpp"
 #include "query_optimizer/logical/Logical.hpp"
 #include "query_optimizer/physical/Physical.hpp"
+#include "query_optimizer/rules/FuseJoinSelect.hpp"
 #include "query_optimizer/rules/PruneColumns.hpp"
 #include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
 #include "query_optimizer/rules/SwapProbeBuild.hpp"
@@ -100,6 +101,7 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
   }
   rules.emplace_back(new PruneColumns());
   

[3/6] incubator-quickstep git commit: Minor fixes to the distributed query execution engine.

2016-08-23 Thread hakanmemisoglu
Minor fixes to the distributed query execution engine.


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

Branch: refs/heads/fuse-join-with-select
Commit: 59f4dab26aa31a7e2aa9dfdc60524e56060f935b
Parents: 8c811c8
Author: Zuyu Zhang 
Authored: Tue Aug 16 13:17:01 2016 -0700
Committer: Zuyu Zhang 
Committed: Tue Aug 16 13:30:41 2016 -0700

--
 query_execution/ForemanDistributed.cpp  | 2 +-
 query_execution/ForemanDistributed.hpp  | 2 +-
 query_execution/QueryManagerDistributed.cpp | 2 +-
 query_execution/QueryManagerDistributed.hpp | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/ForemanDistributed.cpp
--
diff --git a/query_execution/ForemanDistributed.cpp 
b/query_execution/ForemanDistributed.cpp
index 29f5b9b..9c20465 100644
--- a/query_execution/ForemanDistributed.cpp
+++ b/query_execution/ForemanDistributed.cpp
@@ -279,7 +279,7 @@ void 
ForemanDistributed::printWorkOrderProfilingResults(const std::size_t query_
 }
 
 void ForemanDistributed::processShiftbossRegistrationMessage(const client_id 
shiftboss_client_id,
-  const 
std::size_t work_order_capacity) {
+ const std::size_t 
work_order_capacity) {
   S::ShiftbossRegistrationResponseMessage proto;
   proto.set_shiftboss_index(shiftboss_directory_.size());
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/ForemanDistributed.hpp
--
diff --git a/query_execution/ForemanDistributed.hpp 
b/query_execution/ForemanDistributed.hpp
index f9a326a..fc1ede5 100644
--- a/query_execution/ForemanDistributed.hpp
+++ b/query_execution/ForemanDistributed.hpp
@@ -102,7 +102,7 @@ class ForemanDistributed final : public ForemanBase {
 const serialization::WorkOrderMessage );
 
   void processShiftbossRegistrationMessage(const tmb::client_id 
shiftboss_client_id,
-const std::size_t 
work_order_capacity);
+   const std::size_t 
work_order_capacity);
 
   void processSaveQueryResultResponseMessage(const tmb::client_id cli_id,
  const relation_id 
result_relation_id);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/QueryManagerDistributed.cpp
--
diff --git a/query_execution/QueryManagerDistributed.cpp 
b/query_execution/QueryManagerDistributed.cpp
index e300ce5..7d45933 100644
--- a/query_execution/QueryManagerDistributed.cpp
+++ b/query_execution/QueryManagerDistributed.cpp
@@ -47,7 +47,7 @@ using std::unique_ptr;
 namespace quickstep {
 
 QueryManagerDistributed::QueryManagerDistributed(QueryHandle *query_handle,
- ShiftbossDirectory 
*shiftboss_directory,
+ const ShiftbossDirectory 
*shiftboss_directory,
  const tmb::client_id 
foreman_client_id,
  tmb::MessageBus *bus)
 : QueryManagerBase(query_handle),

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/59f4dab2/query_execution/QueryManagerDistributed.hpp
--
diff --git a/query_execution/QueryManagerDistributed.hpp 
b/query_execution/QueryManagerDistributed.hpp
index b448528..e609ab8 100644
--- a/query_execution/QueryManagerDistributed.hpp
+++ b/query_execution/QueryManagerDistributed.hpp
@@ -58,7 +58,7 @@ class QueryManagerDistributed final : public QueryManagerBase 
{
* @param bus The TMB used for communication.
**/
   QueryManagerDistributed(QueryHandle *query_handle,
-  ShiftbossDirectory *shiftboss_directory,
+  const ShiftbossDirectory *shiftboss_directory,
   const tmb::client_id foreman_client_id,
   tmb::MessageBus *bus);
 
@@ -105,7 +105,7 @@ class QueryManagerDistributed final : public 
QueryManagerBase {
(query_exec_state_->getNumRebuildWorkOrders(index) == 0);
   }
 
-  ShiftbossDirectory *shiftboss_directory_;
+  const 

incubator-quickstep git commit: Initial commit

2016-08-21 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/columnvector-append [created] b430e77ad


Initial commit


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

Branch: refs/heads/columnvector-append
Commit: b430e77adace7a04870d3e6c9c805c43c4a8b5d7
Parents: cdc1e05
Author: Hakan Memisoglu 
Authored: Sun Aug 21 12:16:21 2016 -0500
Committer: Hakan Memisoglu 
Committed: Sun Aug 21 12:16:21 2016 -0500

--
 relational_operators/HashJoinOperator.cpp   | 20 +
 types/containers/ColumnVector.hpp   | 43 +++-
 types/containers/ColumnVectorsValueAccessor.hpp | 14 +++
 3 files changed, 68 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b430e77a/relational_operators/HashJoinOperator.cpp
--
diff --git a/relational_operators/HashJoinOperator.cpp 
b/relational_operators/HashJoinOperator.cpp
index 779c0fe..14fc0f6 100644
--- a/relational_operators/HashJoinOperator.cpp
+++ b/relational_operators/HashJoinOperator.cpp
@@ -441,6 +441,7 @@ void HashInnerJoinWorkOrder::execute() {
   const relation_id build_relation_id = build_relation_.getID();
   const relation_id probe_relation_id = probe_relation_.getID();
 
+  ColumnVectorsValueAccessor temp_result;
   for (std::pair>>
_block_entry : *collector.getJoinedTuples()) {
 BlockReference build_block =
@@ -492,23 +493,26 @@ void HashInnerJoinWorkOrder::execute() {
 // benefit (probably only a real performance win when there are very few
 // matching tuples in each individual inner block but very many inner
 // blocks with at least one match).
-ColumnVectorsValueAccessor temp_result;
+//ColumnVectorsValueAccessor temp_result;
+std::size_t i = 0;
 for (vector::const_iterator selection_cit = 
selection_.begin();
  selection_cit != selection_.end();
- ++selection_cit) {
-  
temp_result.addColumn((*selection_cit)->getAllValuesForJoin(build_relation_id,
-  
build_accessor.get(),
-  
probe_relation_id,
-  
probe_accessor.get(),
-  
build_block_entry.second));
+ ++selection_cit, ++i) {
+  
temp_result.appendColumn((*selection_cit)->getAllValuesForJoin(build_relation_id,
+ 
build_accessor.get(),
+ 
probe_relation_id,
+ 
probe_accessor.get(),
+ 
build_block_entry.second),
+   i);
 }
 
 // NOTE(chasseur): calling the bulk-insert method of InsertDestination once
 // for each pair of joined blocks incurs some extra overhead that could be
 // avoided by keeping checked-out MutableBlockReferences across iterations
 // of this loop, but that would get messy when combined with partitioning.
-output_destination_->bulkInsertTuples(_result);
+//output_destination_->bulkInsertTuples(_result);
   }
+  output_destination_->bulkInsertTuples(_result);
 }
 
 void HashSemiJoinWorkOrder::execute() {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b430e77a/types/containers/ColumnVector.hpp
--
diff --git a/types/containers/ColumnVector.hpp 
b/types/containers/ColumnVector.hpp
index fc65656..3953a7f 100644
--- a/types/containers/ColumnVector.hpp
+++ b/types/containers/ColumnVector.hpp
@@ -107,6 +107,8 @@ class ColumnVector {
**/
   virtual bool isNative() const = 0;
 
+  virtual bool append(ColumnVector *column_vector) = 0;
+
  protected:
   const Type _;
 
@@ -383,10 +385,45 @@ class NativeColumnVector : public ColumnVector {
 }
   }
 
+  bool append(ColumnVector *column_vector) override {
+// Other ColumnVector also has to be native.
+if (!column_vector->isNative()) {
+  return false;
+}
+NativeColumnVector *casted_column_vector = 
static_cast(column_vector);
+// Both ColumnVectors has to have same type to be appended.
+if (!type_.equals(casted_column_vector->type_)
+|| 

incubator-quickstep git commit: Fixed the bug.

2016-08-17 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/fuse-join-with-select e763de0ef -> 29ded9efd


Fixed the bug.


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

Branch: refs/heads/fuse-join-with-select
Commit: 29ded9efd2c31b65ca4b4b531d45dcad98a08d88
Parents: e763de0
Author: Hakan Memisoglu 
Authored: Wed Aug 17 14:39:40 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Aug 17 14:39:40 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/29ded9ef/query_optimizer/rules/FuseJoinSelect.cpp
--
diff --git a/query_optimizer/rules/FuseJoinSelect.cpp 
b/query_optimizer/rules/FuseJoinSelect.cpp
index 6a8885f..e40acfc 100644
--- a/query_optimizer/rules/FuseJoinSelect.cpp
+++ b/query_optimizer/rules/FuseJoinSelect.cpp
@@ -23,8 +23,8 @@ P::PhysicalPtr FuseJoinSelect::applyToNode(const 
P::PhysicalPtr ) {
   && P::SomeSelection::MatchesWithConditionalCast(hash_join->left(), 
)
   && P::SomeTableReference::MatchesWithConditionalCast(selection->input(), 
_reference)) {
 const E::PredicatePtr filter_predicate = selection->filter_predicate();
-P::PhysicalPtr output = P::HashJoin::Create(hash_join->left(),
-table_reference,
+P::PhysicalPtr output = P::HashJoin::Create(table_reference,
+hash_join->right(),
 
hash_join->left_join_attributes(),
 
hash_join->right_join_attributes(),
 
hash_join->residual_predicate(),



incubator-quickstep git commit: Applied fixes.

2016-08-03 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/refactor-hashjoin-probe-build c36bbc92d -> 7c5bdf92e


Applied fixes.


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

Branch: refs/heads/refactor-hashjoin-probe-build
Commit: 7c5bdf92e578d0815100bac0fe258e36b8876eae
Parents: c36bbc9
Author: Hakan Memisoglu 
Authored: Wed Aug 3 01:54:09 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Aug 3 01:54:09 2016 -0500

--
 query_optimizer/rules/BottomUpRule.hpp | 8 +++-
 query_optimizer/rules/CollapseProject.cpp  | 5 -
 query_optimizer/rules/CollapseProject.hpp  | 1 -
 query_optimizer/rules/SwapProbeBuild.cpp   | 3 +--
 query_optimizer/rules/SwapProbeBuild.hpp   | 1 +
 query_optimizer/rules/UnnestSubqueries.cpp | 4 
 query_optimizer/rules/UnnestSubqueries.hpp | 1 -
 query_optimizer/rules/UpdateExpression.cpp | 5 -
 query_optimizer/rules/UpdateExpression.hpp | 1 -
 9 files changed, 9 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7c5bdf92/query_optimizer/rules/BottomUpRule.hpp
--
diff --git a/query_optimizer/rules/BottomUpRule.hpp 
b/query_optimizer/rules/BottomUpRule.hpp
index 5831fa0..251ad0c 100644
--- a/query_optimizer/rules/BottomUpRule.hpp
+++ b/query_optimizer/rules/BottomUpRule.hpp
@@ -81,7 +81,13 @@ class BottomUpRule : public Rule {
*/
   virtual TreeNodePtr applyToNode(const TreeNodePtr ) = 0;
 
-  virtual void init(const TreeNodePtr ) = 0;
+  /**
+   * @brief Initialization code to be used for each node.
+   *
+   * @param node The node to apply the initialization logic.
+   */
+  virtual void init(const TreeNodePtr ) {
+  }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(BottomUpRule);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7c5bdf92/query_optimizer/rules/CollapseProject.cpp
--
diff --git a/query_optimizer/rules/CollapseProject.cpp 
b/query_optimizer/rules/CollapseProject.cpp
index 62567e8..6f2fa13 100644
--- a/query_optimizer/rules/CollapseProject.cpp
+++ b/query_optimizer/rules/CollapseProject.cpp
@@ -54,10 +54,5 @@ L::LogicalPtr CollapseProject::applyToNode(const 
L::LogicalPtr ) {
   return input;
 }
 
-void CollapseProject::init(const L::LogicalPtr ) {
-  // Do nothing.
-  return;
-}
-
 }  // namespace optimizer
 }  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7c5bdf92/query_optimizer/rules/CollapseProject.hpp
--
diff --git a/query_optimizer/rules/CollapseProject.hpp 
b/query_optimizer/rules/CollapseProject.hpp
index 528e3c7..db45864 100644
--- a/query_optimizer/rules/CollapseProject.hpp
+++ b/query_optimizer/rules/CollapseProject.hpp
@@ -43,7 +43,6 @@ class CollapseProject : public BottomUpRule 
{
 
  protected:
   logical::LogicalPtr applyToNode(const logical::LogicalPtr ) override;
-  void init(const logical::LogicalPtr ) override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(CollapseProject);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7c5bdf92/query_optimizer/rules/SwapProbeBuild.cpp
--
diff --git a/query_optimizer/rules/SwapProbeBuild.cpp 
b/query_optimizer/rules/SwapProbeBuild.cpp
index 86c6424..5e4ae11 100644
--- a/query_optimizer/rules/SwapProbeBuild.cpp
+++ b/query_optimizer/rules/SwapProbeBuild.cpp
@@ -1,6 +1,7 @@
 #include "query_optimizer/rules/SwapProbeBuild.hpp"
 
 #include 
+#include 
 #include 
 
 #include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp"
@@ -23,8 +24,6 @@ P::PhysicalPtr SwapProbeBuild::applyToNode(const 
P::PhysicalPtr ) {
 P::PhysicalPtr left = hash_join->left();
 P::PhysicalPtr right = hash_join->right();
 
-
-
 std::size_t left_cardinality = cost_model_->estimateCardinality(left);
 std::size_t right_cardinality = cost_model_->estimateCardinality(right);
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/7c5bdf92/query_optimizer/rules/SwapProbeBuild.hpp
--
diff --git a/query_optimizer/rules/SwapProbeBuild.hpp 
b/query_optimizer/rules/SwapProbeBuild.hpp
index 4f7fe38..da8fdf9 100644
--- a/query_optimizer/rules/SwapProbeBuild.hpp
+++ b/query_optimizer/rules/SwapProbeBuild.hpp
@@ -1,6 +1,7 @@
 #ifndef QUICKSTEP_QUERY_OPTIMIZER_RULES_SWAP_PROBE_BUILD_HPP_
 #define 

[1/2] incubator-quickstep git commit: Implemented hashjoin optimization class and removed the logic from ExecutionGenerator.

2016-08-01 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/refactor-hashjoin-probe-build [created] a0905647b


Implemented hashjoin optimization class and removed the logic from 
ExecutionGenerator.


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

Branch: refs/heads/refactor-hashjoin-probe-build
Commit: 372902dd706f9e328dde3709532b5fbf111fdf24
Parents: 260b862
Author: Hakan Memisoglu 
Authored: Mon Aug 1 16:39:07 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Aug 1 16:39:07 2016 -0500

--
 query_optimizer/CMakeLists.txt   |  1 +
 query_optimizer/ExecutionGenerator.cpp   | 17 
 query_optimizer/PhysicalGenerator.cpp|  2 +
 query_optimizer/rules/CMakeLists.txt | 12 ++
 query_optimizer/rules/SwapProbeBuild.cpp | 57 +++
 query_optimizer/rules/SwapProbeBuild.hpp | 46 +
 6 files changed, 118 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/372902dd/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index a56b714..c55881f 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -199,6 +199,7 @@ 
target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_physical_Physical
   quickstep_queryoptimizer_rules_PruneColumns
   
quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
+  quickstep_queryoptimizer_rules_SwapProbeBuild
   quickstep_queryoptimizer_strategy_Aggregate
   quickstep_queryoptimizer_strategy_Join
   quickstep_queryoptimizer_strategy_OneToOne

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/372902dd/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 88103df..cd6a7c6 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -671,23 +671,6 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 key_types.push_back(_attribute_type);
   }
 
-  std::size_t probe_cardinality = 
cost_model_->estimateCardinality(probe_physical);
-  std::size_t build_cardinality = 
cost_model_->estimateCardinality(build_physical);
-  // For inner join, we may swap the probe table and the build table.
-  if (physical_plan->join_type() == P::HashJoin::JoinType::kInnerJoin)  {
-// Choose the smaller table as the inner build table,
-// and the other one as the outer probe table.
-if (probe_cardinality < build_cardinality) {
-  // Switch the probe and build physical nodes.
-  std::swap(probe_physical, build_physical);
-  std::swap(probe_cardinality, build_cardinality);
-  std::swap(probe_attribute_ids, build_attribute_ids);
-  std::swap(any_probe_attributes_nullable, any_build_attributes_nullable);
-  std::swap(probe_original_attribute_ids, build_original_attribute_ids);
-  std::swap(referenced_stored_probe_relation, 
referenced_stored_build_relation);
-}
-  }
-
   // Convert the residual predicate proto.
   QueryContext::predicate_id residual_predicate_index = 
QueryContext::kInvalidPredicateId;
   if (physical_plan->residual_predicate()) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/372902dd/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 75a7bc9..897b212 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -28,6 +28,7 @@
 #include "query_optimizer/physical/Physical.hpp"
 #include "query_optimizer/rules/PruneColumns.hpp"
 #include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
+#include "query_optimizer/rules/SwapProbeBuild.hpp"
 #include "query_optimizer/strategy/Aggregate.hpp"
 #include "query_optimizer/strategy/Join.hpp"
 #include "query_optimizer/strategy/OneToOne.hpp"
@@ -98,6 +99,7 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
 rules.emplace_back(new StarSchemaHashJoinOrderOptimization());
   }
   rules.emplace_back(new PruneColumns());
+  rules.emplace_back(new SwapProbeBuild());

[2/2] incubator-quickstep git commit: Added a field in Physical HashJoin to save right(build) side estimated cardinality.

2016-08-01 Thread hakanmemisoglu
Added a field in Physical HashJoin to save right(build) side estimated 
cardinality.


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

Branch: refs/heads/refactor-hashjoin-probe-build
Commit: a0905647b783873d8c5ff7b5f17c6fa66f357e36
Parents: 372902d
Author: Hakan Memisoglu 
Authored: Mon Aug 1 17:24:47 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Aug 1 17:24:47 2016 -0500

--
 query_optimizer/ExecutionGenerator.cpp   |  2 +-
 query_optimizer/physical/HashJoin.hpp| 33 +++
 query_optimizer/rules/SwapProbeBuild.cpp | 17 +-
 3 files changed, 45 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a0905647/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index cd6a7c6..83c90bd 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -727,7 +727,7 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 
build_relation->getAttributeById(build_attribute)->getType().getProto());
   }
 
-  hash_table_proto->set_estimated_num_entries(build_cardinality);
+  
hash_table_proto->set_estimated_num_entries(physical_plan->estimated_right_cardinality());
 
   // Create three operators.
   const QueryPlan::DAGNodeIndex build_operator_index =

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/a0905647/query_optimizer/physical/HashJoin.hpp
--
diff --git a/query_optimizer/physical/HashJoin.hpp 
b/query_optimizer/physical/HashJoin.hpp
index b904b5f..9c2e9de 100644
--- a/query_optimizer/physical/HashJoin.hpp
+++ b/query_optimizer/physical/HashJoin.hpp
@@ -20,6 +20,7 @@
 #ifndef QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_HASHJOIN_HPP_
 #define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_HASHJOIN_HPP_
 
+#include 
 #include 
 #include 
 #include 
@@ -106,6 +107,22 @@ class HashJoin : public BinaryJoin {
 return join_type_;
   }
 
+  /**
+   * @return Estimated number of tuples from the right (build)'s side.
+   */
+  std::size_t estimated_right_cardinality() const {
+return estimated_right_cardinality_;
+  }
+
+  /**
+   * @brief Sets the build side cardinality for using as a hint in a later 
stage.
+   *
+   * @param estimated_right_cardinality New build side estimated cardinality 
to be set.
+   */
+  void set_estimated_right_cardinality(const std::size_t 
estimated_right_cardinality) {
+estimated_right_cardinality_ = estimated_right_cardinality;
+  }
+
   PhysicalPtr copyWithNewChildren(
   const std::vector _children) const override {
 DCHECK_EQ(children().size(), new_children.size());
@@ -115,7 +132,8 @@ class HashJoin : public BinaryJoin {
   right_join_attributes_,
   residual_predicate_,
   project_expressions(),
-  join_type_);
+  join_type_,
+  estimated_right_cardinality_);
   }
 
   std::vector getReferencedAttributes() 
const override;
@@ -144,7 +162,8 @@ class HashJoin : public BinaryJoin {
   const std::vector 
_join_attributes,
   const expressions::PredicatePtr _predicate,
   const std::vector _expressions,
-  const JoinType join_type) {
+  const JoinType join_type,
+  const std::size_t estimated_right_cardinality = 0u) {
 return HashJoinPtr(
 new HashJoin(left,
  right,
@@ -152,7 +171,8 @@ class HashJoin : public BinaryJoin {
  right_join_attributes,
  residual_predicate,
  project_expressions,
- join_type));
+ join_type,
+ estimated_right_cardinality));
   }
 
  protected:
@@ -172,18 +192,21 @@ class HashJoin : public BinaryJoin {
   const std::vector 
_join_attributes,
   const expressions::PredicatePtr _predicate,
   const std::vector _expressions,
-  const JoinType join_type)
+  const JoinType join_type,
+  const std::size_t estimated_right_cardinality)
   : BinaryJoin(left, right, project_expressions),
 left_join_attributes_(left_join_attributes),
 right_join_attributes_(right_join_attributes),
 residual_predicate_(residual_predicate),
-join_type_(join_type) {
+join_type_(join_type),
+

incubator-quickstep git commit: Moved hash swap logic from ExecutionGenerator to physical optimization.

2016-07-27 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/selection-probe-fuse 8f705ed54 -> e7232c13d


Moved hash swap logic from ExecutionGenerator to physical optimization.


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

Branch: refs/heads/selection-probe-fuse
Commit: e7232c13d28e9ff784376fbf19de297328012ea6
Parents: 8f705ed
Author: Hakan Memisoglu 
Authored: Thu Jul 28 00:16:08 2016 -0500
Committer: Hakan Memisoglu 
Committed: Thu Jul 28 00:16:08 2016 -0500

--
 query_optimizer/CMakeLists.txt   |  1 +
 query_optimizer/ExecutionGenerator.cpp   |  5 ++-
 query_optimizer/PhysicalGenerator.cpp|  3 ++
 query_optimizer/physical/HashJoin.cpp|  6 +--
 query_optimizer/physical/HashJoin.hpp|  8 ++--
 query_optimizer/rules/CMakeLists.txt |  1 +
 query_optimizer/rules/FuseJoinSelect.cpp |  3 +-
 query_optimizer/rules/SwapProbeBuild.cpp | 53 +++
 query_optimizer/rules/SwapProbeBuild.hpp | 38 +++
 9 files changed, 108 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/e7232c13/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 65368c3..9e405ae 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -198,6 +198,7 @@ 
target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_rules_FuseJoinSelect
   quickstep_queryoptimizer_rules_PruneColumns
   
quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
+  quickstep_queryoptimizer_rules_SwapProbeBuild
   quickstep_queryoptimizer_strategy_Aggregate
   quickstep_queryoptimizer_strategy_Join
   quickstep_queryoptimizer_strategy_OneToOne

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/e7232c13/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 9f6c5f2..ce8ab97 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -669,6 +669,7 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 key_types.push_back(_attribute_type);
   }
 
+  /**
   std::size_t probe_cardinality = 
cost_model_->estimateCardinality(probe_physical);
   std::size_t build_cardinality = 
cost_model_->estimateCardinality(build_physical);
   // For inner join, we may swap the probe table and the build table.
@@ -685,6 +686,7 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
   std::swap(referenced_stored_probe_relation, 
referenced_stored_build_relation);
 }
   }
+  **/
 
   // Convert the residual predicate proto.
   QueryContext::predicate_id residual_predicate_index = 
QueryContext::kInvalidPredicateId;
@@ -749,7 +751,8 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 
build_relation->getAttributeById(build_attribute)->getType().getProto());
   }
 
-  hash_table_proto->set_estimated_num_entries(build_cardinality);
+  // hash_table_proto->set_estimated_num_entries(build_cardinality);
+  hash_table_proto->set_estimated_num_entries(0);
 
   // Create three operators.
   const QueryPlan::DAGNodeIndex build_operator_index =

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/e7232c13/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 41d33a9..db6b33c 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -29,6 +29,7 @@
 #include "query_optimizer/rules/FuseJoinSelect.hpp"
 #include "query_optimizer/rules/PruneColumns.hpp"
 #include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
+#include "query_optimizer/rules/SwapProbeBuild.hpp"
 #include "query_optimizer/strategy/Aggregate.hpp"
 #include "query_optimizer/strategy/Join.hpp"
 #include "query_optimizer/strategy/OneToOne.hpp"
@@ -100,6 +101,8 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
   }
   rules.emplace_back(new PruneColumns());
 
+  rules.emplace_back(new SwapProbeBuild());
+
   rules.emplace_back(new 

incubator-quickstep git commit: Additional changes for adding fuse optimization: Changed HashJoinWorkOrder layout etc.

2016-07-27 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/selection-probe-fuse 590b6f012 -> 8f705ed54


Additional changes for adding fuse optimization: Changed HashJoinWorkOrder 
layout etc.


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

Branch: refs/heads/selection-probe-fuse
Commit: 8f705ed54ff6f0e3eadb37e48506d74839f33eaf
Parents: 590b6f0
Author: Hakan Memisoglu 
Authored: Wed Jul 27 11:50:56 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Jul 27 11:50:56 2016 -0500

--
 query_optimizer/CMakeLists.txt|  1 +
 query_optimizer/ExecutionGenerator.cpp|  9 -
 query_optimizer/PhysicalGenerator.cpp |  3 +-
 query_optimizer/physical/HashJoin.cpp |  6 +++
 query_optimizer/physical/HashJoin.hpp | 34 -
 query_optimizer/rules/FuseJoinSelect.cpp  | 51 ++
 query_optimizer/rules/FuseJoinSelect.hpp  | 13 +--
 relational_operators/HashJoinOperator.cpp |  6 ++-
 relational_operators/HashJoinOperator.hpp | 20 --
 9 files changed, 99 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8f705ed5/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 7e53b9d..65368c3 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -195,6 +195,7 @@ 
target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_LogicalToPhysicalMapper
   quickstep_queryoptimizer_logical_Logical
   quickstep_queryoptimizer_physical_Physical
+  quickstep_queryoptimizer_rules_FuseJoinSelect
   quickstep_queryoptimizer_rules_PruneColumns
   
quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
   quickstep_queryoptimizer_strategy_Aggregate

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8f705ed5/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index ac8dc62..9f6c5f2 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -695,6 +695,13 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
 
query_context_proto_->add_predicates()->CopyFrom(residual_predicate->getProto());
   }
 
+  QueryContext::predicate_id filter_predicate_index = 
QueryContext::kInvalidPredicateId;
+  if (physical_plan->filter_predicate()) {
+filter_predicate_index = query_context_proto_->predicates_size();
+unique_ptr 
filter_predicate(convertPredicate(physical_plan->filter_predicate()));
+
query_context_proto_->add_predicates()->CopyFrom(filter_predicate->getProto());
+  }
+
   // Convert the project expressions proto.
   const QueryContext::scalar_group_id project_expressions_group_index =
   query_context_proto_->scalar_groups_size();
@@ -802,7 +809,7 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
   project_expressions_group_index,
   is_selection_on_build.get(),
   join_type,
-  nullptr /* filter predicate */));
+  filter_predicate_index));
   insert_destination_proto->set_relational_op_index(join_operator_index);
 
   const QueryPlan::DAGNodeIndex destroy_operator_index =

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8f705ed5/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 731c17d..41d33a9 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -26,6 +26,7 @@
 #include "query_optimizer/Validator.hpp"
 #include "query_optimizer/logical/Logical.hpp"
 #include "query_optimizer/physical/Physical.hpp"
+#include "query_optimizer/rules/FuseJoinSelect.hpp"
 #include "query_optimizer/rules/PruneColumns.hpp"
 #include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
 #include "query_optimizer/strategy/Aggregate.hpp"
@@ -99,7 +100,7 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
   }
   rules.emplace_back(new PruneColumns());
 
-  rules.emplace_back(new Fuse());
+  rules.emplace_back(new 

incubator-quickstep git commit: Initial changes.

2016-07-26 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/selection-probe-fuse [created] 590b6f012


Initial changes.


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

Branch: refs/heads/selection-probe-fuse
Commit: 590b6f0121eae695743a213353a422951d77e572
Parents: 2b78380
Author: Hakan Memisoglu 
Authored: Tue Jul 26 13:44:49 2016 -0500
Committer: Hakan Memisoglu 
Committed: Tue Jul 26 13:44:49 2016 -0500

--
 query_optimizer/ExecutionGenerator.cpp|  3 +-
 query_optimizer/PhysicalGenerator.cpp |  2 ++
 query_optimizer/physical/HashJoin.hpp |  2 ++
 query_optimizer/rules/CMakeLists.txt  |  1 +
 query_optimizer/rules/FuseJoinSelect.cpp  | 41 ++
 query_optimizer/rules/FuseJoinSelect.hpp  | 26 
 relational_operators/HashJoinOperator.cpp | 41 +-
 relational_operators/HashJoinOperator.hpp | 29 +-
 8 files changed, 130 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/590b6f01/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 43d63f9..ac8dc62 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -801,7 +801,8 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
   residual_predicate_index,
   project_expressions_group_index,
   is_selection_on_build.get(),
-  join_type));
+  join_type,
+  nullptr /* filter predicate */));
   insert_destination_proto->set_relational_op_index(join_operator_index);
 
   const QueryPlan::DAGNodeIndex destroy_operator_index =

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/590b6f01/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 75a7bc9..731c17d 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -99,6 +99,8 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
   }
   rules.emplace_back(new PruneColumns());
 
+  rules.emplace_back(new Fuse());
+
   for (std::unique_ptr  : rules) {
 physical_plan_ = rule->apply(physical_plan_);
 DVLOG(5) << "After applying rule " << rule->getName() << ":\n"

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/590b6f01/query_optimizer/physical/HashJoin.hpp
--
diff --git a/query_optimizer/physical/HashJoin.hpp 
b/query_optimizer/physical/HashJoin.hpp
index b904b5f..6761ac6 100644
--- a/query_optimizer/physical/HashJoin.hpp
+++ b/query_optimizer/physical/HashJoin.hpp
@@ -185,6 +185,8 @@ class HashJoin : public BinaryJoin {
   expressions::PredicatePtr residual_predicate_;
   JoinType join_type_;
 
+  expressions::PredicatePtr filter_predicate_;
+
   DISALLOW_COPY_AND_ASSIGN(HashJoin);
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/590b6f01/query_optimizer/rules/CMakeLists.txt
--
diff --git a/query_optimizer/rules/CMakeLists.txt 
b/query_optimizer/rules/CMakeLists.txt
index 1990174..4c064e9 100644
--- a/query_optimizer/rules/CMakeLists.txt
+++ b/query_optimizer/rules/CMakeLists.txt
@@ -20,6 +20,7 @@ add_subdirectory(tests)
 # Declare micro-libs:
 add_library(quickstep_queryoptimizer_rules_BottomUpRule ../../empty_src.cpp 
BottomUpRule.hpp)
 add_library(quickstep_queryoptimizer_rules_CollapseProject CollapseProject.cpp 
CollapseProject.hpp)
+add_library(quickstep_queryoptimizer_rules_FuseJoinSelect FuseJoinSelect.cpp 
FuseJoinSelect.hpp)
 add_library(quickstep_queryoptimizer_rules_GenerateJoins GenerateJoins.cpp 
GenerateJoins.hpp)
 add_library(quickstep_queryoptimizer_rules_PruneColumns PruneColumns.cpp 
PruneColumns.hpp)
 add_library(quickstep_queryoptimizer_rules_PushDownFilter PushDownFilter.cpp 
PushDownFilter.hpp)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/590b6f01/query_optimizer/rules/FuseJoinSelect.cpp
--
diff --git a/query_optimizer/rules/FuseJoinSelect.cpp 
b/query_optimizer/rules/FuseJoinSelect.cpp
new file mode 100644
index 000..a776578
--- /dev/null
+++ 

incubator-quickstep git commit: Fixed the time measurement from milli to microseconds.

2016-07-02 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master b258821ef -> 040a511aa


Fixed the time measurement from milli to microseconds.


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

Branch: refs/heads/master
Commit: 040a511aad35cb958d9d532fabc002313952cb11
Parents: b258821
Author: Harshad Deshmukh 
Authored: Sat Jul 2 15:58:52 2016 -0500
Committer: Harshad Deshmukh 
Committed: Sat Jul 2 15:58:52 2016 -0500

--
 query_execution/Worker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/040a511a/query_execution/Worker.cpp
--
diff --git a/query_execution/Worker.cpp b/query_execution/Worker.cpp
index ae889c7..6ba27f1 100644
--- a/query_execution/Worker.cpp
+++ b/query_execution/Worker.cpp
@@ -121,7 +121,7 @@ void Worker::executeWorkOrderHelper(const TaggedMessage 
_message,
   end = std::chrono::steady_clock::now();
   delete worker_message.getWorkOrder();
   const uint64_t execution_time_microseconds =
-  std::chrono::duration_cast(end - start)
+  std::chrono::duration_cast(end - start)
   .count();
   // Construct the proto message.
   proto->set_operator_index(worker_message.getRelationalOpIndex());



incubator-quickstep git commit: QUICKSTEP-33: Fixed the bug in NumericCast. [Forced Update!]

2016-06-29 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/quickstep-33 cf7a53d55 -> d82365731 (forced update)


QUICKSTEP-33: Fixed the bug in NumericCast.


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

Branch: refs/heads/quickstep-33
Commit: d823657312cb9a897a0a8dd6dec324924462e007
Parents: 5c4e8db
Author: Hakan Memisoglu 
Authored: Wed Jun 29 14:01:13 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Jun 29 14:12:34 2016 -0500

--
 types/operations/unary_operations/NumericCastOperation.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d8236573/types/operations/unary_operations/NumericCastOperation.hpp
--
diff --git a/types/operations/unary_operations/NumericCastOperation.hpp 
b/types/operations/unary_operations/NumericCastOperation.hpp
index 250df6d..6662796 100644
--- a/types/operations/unary_operations/NumericCastOperation.hpp
+++ b/types/operations/unary_operations/NumericCastOperation.hpp
@@ -126,7 +126,7 @@ class UncheckedNumericCastOperator : public 
UncheckedUnaryOperator {
   result->appendNullValue();
 } else {
   *static_cast(result->getPtrForDirectWrite())
-  = static_cast(*scalar_arg);
+  = static_cast(*scalar_arg);
 }
   }
   return result;



[06/17] incubator-quickstep git commit: QUICKSTEP-20: Added parser support for SQL window aggregation function

2016-06-23 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/00ca1e4b/parser/preprocessed/SqlLexer_gen.cpp
--
diff --git a/parser/preprocessed/SqlLexer_gen.cpp 
b/parser/preprocessed/SqlLexer_gen.cpp
index db20491..d02db56 100644
--- a/parser/preprocessed/SqlLexer_gen.cpp
+++ b/parser/preprocessed/SqlLexer_gen.cpp
@@ -8,8 +8,8 @@
 
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 39
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -354,7 +354,7 @@ void quickstep_yyfree (void * ,yyscan_t yyscanner );
 
 /* Begin user sect3 */
 
-#define quickstep_yywrap(yyscanner) (/*CONSTCOND*/1)
+#define quickstep_yywrap(yyscanner) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -366,9 +366,6 @@ typedef int yy_state_type;
 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t 
yyscanner);
 static int yy_get_next_buffer (yyscan_t yyscanner );
-#if defined(__GNUC__) && __GNUC__ >= 3
-__attribute__((__noreturn__))
-#endif
 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
 
 /* Done after the current pattern has been matched and before the
@@ -381,8 +378,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t 
yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 152
-#define YY_END_OF_BUFFER 153
+#define YY_NUM_RULES 160
+#define YY_END_OF_BUFFER 161
 /* This struct is not used in this scanner,
but its presence is necessary. */
 struct yy_trans_info
@@ -390,72 +387,75 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[553] =
+static yyconst flex_int16_t yy_accept[588] =
 {   0,
 0,0,0,0,0,0,0,0,0,0,
-0,0,  153,2,2,  151,  151,  150,  149,  151,
-  128,  124,  127,  124,  124,  147,  120,  117,  121,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,  146,  146,  146,  125,4,5,5,3,  143,
-  143,  140,  144,  144,  138,  145,  145,  142,1,  150,
-  118,  148,  147,  147,  147,0,  122,  119,  123,  146,
-  146,  146,  146,   10,  146,  146,  146,   22,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  126,  146,
-
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,  146,   58,   66,  146,  146,  146,  146,  146,  146,
-  146,  146,  146,  146,  146,   80,   81,  146,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,4,5,3,  143,  139,  144,  137,  137,  129,
-  131,  132,  133,  134,  135,  136,  137,  145,  141,  148,
-  147,0,  147,6,7,  146,9,   11,  146,  146,
-   15,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,   32,  146,  146,  146,  146,  146,  146,  146,  146,
-
-   43,  146,  146,  146,  146,  146,  146,   50,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,   62,  146,   68,
-  146,  146,  146,  146,  146,  146,  146,   76,  146,   79,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,  146,  146,  146,   97,   98,  146,  146,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  129,  131,  130,  146,  146,  146,  146,  146,  146,  146,
-   20,   23,  146,  146,  146,   28,  146,  146,   30,  146,
-  146,  146,  146,   37,  146,  146,   41,   42,  146,  146,
-  146,  146,  146,  146,  146,   52,   53,  146,   55,  146,
-
-   57,  146,  146,  146,  146,   65,   67,   69,   70,   71,
-  146,   73,  146,  146,   77,  146,  146,  146,  146,  146,
-   88,  146,   90,  146,  146,  146,  146,  146,  146,  146,
-  146,  146,  102,  103,  105,  146,  146,  146,  146,  146,
-  146,  112,  146,  114,  115,  129,  130,8,  146,  146,
-  146,  146,  146,  146,  146,   25,  146,  146,  146,  146,
-  146,  146,  146,  146,  146,  146,  146,  146,  146,  146,
-  146,   47,   48,   49,  146,   54,  146,   59,   60,  146,
-  146,  146,   72,  146,   75,   78,   82,   83,  146,  146,
-  146,   89,  146,  146,   93,  146,  146,  146,  146,  146,
-
-  101,  146,  146,  146,  146,  109,  146,  146,  113,  146,
-  146,  146,   14,  146,  146,  146,  146,  146,   26,  146,
-   29,  146,  146,  146,  146,   35,  146,  146,  146,   40,
-  146,   45,  146,  146,   56,   61,  146,  146,   74,  146,
-  146,  146,  146,   92,  146,   95,   96,  146,  146,  146,
-  146,  107,  108,  110,  146,  146,  

[10/17] incubator-quickstep git commit: Added PRIORITY clause in parser.

2016-06-23 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d6428914/parser/preprocessed/SqlParser_gen.hpp
--
diff --git a/parser/preprocessed/SqlParser_gen.hpp 
b/parser/preprocessed/SqlParser_gen.hpp
index fea31d6..0f66d1d 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 2.7.  */
 
 /* Bison interface for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
+   
+  Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+   
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+   
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
-
+   
You should have received a copy of the GNU General Public License
along with this program.  If not, see .  */
 
@@ -26,13 +26,13 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+   
This special exception was added by the Free Software Foundation in
version 2.2 of Bison.  */
 
 #ifndef YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
 # define YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
-/* Debug traces.  */
+/* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
 #endif
@@ -40,150 +40,152 @@
 extern int quickstep_yydebug;
 #endif
 
-/* Token type.  */
+/* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-  enum yytokentype
-  {
-TOKEN_COMMAND = 258,
-TOKEN_NAME = 259,
-TOKEN_STRING_SINGLE_QUOTED = 260,
-TOKEN_STRING_DOUBLE_QUOTED = 261,
-TOKEN_UNSIGNED_NUMVAL = 262,
-TOKEN_OR = 263,
-TOKEN_AND = 264,
-TOKEN_NOT = 265,
-TOKEN_EQ = 266,
-TOKEN_LT = 267,
-TOKEN_LEQ = 268,
-TOKEN_GT = 269,
-TOKEN_GEQ = 270,
-TOKEN_NEQ = 271,
-TOKEN_LIKE = 272,
-TOKEN_REGEXP = 273,
-TOKEN_BETWEEN = 274,
-TOKEN_IS = 275,
-UNARY_PLUS = 276,
-UNARY_MINUS = 277,
-TOKEN_ADD = 278,
-TOKEN_ALL = 279,
-TOKEN_ALTER = 280,
-TOKEN_AS = 281,
-TOKEN_ASC = 282,
-TOKEN_BIGINT = 283,
-TOKEN_BIT = 284,
-TOKEN_BITWEAVING = 285,
-TOKEN_BLOCKPROPERTIES = 286,
-TOKEN_BLOCKSAMPLE = 287,
-TOKEN_BLOOM_FILTER = 288,
-TOKEN_CSB_TREE = 289,
-TOKEN_BY = 290,
-TOKEN_CASE = 291,
-TOKEN_CHARACTER = 292,
-TOKEN_CHECK = 293,
-TOKEN_COLUMN = 294,
-TOKEN_CONSTRAINT = 295,
-TOKEN_COPY = 296,
-TOKEN_CREATE = 297,
-TOKEN_CURRENT = 298,
-TOKEN_DATE = 299,
-TOKEN_DATETIME = 300,
-TOKEN_DAY = 301,
-TOKEN_DECIMAL = 302,
-TOKEN_DEFAULT = 303,
-TOKEN_DELETE = 304,
-TOKEN_DELIMITER = 305,
-TOKEN_DESC = 306,
-TOKEN_DISTINCT = 307,
-TOKEN_DOUBLE = 308,
-TOKEN_DROP = 309,
-TOKEN_ELSE = 310,
-TOKEN_END = 311,
-TOKEN_ESCAPE_STRINGS = 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_QUIT = 354,
-TOKEN_RANGE = 355,
-TOKEN_REAL = 356,
-TOKEN_REFERENCES = 357,
-TOKEN_RIGHT = 358,
-TOKEN_ROW = 359,
-TOKEN_ROW_DELIMITER = 360,
-TOKEN_ROWS = 361,
-TOKEN_SECOND = 362,
-TOKEN_SELECT = 363,
-TOKEN_SET = 364,
-TOKEN_SMA = 365,
-TOKEN_SMALLINT = 366,
-TOKEN_SUBSTRING = 367,
-TOKEN_TABLE = 368,
-TOKEN_THEN = 369,
-TOKEN_TIME = 370,
-TOKEN_TIMESTAMP = 371,
-TOKEN_TRUE = 372,
-TOKEN_TUPLESAMPLE = 373,
-TOKEN_UNBOUNDED = 374,
-TOKEN_UNIQUE = 

[17/17] incubator-quickstep git commit: QUICKSTEP-6: New fixed precision number type: Decimal.

2016-06-23 Thread hakanmemisoglu
QUICKSTEP-6: New fixed precision number type: Decimal.


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

Branch: refs/heads/decimal-type
Commit: 8570a90615c887b92a56e3ada76ee850e64a6b80
Parents: d642891
Author: Hakan Memisoglu 
Authored: Tue May 31 13:14:42 2016 -0500
Committer: Hakan Memisoglu 
Committed: Thu Jun 23 15:15:30 2016 -0500

--
 parser/SqlParser.ypp|2 +-
 parser/preprocessed/SqlParser_gen.cpp   | 4600 --
 parser/preprocessed/SqlParser_gen.hpp   |  322 +-
 types/CMakeLists.txt|   27 +
 types/DecimalLit.hpp|  293 ++
 types/DecimalType.cpp   |  120 +
 types/DecimalType.hpp   |  124 +
 types/NumericSuperType.hpp  |2 +-
 types/NumericTypeUnifier.hpp|   46 +
 types/Type.cpp  |3 +
 types/Type.hpp  |3 +
 types/Type.proto|9 +-
 types/TypeFactory.cpp   |   10 +
 types/TypeFactory.hpp   |1 +
 types/TypeID.cpp|1 +
 types/TypeID.hpp|1 +
 types/TypedValue.cpp|   16 +
 types/TypedValue.hpp|   21 +
 types/TypedValue.proto  |7 +-
 .../binary_operations/AddBinaryOperation.cpp|   10 +-
 .../ArithmeticBinaryOperation.hpp   |   19 +
 .../ArithmeticBinaryOperators.hpp   |  106 +
 .../operations/binary_operations/CMakeLists.txt |2 +
 .../binary_operations/DivideBinaryOperation.cpp |7 +-
 .../binary_operations/ModuloBinaryOperation.cpp |   13 +
 .../MultiplyBinaryOperation.cpp |   12 +-
 .../SubtractBinaryOperation.cpp |9 +-
 .../operations/comparisons/BasicComparison.cpp  |4 +-
 .../operations/comparisons/BasicComparison.hpp  |   22 +-
 types/operations/comparisons/CMakeLists.txt |1 +
 types/operations/comparisons/ComparisonUtil.hpp |  104 +
 .../comparisons/LiteralComparators.hpp  |  127 +
 .../ArithmeticUnaryOperations.cpp   |   13 +-
 .../operations/unary_operations/CMakeLists.txt  |2 +
 .../unary_operations/NumericCastOperation.hpp   |5 +-
 types/tests/DecimalType_unittest.cpp|   82 +
 36 files changed, 3463 insertions(+), 2683 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8570a906/parser/SqlParser.ypp
--
diff --git a/parser/SqlParser.ypp b/parser/SqlParser.ypp
index 382ea44..11685be 100644
--- a/parser/SqlParser.ypp
+++ b/parser/SqlParser.ypp
@@ -774,7 +774,7 @@ data_type:
 $$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetime));
   }
   | TOKEN_DECIMAL {
-$$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));
+$$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDecimal));
   }
   | TOKEN_REAL {
 $$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));



[07/17] incubator-quickstep git commit: QUICKSTEP-20: Added parser support for SQL window aggregation function

2016-06-23 Thread hakanmemisoglu
QUICKSTEP-20: Added parser support for SQL window aggregation function


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

Branch: refs/heads/decimal-type
Commit: 00ca1e4b3a9c9838dcb9509058b8a40b0f573617
Parents: 8e825f1
Author: shixuan 
Authored: Tue Jun 14 23:07:32 2016 +
Committer: shixuan 
Committed: Fri Jun 17 20:34:24 2016 +

--
 parser/CMakeLists.txt   |   11 +
 parser/ParseBasicExpressions.cpp|   10 +
 parser/ParseBasicExpressions.hpp|   45 +
 parser/ParseSelect.hpp  |   27 +-
 parser/ParseWindow.hpp  |  201 ++
 parser/SqlLexer.lpp |   10 +
 parser/SqlParser.ypp|  128 +-
 parser/preprocessed/SqlLexer_gen.cpp| 1671 ++---
 parser/preprocessed/SqlLexer_gen.hpp|   16 +-
 parser/preprocessed/SqlParser_gen.cpp   | 3367 ++
 parser/preprocessed/SqlParser_gen.hpp   |  182 +-
 parser/tests/Select.test|  120 +
 query_optimizer/resolver/CMakeLists.txt |1 +
 query_optimizer/resolver/Resolver.cpp   |7 +
 14 files changed, 3368 insertions(+), 2428 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/00ca1e4b/parser/CMakeLists.txt
--
diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt
index 2488d30..55c4a67 100644
--- a/parser/CMakeLists.txt
+++ b/parser/CMakeLists.txt
@@ -113,6 +113,7 @@ add_library(quickstep_parser_ParseSubqueryExpression 
ParseSubqueryExpression.cpp
 add_library(quickstep_parser_ParseSubqueryTableReference 
ParseSubqueryTableReference.cpp ParseSubqueryTableReference.hpp)
 add_library(quickstep_parser_ParseTableReference ParseTableReference.cpp 
ParseTableReference.hpp)
 add_library(quickstep_parser_ParseTreeNode ../empty_src.cpp ParseTreeNode.hpp)
+add_library(quickstep_parser_ParseWindow ../empty_src.cpp ParseWindow.hpp)
 add_library(quickstep_parser_ParserUtil ParserUtil.cpp ParserUtil.hpp)
 add_library(quickstep_parser_SqlParserWrapper SqlParserWrapper.cpp 
SqlParserWrapper.hpp)
 add_library(quickstep_parser_SqlParser ${BISON_SqlParser_OUTPUTS})
@@ -135,6 +136,7 @@ target_link_libraries(quickstep_parser_ParseBasicExpressions
   quickstep_parser_ParseLiteralValue
   quickstep_parser_ParseString
   quickstep_parser_ParseTreeNode
+  quickstep_parser_ParseWindow
   
quickstep_types_operations_binaryoperations_BinaryOperation
   quickstep_types_operations_unaryoperations_UnaryOperation
   quickstep_utility_Macros
@@ -241,6 +243,7 @@ target_link_libraries(quickstep_parser_ParseSelect
   quickstep_parser_ParseSelectionClause
   quickstep_parser_ParseTableReference
   quickstep_parser_ParseTreeNode
+  quickstep_parser_ParseWindow
   quickstep_utility_Macros
   quickstep_utility_PtrList)
 target_link_libraries(quickstep_parser_ParseSelectionClause
@@ -300,6 +303,12 @@ target_link_libraries(quickstep_parser_ParseTreeNode
   quickstep_utility_TreeStringSerializable)
 target_link_libraries(quickstep_parser_ParserUtil
   quickstep_utility_SqlError)
+target_link_libraries(quickstep_parser_ParseWindow
+  quickstep_parser_ParseExpression
+  quickstep_parser_ParseOrderBy
+  quickstep_parser_ParseString
+  quickstep_parser_ParseTreeNode
+  quickstep_utility_PtrList)
 target_link_libraries(quickstep_parser_SqlLexer
   quickstep_parser_ParseJoinedTableReference
   quickstep_parser_ParseLiteralValue
@@ -337,6 +346,7 @@ target_link_libraries(quickstep_parser_SqlParser
   quickstep_parser_ParseSubqueryExpression
   quickstep_parser_ParseSubqueryTableReference
   quickstep_parser_ParseTableReference
+  quickstep_parser_ParseWindow
   quickstep_parser_ParserUtil
   quickstep_storage_StorageBlockInfo
   quickstep_types_Type
@@ -419,6 +429,7 @@ target_link_libraries(quickstep_parser
   quickstep_parser_ParseSubqueryTableReference
   quickstep_parser_ParseTableReference
   

[16/17] incubator-quickstep git commit: QUICKSTEP-6: New fixed precision number type: Decimal.

2016-06-23 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8570a906/parser/preprocessed/SqlParser_gen.cpp
--
diff --git a/parser/preprocessed/SqlParser_gen.cpp 
b/parser/preprocessed/SqlParser_gen.cpp
index 8fdf490..6827de2 100644
--- a/parser/preprocessed/SqlParser_gen.cpp
+++ b/parser/preprocessed/SqlParser_gen.cpp
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7.  */
+/* A Bison parser, made by GNU Bison 3.0.4.  */
 
 /* Bison implementation for Yacc-like parsers in C
-   
-  Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
-   
+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-   
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
-   
+
You should have received a copy of the GNU General Public License
along with this program.  If not, see .  */
 
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-   
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison.  */
 
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.7"
+#define YYBISON_VERSION "3.0.4"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -63,15 +63,12 @@
 #define yyparse quickstep_yyparse
 #define yylex   quickstep_yylex
 #define yyerror quickstep_yyerror
-#define yylval  quickstep_yylval
-#define yychar  quickstep_yychar
 #define yydebug quickstep_yydebug
 #define yynerrs quickstep_yynerrs
-#define yylloc  quickstep_yylloc
+
 
 /* Copy the first part of user declarations.  */
-/* Line 371 of yacc.c  */
-#line 35 "../SqlParser.ypp"
+#line 35 "../SqlParser.ypp" /* yacc.c:339  */
 
 
 /* Override the default definition, as we only need  and 
. */
@@ -99,8 +96,7 @@ typedef struct YYLTYPE {
 }   \
   } while (0)
 
-/* Line 371 of yacc.c  */
-#line 64 "../SqlParser.ypp"
+#line 64 "../SqlParser.ypp" /* yacc.c:339  */
 
 #include 
 #include 
@@ -156,14 +152,13 @@ typedef struct YYLTYPE {
 // Needed for Bison 2.6 and higher, which do not automatically provide this 
typedef.
 typedef void* yyscan_t;
 
-/* Line 371 of yacc.c  */
-#line 161 "SqlParser_gen.cpp"
+#line 156 "SqlParser_gen.cpp" /* yacc.c:339  */
 
-# ifndef YY_NULL
+# ifndef YY_NULLPTR
 #  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULL nullptr
+#   define YY_NULLPTR nullptr
 #  else
-#   define YY_NULL 0
+#   define YY_NULLPTR 0
 #  endif
 # endif
 
@@ -179,7 +174,7 @@ typedef void* yyscan_t;
by #include "SqlParser_gen.hpp".  */
 #ifndef YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
 # define YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
-/* Enabling traces.  */
+/* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
 #endif
@@ -187,152 +182,151 @@ typedef void* yyscan_t;
 extern int quickstep_yydebug;
 #endif
 
-/* Tokens.  */
+/* Token type.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-  know about them.  */
-   enum yytokentype {
- TOKEN_COMMAND = 258,
- TOKEN_NAME = 259,
- TOKEN_STRING_SINGLE_QUOTED = 260,
- TOKEN_STRING_DOUBLE_QUOTED = 261,
- TOKEN_UNSIGNED_NUMVAL = 262,
- TOKEN_OR = 263,
- TOKEN_AND = 264,
- TOKEN_NOT = 265,
- TOKEN_EQ = 266,
- TOKEN_NEQ = 267,
- TOKEN_GEQ = 268,
- TOKEN_GT = 269,
- TOKEN_LEQ = 270,
- TOKEN_LT = 271,
- TOKEN_REGEXP = 272,
- TOKEN_LIKE = 273,
- TOKEN_BETWEEN = 274,
- TOKEN_IS = 275,
- UNARY_MINUS = 276,
- UNARY_PLUS = 277,
- TOKEN_ADD = 278,
- TOKEN_ALL = 279,
- TOKEN_ALTER = 280,
- TOKEN_AS = 281,
- TOKEN_ASC = 282,
- TOKEN_BIGINT = 283,
- TOKEN_BIT = 284,
- TOKEN_BITWEAVING = 285,
- TOKEN_BLOCKPROPERTIES = 286,
- TOKEN_BLOCKSAMPLE = 287,
- TOKEN_BLOOM_FILTER = 288,
- TOKEN_CSB_TREE = 289,
- TOKEN_BY = 290,
- TOKEN_CASE = 291,
- TOKEN_CHARACTER = 292,
- TOKEN_CHECK = 293,
- TOKEN_COLUMN = 294,
- TOKEN_CONSTRAINT = 295,
- TOKEN_COPY = 296,
- TOKEN_CREATE = 297,
- TOKEN_CURRENT = 298,
- TOKEN_DATE = 299,
- TOKEN_DATETIME = 300,
- TOKEN_DAY = 301,
- TOKEN_DECIMAL = 302,
- 

[14/17] incubator-quickstep git commit: QUICKSTEP-6: New fixed precision number type: Decimal.

2016-06-23 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8570a906/types/operations/unary_operations/NumericCastOperation.hpp
--
diff --git a/types/operations/unary_operations/NumericCastOperation.hpp 
b/types/operations/unary_operations/NumericCastOperation.hpp
index 250df6d..9eb50c2 100644
--- a/types/operations/unary_operations/NumericCastOperation.hpp
+++ b/types/operations/unary_operations/NumericCastOperation.hpp
@@ -29,6 +29,7 @@
 #include "catalog/CatalogTypedefs.hpp"
 #include "storage/ValueAccessor.hpp"
 #include "storage/ValueAccessorUtil.hpp"
+#include "types/DecimalType.hpp"
 #include "types/DoubleType.hpp"
 #include "types/FloatType.hpp"
 #include "types/IntType.hpp"
@@ -126,7 +127,7 @@ class UncheckedNumericCastOperator : public 
UncheckedUnaryOperator {
   result->appendNullValue();
 } else {
   *static_cast(result->getPtrForDirectWrite())
-  = static_cast(*scalar_arg);
+  = static_cast(*scalar_arg);
 }
   }
   return result;
@@ -285,6 +286,8 @@ class NumericCastOperation : public UnaryOperation {
 return 
makeUncheckedUnaryOperatorHelperForTargetNullability();
   case kDouble:
 return 
makeUncheckedUnaryOperatorHelperForTargetNullability();
+  case kDecimal:
+return 
makeUncheckedUnaryOperatorHelperForTargetNullability();
   default:
 FATAL_ERROR("Unhandled type " << kTypeNames[target_type_.getTypeID()]);
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8570a906/types/tests/DecimalType_unittest.cpp
--
diff --git a/types/tests/DecimalType_unittest.cpp 
b/types/tests/DecimalType_unittest.cpp
new file mode 100644
index 000..e0e76af
--- /dev/null
+++ b/types/tests/DecimalType_unittest.cpp
@@ -0,0 +1,82 @@
+/**
+ *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+ * University of Wisconsin—Madison.
+ *
+ *   Licensed 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 
+
+#include "types/DecimalLit.hpp"
+#include "types/DecimalType.hpp"
+#include "types/Type.hpp"
+#include "types/TypeFactory.hpp"
+#include "types/TypedValue.hpp"
+
+#include "gtest/gtest.h"
+
+namespace quickstep {
+
+TEST(DecimalTypeTest, PrintValueTest) {
+  const Type _type = TypeFactory::GetType(kDecimal);
+
+  // Try integer version.
+  DecimalLit integer_decimal = DecimalLit(36509);
+  TypedValue value_for_integer_decimal(integer_decimal);
+  EXPECT_EQ(std::string("36509.00"),
+decimal_type.printValueToString(value_for_integer_decimal));
+
+  // Try double version.
+  DecimalLit double_decimal = DecimalLit(36509.65);
+  TypedValue value_for_double_decimal(double_decimal);
+  EXPECT_EQ(std::string("36509.65"),
+decimal_type.printValueToString(value_for_double_decimal));
+
+  // Try truncation of double version.
+  DecimalLit double_decimal_truncated = DecimalLit(36509.6526762);
+  TypedValue value_for_double_decimal_truncated(double_decimal_truncated);
+  EXPECT_EQ(std::string("36509.65"),
+decimal_type.printValueToString(
+value_for_double_decimal_truncated));
+
+  // Test that number is truncated, not rounded.
+  double_decimal_truncated = DecimalLit(36509.659);
+  TypedValue 
value_for_double_decimal_truncated_other(double_decimal_truncated);
+  EXPECT_EQ(std::string("36509.65"),
+decimal_type.printValueToString(
+value_for_double_decimal_truncated));
+}
+
+TEST(DecimalTypeTest, DecimalLitOperationsTest) {
+  const Type _type = TypeFactory::GetType(kDecimal);
+
+  DecimalLit decimal_a(560.35);
+  DecimalLit decimal_b(439.65);
+
+  EXPECT_EQ(std::string("1000.00"),
+decimal_type.printValueToString(TypedValue(decimal_a + 
decimal_b)));
+
+  EXPECT_EQ(std::string("120.70"),
+decimal_type.printValueToString(TypedValue(decimal_a - 
decimal_b)));
+
+  EXPECT_EQ(std::string("246357.87"),
+decimal_type.printValueToString(TypedValue(decimal_a * 
decimal_b)));
+
+  EXPECT_EQ(std::string("1.27"),
+decimal_type.printValueToString(TypedValue(decimal_a / 
decimal_b)));
+
+  EXPECT_EQ(std::string("120.70"),
+

[09/17] incubator-quickstep git commit: Basic support to report individual work order profiling results

2016-06-23 Thread hakanmemisoglu
Basic support to report individual work order profiling results

- A flag to enable work order profiling report generation.
- At the end of each query, a report is generated which includes worker
  ID, its NUMA socket, the operator that produced the WorkOrder
  and the execution time in microseconds for the latest query.
- The output is printed on stdout in CSV format as of now.
- As this is a rudimentary support for the functionality, there is a lot of
  future work in this regards, which includes printing of CPU core information,
  printing operator name, allowing user to specify a file where the output can
  be written etc.
- Fixed a bug in constructing Foreman thread.


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

Branch: refs/heads/decimal-type
Commit: 07435a430776c0b8b6381a4c0f0470250814c14b
Parents: c1476d1
Author: Harshad Deshmukh 
Authored: Thu Jun 16 14:03:34 2016 -0500
Committer: Harshad Deshmukh 
Committed: Mon Jun 20 09:56:52 2016 -0500

--
 cli/QuickstepCli.cpp   | 12 +++-
 query_execution/CMakeLists.txt |  2 ++
 query_execution/Foreman.cpp| 26 +++--
 query_execution/Foreman.hpp| 22 ++-
 query_execution/PolicyEnforcer.cpp | 15 ++
 query_execution/PolicyEnforcer.hpp | 50 +++--
 6 files changed, 121 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/07435a43/cli/QuickstepCli.cpp
--
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
index 35bd16e..3f99130 100644
--- a/cli/QuickstepCli.cpp
+++ b/cli/QuickstepCli.cpp
@@ -137,6 +137,9 @@ static constexpr char kPathSeparator = '/';
 static constexpr char kDefaultStoragePath[] = "qsstor/";
 #endif
 
+DEFINE_bool(profile_and_report_workorder_perf, false,
+"If true, Quickstep will record the exceution time of all the individual "
+"normal work orders and report it at the end of query execution.");
 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"
@@ -356,7 +359,9 @@ int main(int argc, char* argv[]) {
   ,
   query_processor->getDefaultDatabase(),
   query_processor->getStorageManager(),
-  num_numa_nodes_system);
+  -1,  // Don't pin the Foreman thread.
+  num_numa_nodes_system,
+  quickstep::FLAGS_profile_and_report_workorder_perf);
 
   // Start the worker threads.
   for (Worker  : workers) {
@@ -461,6 +466,11 @@ int main(int argc, char* argv[]) {
   printf("Time: %s ms\n",
  quickstep::DoubleToStringWithSignificantDigits(
  time_ms.count(), 3).c_str());
+  if (quickstep::FLAGS_profile_and_report_workorder_perf) {
+// TODO(harshad) - Allow user specified file instead of stdout.
+foreman.printWorkOrderProfilingResults(query_handle->query_id(),
+   stdout);
+  }
 } catch (const std::exception ) {
   fprintf(stderr, "QUERY EXECUTION ERROR: %s\n", e.what());
   break;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/07435a43/query_execution/CMakeLists.txt
--
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
index 501166e..b031a44 100644
--- a/query_execution/CMakeLists.txt
+++ b/query_execution/CMakeLists.txt
@@ -1,5 +1,7 @@
 #   Copyright 2011-2015 Quickstep Technologies LLC.
 #   Copyright 2015-2016 Pivotal Software, Inc.
+#   Copyright 2016, Quickstep Research Group, Computer Sciences Department, 
+# University of Wisconsin—Madison.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/07435a43/query_execution/Foreman.cpp
--
diff --git a/query_execution/Foreman.cpp b/query_execution/Foreman.cpp
index 828834d..f9f2e7a 100644
--- a/query_execution/Foreman.cpp
+++ b/query_execution/Foreman.cpp
@@ -18,7 +18,9 @@
 #include "query_execution/Foreman.hpp"
 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 

[1/3] incubator-quickstep git commit: New type for fixed precision number: Decimal. [Forced Update!]

2016-06-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 21e912c93 -> 0dd7978bb (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0dd7978b/parser/preprocessed/SqlParser_gen.hpp
--
diff --git a/parser/preprocessed/SqlParser_gen.hpp 
b/parser/preprocessed/SqlParser_gen.hpp
index 71e4332..c60b0e3 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -175,7 +175,7 @@ extern int quickstep_yydebug;
 
 union YYSTYPE
 {
-#line 118 "../SqlParser.ypp" /* yacc.c:1915  */
+#line 118 "../SqlParser.ypp" /* yacc.c:1909  */
 
   quickstep::ParseString *string_value_;
 
@@ -267,7 +267,7 @@ union YYSTYPE
   quickstep::PtrVector *with_list_;
   quickstep::ParseSubqueryTableReference *with_list_element_;
 
-#line 271 "SqlParser_gen.hpp" /* yacc.c:1915  */
+#line 271 "SqlParser_gen.hpp" /* yacc.c:1909  */
 };
 
 typedef union YYSTYPE YYSTYPE;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0dd7978b/types/CMakeLists.txt
--
diff --git a/types/CMakeLists.txt b/types/CMakeLists.txt
index 0ccdfd7..16a6f1e 100644
--- a/types/CMakeLists.txt
+++ b/types/CMakeLists.txt
@@ -35,6 +35,8 @@ add_library(quickstep_types_DateOperatorOverloads 
../empty_src.cpp DateOperatorO
 add_library(quickstep_types_DatetimeIntervalType DatetimeIntervalType.cpp 
DatetimeIntervalType.hpp)
 add_library(quickstep_types_DatetimeLit ../empty_src.cpp DatetimeLit.hpp)
 add_library(quickstep_types_DatetimeType DatetimeType.cpp DatetimeType.hpp)
+add_library(quickstep_types_DecimalLit ../empty_src.cpp DecimalLit.hpp)
+add_library(quickstep_types_DecimalType DecimalType.cpp DecimalType.hpp)
 add_library(quickstep_types_DoubleType DoubleType.cpp DoubleType.hpp)
 add_library(quickstep_types_FloatType FloatType.cpp FloatType.hpp)
 add_library(quickstep_types_IntType IntType.cpp IntType.hpp)
@@ -94,6 +96,16 @@ target_link_libraries(quickstep_types_DatetimeType
   quickstep_types_port_timegm
   quickstep_utility_CheckSnprintf
   quickstep_utility_Macros)
+target_link_libraries(quickstep_types_DecimalType
+  glog
+  quickstep_types_DecimalLit
+  quickstep_types_NullCoercibilityCheckMacro
+  quickstep_types_NumericSuperType
+  quickstep_types_Type
+  quickstep_types_TypeID
+  quickstep_types_TypedValue
+  quickstep_utility_EqualsAnyConstant
+  quickstep_utility_Macros)
 target_link_libraries(quickstep_types_DoubleType
   quickstep_types_NullCoercibilityCheckMacro
   quickstep_types_NumericSuperType
@@ -158,6 +170,7 @@ target_link_libraries(quickstep_types_TypeFactory
   quickstep_types_CharType
   quickstep_types_DatetimeIntervalType
   quickstep_types_DatetimeType
+  quickstep_types_DecimalType
   quickstep_types_DoubleType
   quickstep_types_FloatType
   quickstep_types_IntType
@@ -173,6 +186,7 @@ target_link_libraries(quickstep_types_TypedValue
   farmhash
   glog
   quickstep_types_DatetimeLit
+  quickstep_types_DecimalLit
   quickstep_types_IntervalLit
   quickstep_types_TypeID
   quickstep_types_Type_proto
@@ -213,6 +227,8 @@ target_link_libraries(quickstep_types
   quickstep_types_DatetimeIntervalType
   quickstep_types_DatetimeLit
   quickstep_types_DatetimeType
+  quickstep_types_DecimalLit
+  quickstep_types_DecimalType
   quickstep_types_DoubleType
   quickstep_types_FloatType
   quickstep_types_IntType
@@ -295,6 +311,17 @@ target_link_libraries(DatetimeType_unittest
   quickstep_utility_MemStream)
 add_test(DatetimeType_unittest DatetimeType_unittest)
 
+add_executable(DecimalType_unittest 
"${CMAKE_CURRENT_SOURCE_DIR}/tests/DecimalType_unittest.cpp")
+target_link_libraries(DecimalType_unittest
+  gtest
+  gtest_main
+  quickstep_types_DecimalLit
+  quickstep_types_DecimalType
+  quickstep_types_Type
+  quickstep_types_TypeFactory
+  quickstep_types_TypedValue)
+add_test(DecimalType_unittest DecimalType_unittest)
+
 add_executable(DoubleType_unittest 
"${CMAKE_CURRENT_SOURCE_DIR}/tests/DoubleType_unittest.cpp")
 target_link_libraries(DoubleType_unittest
 

[2/3] incubator-quickstep git commit: New type for fixed precision number: Decimal.

2016-06-23 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0dd7978b/parser/preprocessed/SqlParser_gen.cpp
--
diff --git a/parser/preprocessed/SqlParser_gen.cpp 
b/parser/preprocessed/SqlParser_gen.cpp
index 038db14..c3f48ae 100644
--- a/parser/preprocessed/SqlParser_gen.cpp
+++ b/parser/preprocessed/SqlParser_gen.cpp
@@ -3109,148 +3109,148 @@ yyreduce:
   switch (yyn)
 {
 case 2:
-#line 585 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 585 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].statement_);
 YYACCEPT;
   }
-#line 3118 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3118 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 3:
-#line 589 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 589 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].statement_);
 YYACCEPT;
   }
-#line 3127 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3127 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 4:
-#line 593 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 593 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].command_);
 YYACCEPT;
   }
-#line 3136 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3136 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 5:
-#line 597 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 597 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].command_);
 YYACCEPT;
   }
-#line 3145 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3145 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 6:
-#line 601 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 601 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 YYABORT;
   }
-#line 3153 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3153 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 7:
-#line 604 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 604 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 // Regular yyparse() return codes are non-negative, so use a negative one 
here.
 return -1;
   }
-#line 3162 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3162 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 8:
-#line 611 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 611 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].statement_);
   }
-#line 3170 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3170 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 9:
-#line 614 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 614 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].copy_from_statement_);
   }
-#line 3178 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3178 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 10:
-#line 617 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 617 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].create_table_statement_);
   }
-#line 3186 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3186 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 11:
-#line 620 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 620 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].statement_);
   }
-#line 3194 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3194 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 12:
-#line 623 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 623 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].delete_statement_);
   }
-#line 3202 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3202 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 13:
-#line 626 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 626 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].drop_table_statement_);
   }
-#line 3210 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3210 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 14:
-#line 629 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 629 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].insert_statement_);
   }
-#line 3218 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3218 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 15:
-#line 632 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 632 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].quit_statement_);
   }
-#line 3226 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3226 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 16:
-#line 635 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 635 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].select_statement_);
   }
-#line 3234 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3234 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 17:
-#line 638 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 638 "../SqlParser.ypp" /* yacc.c:1646  */
 

incubator-quickstep git commit: Use constructor instead of builder in unit test.

2016-06-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 0a3e43f29 -> 21e912c93


Use constructor instead of builder in unit test.


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

Branch: refs/heads/decimal-type
Commit: 21e912c931aa110d3289b7a40e8d8a4ea6499751
Parents: 0a3e43f
Author: Hakan Memisoglu 
Authored: Thu Jun 23 14:51:51 2016 -0500
Committer: Hakan Memisoglu 
Committed: Thu Jun 23 14:51:51 2016 -0500

--
 types/tests/DecimalType_unittest.cpp | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/21e912c9/types/tests/DecimalType_unittest.cpp
--
diff --git a/types/tests/DecimalType_unittest.cpp 
b/types/tests/DecimalType_unittest.cpp
index 78a79ab..e0e76af 100644
--- a/types/tests/DecimalType_unittest.cpp
+++ b/types/tests/DecimalType_unittest.cpp
@@ -31,26 +31,26 @@ TEST(DecimalTypeTest, PrintValueTest) {
   const Type _type = TypeFactory::GetType(kDecimal);
 
   // Try integer version.
-  DecimalLit integer_decimal = DecimalLit::fromInt(36509);
+  DecimalLit integer_decimal = DecimalLit(36509);
   TypedValue value_for_integer_decimal(integer_decimal);
   EXPECT_EQ(std::string("36509.00"),
 decimal_type.printValueToString(value_for_integer_decimal));
 
   // Try double version.
-  DecimalLit double_decimal = DecimalLit::fromDouble(36509.65);
+  DecimalLit double_decimal = DecimalLit(36509.65);
   TypedValue value_for_double_decimal(double_decimal);
   EXPECT_EQ(std::string("36509.65"),
 decimal_type.printValueToString(value_for_double_decimal));
 
   // Try truncation of double version.
-  DecimalLit double_decimal_truncated = DecimalLit::fromDouble(36509.6526762);
+  DecimalLit double_decimal_truncated = DecimalLit(36509.6526762);
   TypedValue value_for_double_decimal_truncated(double_decimal_truncated);
   EXPECT_EQ(std::string("36509.65"),
 decimal_type.printValueToString(
 value_for_double_decimal_truncated));
 
   // Test that number is truncated, not rounded.
-  double_decimal_truncated = DecimalLit::fromDouble(36509.659);
+  double_decimal_truncated = DecimalLit(36509.659);
   TypedValue 
value_for_double_decimal_truncated_other(double_decimal_truncated);
   EXPECT_EQ(std::string("36509.65"),
 decimal_type.printValueToString(
@@ -60,8 +60,8 @@ TEST(DecimalTypeTest, PrintValueTest) {
 TEST(DecimalTypeTest, DecimalLitOperationsTest) {
   const Type _type = TypeFactory::GetType(kDecimal);
 
-  DecimalLit decimal_a = DecimalLit::fromDouble(560.35);
-  DecimalLit decimal_b = DecimalLit::fromDouble(439.65);
+  DecimalLit decimal_a(560.35);
+  DecimalLit decimal_b(439.65);
 
   EXPECT_EQ(std::string("1000.00"),
 decimal_type.printValueToString(TypedValue(decimal_a + 
decimal_b)));



[1/3] incubator-quickstep git commit: Updated preprocessed lexer and parser files.

2016-06-23 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 2d1710945 -> 0a3e43f29


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0a3e43f2/parser/preprocessed/SqlParser_gen.hpp
--
diff --git a/parser/preprocessed/SqlParser_gen.hpp 
b/parser/preprocessed/SqlParser_gen.hpp
index 71e4332..c60b0e3 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -175,7 +175,7 @@ extern int quickstep_yydebug;
 
 union YYSTYPE
 {
-#line 118 "../SqlParser.ypp" /* yacc.c:1915  */
+#line 118 "../SqlParser.ypp" /* yacc.c:1909  */
 
   quickstep::ParseString *string_value_;
 
@@ -267,7 +267,7 @@ union YYSTYPE
   quickstep::PtrVector *with_list_;
   quickstep::ParseSubqueryTableReference *with_list_element_;
 
-#line 271 "SqlParser_gen.hpp" /* yacc.c:1915  */
+#line 271 "SqlParser_gen.hpp" /* yacc.c:1909  */
 };
 
 typedef union YYSTYPE YYSTYPE;



[2/3] incubator-quickstep git commit: Updated preprocessed lexer and parser files.

2016-06-23 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0a3e43f2/parser/preprocessed/SqlParser_gen.cpp
--
diff --git a/parser/preprocessed/SqlParser_gen.cpp 
b/parser/preprocessed/SqlParser_gen.cpp
index 038db14..c3f48ae 100644
--- a/parser/preprocessed/SqlParser_gen.cpp
+++ b/parser/preprocessed/SqlParser_gen.cpp
@@ -3109,148 +3109,148 @@ yyreduce:
   switch (yyn)
 {
 case 2:
-#line 585 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 585 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].statement_);
 YYACCEPT;
   }
-#line 3118 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3118 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 3:
-#line 589 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 589 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].statement_);
 YYACCEPT;
   }
-#line 3127 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3127 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 4:
-#line 593 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 593 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].command_);
 YYACCEPT;
   }
-#line 3136 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3136 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 5:
-#line 597 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 597 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 *parsedStatement = (yyvsp[-1].command_);
 YYACCEPT;
   }
-#line 3145 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3145 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 6:
-#line 601 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 601 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 YYABORT;
   }
-#line 3153 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3153 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 7:
-#line 604 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 604 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 // Regular yyparse() return codes are non-negative, so use a negative one 
here.
 return -1;
   }
-#line 3162 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3162 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 8:
-#line 611 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 611 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].statement_);
   }
-#line 3170 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3170 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 9:
-#line 614 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 614 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].copy_from_statement_);
   }
-#line 3178 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3178 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 10:
-#line 617 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 617 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].create_table_statement_);
   }
-#line 3186 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3186 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 11:
-#line 620 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 620 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].statement_);
   }
-#line 3194 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3194 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 12:
-#line 623 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 623 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].delete_statement_);
   }
-#line 3202 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3202 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 13:
-#line 626 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 626 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].drop_table_statement_);
   }
-#line 3210 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3210 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 14:
-#line 629 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 629 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].insert_statement_);
   }
-#line 3218 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3218 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 15:
-#line 632 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 632 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].quit_statement_);
   }
-#line 3226 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3226 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 16:
-#line 635 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 635 "../SqlParser.ypp" /* yacc.c:1646  */
 {
 (yyval.statement_) = (yyvsp[0].select_statement_);
   }
-#line 3234 "SqlParser_gen.cpp" /* yacc.c:1661  */
+#line 3234 "SqlParser_gen.cpp" /* yacc.c:1646  */
 break;
 
   case 17:
-#line 638 "../SqlParser.ypp" /* yacc.c:1661  */
+#line 638 "../SqlParser.ypp" /* yacc.c:1646  */
 

[3/3] incubator-quickstep git commit: Updated preprocessed lexer and parser files.

2016-06-23 Thread hakanmemisoglu
Updated preprocessed lexer and parser files.


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

Branch: refs/heads/decimal-type
Commit: 0a3e43f2941f73e5654347fd5b70d87b0a9df6e4
Parents: 2d17109
Author: Hakan Memisoglu 
Authored: Thu Jun 23 13:31:09 2016 -0500
Committer: Hakan Memisoglu 
Committed: Thu Jun 23 13:31:09 2016 -0500

--
 parser/preprocessed/SqlParser_gen.cpp | 1060 ++--
 parser/preprocessed/SqlParser_gen.hpp |4 +-
 2 files changed, 532 insertions(+), 532 deletions(-)
--




incubator-quickstep git commit: Changed proto decsription.

2016-06-21 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type aebb4a3bd -> cf33c724a


Changed proto decsription.


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

Branch: refs/heads/decimal-type
Commit: cf33c724a0b16168fd4f104bf166bc19abafbe46
Parents: aebb4a3
Author: Hakan Memisoglu 
Authored: Tue Jun 21 15:14:30 2016 -0500
Committer: Hakan Memisoglu 
Committed: Tue Jun 21 15:14:30 2016 -0500

--
 types/TypedValue.cpp | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cf33c724/types/TypedValue.cpp
--
diff --git a/types/TypedValue.cpp b/types/TypedValue.cpp
index e964400..2989c37 100644
--- a/types/TypedValue.cpp
+++ b/types/TypedValue.cpp
@@ -178,10 +178,15 @@ TypedValue TypedValue::ReconstructFromProto(const 
serialization::TypedValue 
   return proto.has_double_value() ?
   TypedValue(static_cast(proto.double_value())) :
   TypedValue(kDouble);
-case serialization::Type::DECIMAL:
-  return proto.has_decimal_value() ?
-  TypedValue(DecimalLit{proto.decimal_value()}) :
-  TypedValue(kDecimal);
+case serialization::Type::DECIMAL: {
+  if (proto.has_decimal_value()) {
+DecimalLit result;
+result.data_ = proto.decimal_value();
+return TypedValue(result);
+  } else {
+return TypedValue(kDecimal);
+  }
+}
 case serialization::Type::DATETIME:
   if (proto.has_datetime_value()) {
 DatetimeLit datetime;



incubator-quickstep git commit: New fixes.

2016-06-20 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 889c4805e -> 0acaf423a


New fixes.


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

Branch: refs/heads/decimal-type
Commit: 0acaf423a9fdfaf1d140252f55d824cc7457db65
Parents: 889c480
Author: Hakan Memisoglu 
Authored: Mon Jun 20 16:24:48 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Jun 20 16:24:48 2016 -0500

--
 types/DecimalLit.hpp| 80 ++--
 types/DecimalType.cpp   |  8 +-
 types/DecimalType.hpp   |  2 +-
 .../ArithmeticBinaryOperators.hpp   | 20 ++---
 .../comparisons/LiteralComparators.hpp  | 24 +++---
 5 files changed, 67 insertions(+), 67 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0acaf423/types/DecimalLit.hpp
--
diff --git a/types/DecimalLit.hpp b/types/DecimalLit.hpp
index c16a0f2..5d7b4a5 100644
--- a/types/DecimalLit.hpp
+++ b/types/DecimalLit.hpp
@@ -36,6 +36,40 @@ struct DecimalLit {
**/
   typedef std::int64_t data_type;
 
+  DecimalLit() = default;
+
+  explicit DecimalLit(const int value)
+: data_(static_cast(value * kMaxFractionInt)) {
+  }
+
+  explicit DecimalLit(const long value)
+: data_(static_cast(value * kMaxFractionInt)) {
+  }
+
+  explicit DecimalLit(const float value)
+: data_(static_cast(value * kMaxFractionInt)) {
+  }
+
+  explicit DecimalLit(const double value)
+: data_(static_cast(value * kMaxFractionInt)) {
+  }
+
+  inline explicit operator int() const {
+return static_cast(getIntegerPart());
+  }
+
+  inline explicit operator long() const {
+return static_cast(getIntegerPart());
+  }
+
+  inline explicit operator float() const {
+return static_cast(data_) / kMaxFractionInt;
+  }
+
+  inline explicit operator double() const {
+return static_cast(data_) / kMaxFractionInt;
+  }
+
   /**
* @brief Builder for DecimalLit.
*
@@ -43,9 +77,9 @@ struct DecimalLit {
*the DecimalLit.
* @return The resulting DecimalLit converted from the floating point.
**/
-  static DecimalLit fromDouble(const double value) {
-return DecimalLit{static_cast(value * kMaxFractionInt)};
-  }
+  //static DecimalLit fromDouble(const double value) {
+  //  return DecimalLit{static_cast(value * kMaxFractionInt)};
+  //}
 
   /**
* @brief Builder for DecimalLit.
@@ -54,9 +88,9 @@ struct DecimalLit {
*the DecimalLit.
* @return The resulting DecimalLit conveted from the integer number.
**/
-  static DecimalLit fromInt(const int64_t value) {
-return DecimalLit{static_cast(value * kMaxFractionInt)};
-  }
+  //static DecimalLit fromInt(const int64_t value) {
+  //  return DecimalLit{static_cast(value * kMaxFractionInt)};
+  //}
 
   data_type data_;
 
@@ -257,40 +291,6 @@ struct DecimalLit {
 data_ = (data_ * kMaxFractionInt) / other.data_;
 return *this;
   }
-
-  inline explicit operator int() const {
-return static_cast(getIntegerPart());
-  }
-
-  inline explicit operator long() const {
-return static_cast(getIntegerPart());
-  }
-
-  inline explicit operator double() const {
-return static_cast(data_) / kMaxFractionInt;
-  }
-
-  inline explicit operator float() const {
-return static_cast(data_) / kMaxFractionInt;
-  }
-
-  DecimalLit() = default;
-
-  explicit DecimalLit(const int value)
-: data_(static_cast(value * kMaxFractionInt)) {
-  }
-
-  explicit DecimalLit(const long value)
-: data_(static_cast(value * kMaxFractionInt)) {
-  }
-
-  explicit DecimalLit(const float value)
-: data_(static_cast(value * kMaxFractionInt)) {
-  }
-
-  explicit DecimalLit(const double value)
-: data_(static_cast(value * kMaxFractionInt)) {
-  }
 };
 
 //** @} */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0acaf423/types/DecimalType.cpp
--
diff --git a/types/DecimalType.cpp b/types/DecimalType.cpp
index 31ca76d..71283e3 100644
--- a/types/DecimalType.cpp
+++ b/types/DecimalType.cpp
@@ -56,11 +56,11 @@ TypedValue DecimalType::coerceValue(const TypedValue 
_value,
 
   switch (original_type.getTypeID()) {
 case kInt:
-  return TypedValue(DecimalLit::fromInt(original_value.getLiteral()));
+  return TypedValue(DecimalLit(original_value.getLiteral()));
 case kLong:
-  return 
TypedValue(DecimalLit::fromInt(original_value.getLiteral()));
+  

incubator-quickstep git commit: Fix in vector copy elision.

2016-06-20 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 85dab23c7 -> 889c4805e


Fix in vector copy elision.


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

Branch: refs/heads/decimal-type
Commit: 889c4805e661939a4881a1c096e2a70a494c1212
Parents: 85dab23
Author: Hakan Memisoglu 
Authored: Mon Jun 20 14:37:22 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Jun 20 14:37:22 2016 -0500

--
 types/operations/unary_operations/NumericCastOperation.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/889c4805/types/operations/unary_operations/NumericCastOperation.hpp
--
diff --git a/types/operations/unary_operations/NumericCastOperation.hpp 
b/types/operations/unary_operations/NumericCastOperation.hpp
index b77176d..9eb50c2 100644
--- a/types/operations/unary_operations/NumericCastOperation.hpp
+++ b/types/operations/unary_operations/NumericCastOperation.hpp
@@ -127,7 +127,7 @@ class UncheckedNumericCastOperator : public 
UncheckedUnaryOperator {
   result->appendNullValue();
 } else {
   *static_cast(result->getPtrForDirectWrite())
-  = static_cast(*scalar_arg);
+  = static_cast(*scalar_arg);
 }
   }
   return result;



incubator-quickstep git commit: default constructor for DecimalLit.

2016-06-20 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 8bb4c61ef -> 88306cbdb


default constructor for DecimalLit.


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

Branch: refs/heads/decimal-type
Commit: 88306cbdb9af99221fd6036f7307b96515abed39
Parents: 8bb4c61
Author: Hakan Memisoglu 
Authored: Mon Jun 20 14:03:11 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Jun 20 14:03:11 2016 -0500

--
 types/DecimalLit.hpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/88306cbd/types/DecimalLit.hpp
--
diff --git a/types/DecimalLit.hpp b/types/DecimalLit.hpp
index 33f701a..f73a939 100644
--- a/types/DecimalLit.hpp
+++ b/types/DecimalLit.hpp
@@ -274,9 +274,7 @@ struct DecimalLit {
 return static_cast(data_) / kMaxFractionInt;
   }
 
-  DecimalLit()
-: data_(0) {
-  }
+  DecimalLit() = default;
 
   explicit DecimalLit(const int value)
 : data_(value * kMaxFractionInt) {



incubator-quickstep git commit: DecimalLit conversions.

2016-06-20 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 7e668513f -> 85b0694b0


DecimalLit conversions.


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

Branch: refs/heads/decimal-type
Commit: 85b0694b0a3479add75ae5a0d4e379dbd35d4621
Parents: 7e66851
Author: Hakan Memisoglu 
Authored: Mon Jun 20 13:53:00 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Jun 20 13:53:00 2016 -0500

--
 types/DecimalLit.hpp | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/85b0694b/types/DecimalLit.hpp
--
diff --git a/types/DecimalLit.hpp b/types/DecimalLit.hpp
index b9f0508..7675788 100644
--- a/types/DecimalLit.hpp
+++ b/types/DecimalLit.hpp
@@ -258,21 +258,29 @@ struct DecimalLit {
 return *this;
   }
 
-  inline operator int() const {
+  inline explicit operator int() const {
 return static_cast(getIntegerPart());
   }
 
-  inline operator long() const {
+  inline explicit operator long() const {
 return static_cast(getIntegerPart());
   }
 
-  inline operator double() const {
+  inline explicit operator double() const {
 return static_cast(data_) / kMaxFractionInt;
   }
 
-  inline operator float() const {
+  inline explicit operator float() const {
 return static_cast(data_) / kMaxFractionInt;
   }
+
+  explicit DecimalLit(const int value)
+: data_(value * kMaxFractionInt) {
+  }
+
+  explicit DecimalLit(const long value)
+: data_(value * kMaxFractionInt) {
+  }
 };
 
 //** @} */



incubator-quickstep git commit: Include DecimalType in NumericCastOperation.

2016-06-20 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type f28c46ecc -> 169c1f37c


Include DecimalType in NumericCastOperation.


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

Branch: refs/heads/decimal-type
Commit: 169c1f37cfeb1d46d86af1f85cbc703215d22521
Parents: f28c46e
Author: Hakan Memisoglu 
Authored: Mon Jun 20 11:45:58 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Jun 20 11:45:58 2016 -0500

--
 types/operations/unary_operations/NumericCastOperation.hpp | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/169c1f37/types/operations/unary_operations/NumericCastOperation.hpp
--
diff --git a/types/operations/unary_operations/NumericCastOperation.hpp 
b/types/operations/unary_operations/NumericCastOperation.hpp
index 49da256..4aa2a2c 100644
--- a/types/operations/unary_operations/NumericCastOperation.hpp
+++ b/types/operations/unary_operations/NumericCastOperation.hpp
@@ -29,6 +29,7 @@
 #include "catalog/CatalogTypedefs.hpp"
 #include "storage/ValueAccessor.hpp"
 #include "storage/ValueAccessorUtil.hpp"
+#include "types/DecimalType.hpp"
 #include "types/DoubleType.hpp"
 #include "types/FloatType.hpp"
 #include "types/IntType.hpp"



incubator-quickstep git commit: Adding numeric cast for Decimal type.

2016-06-20 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 5815103db -> f28c46ecc


Adding numeric cast for Decimal type.


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

Branch: refs/heads/decimal-type
Commit: f28c46ecc9450ac01989df0082a8d74a24724b66
Parents: 5815103
Author: Hakan Memisoglu 
Authored: Mon Jun 20 11:35:01 2016 -0500
Committer: Hakan Memisoglu 
Committed: Mon Jun 20 11:35:01 2016 -0500

--
 .../unary_operations/NumericCastOperation.hpp   |  4 
 types/tests/DecimalType_unittest.cpp| 22 ++--
 2 files changed, 24 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f28c46ec/types/operations/unary_operations/NumericCastOperation.hpp
--
diff --git a/types/operations/unary_operations/NumericCastOperation.hpp 
b/types/operations/unary_operations/NumericCastOperation.hpp
index 250df6d..49da256 100644
--- a/types/operations/unary_operations/NumericCastOperation.hpp
+++ b/types/operations/unary_operations/NumericCastOperation.hpp
@@ -255,6 +255,8 @@ class NumericCastOperation : public UnaryOperation {
 return 
makeUncheckedUnaryOperatorHelperForSourceNullability(type);
   case kDouble:
 return 
makeUncheckedUnaryOperatorHelperForSourceNullability(type);
+  case kDecimal:
+return 
makeUncheckedUnaryOperatorHelperForSourceNullability(type);
   default:
 FATAL_ERROR("Unhandled type " << kTypeNames[type.getTypeID()]);
 }
@@ -285,6 +287,8 @@ class NumericCastOperation : public UnaryOperation {
 return 
makeUncheckedUnaryOperatorHelperForTargetNullability();
   case kDouble:
 return 
makeUncheckedUnaryOperatorHelperForTargetNullability();
+  case kDecimal:
+return 
makeUncheckedUnaryOperatorHelperForTargetNullability();
   default:
 FATAL_ERROR("Unhandled type " << kTypeNames[target_type_.getTypeID()]);
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f28c46ec/types/tests/DecimalType_unittest.cpp
--
diff --git a/types/tests/DecimalType_unittest.cpp 
b/types/tests/DecimalType_unittest.cpp
index 052848b..78a79ab 100644
--- a/types/tests/DecimalType_unittest.cpp
+++ b/types/tests/DecimalType_unittest.cpp
@@ -1,3 +1,22 @@
+/**
+ *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+ * University of Wisconsin—Madison.
+ *
+ *   Licensed 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 
+
 #include "types/DecimalLit.hpp"
 #include "types/DecimalType.hpp"
 #include "types/Type.hpp"
@@ -60,5 +79,4 @@ TEST(DecimalTypeTest, DecimalLitOperationsTest) {
 decimal_type.printValueToString(TypedValue(decimal_a % 
decimal_b)));
 }
 
-
-}
+}  // namespace quickstep



incubator-quickstep git commit: First part of the unit test.

2016-06-17 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 18f526050 -> 5815103db


First part of the unit test.


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

Branch: refs/heads/decimal-type
Commit: 5815103db00e978c156881d1f139244a28fa932d
Parents: 18f5260
Author: Hakan Memisoglu 
Authored: Fri Jun 17 16:06:23 2016 -0500
Committer: Hakan Memisoglu 
Committed: Fri Jun 17 16:06:23 2016 -0500

--
 types/CMakeLists.txt | 11 ++
 types/DecimalType.cpp|  4 +-
 types/tests/DecimalType_unittest.cpp | 64 +++
 3 files changed, 78 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5815103d/types/CMakeLists.txt
--
diff --git a/types/CMakeLists.txt b/types/CMakeLists.txt
index 9522ed6..16a6f1e 100644
--- a/types/CMakeLists.txt
+++ b/types/CMakeLists.txt
@@ -311,6 +311,17 @@ target_link_libraries(DatetimeType_unittest
   quickstep_utility_MemStream)
 add_test(DatetimeType_unittest DatetimeType_unittest)
 
+add_executable(DecimalType_unittest 
"${CMAKE_CURRENT_SOURCE_DIR}/tests/DecimalType_unittest.cpp")
+target_link_libraries(DecimalType_unittest
+  gtest
+  gtest_main
+  quickstep_types_DecimalLit
+  quickstep_types_DecimalType
+  quickstep_types_Type
+  quickstep_types_TypeFactory
+  quickstep_types_TypedValue)
+add_test(DecimalType_unittest DecimalType_unittest)
+
 add_executable(DoubleType_unittest 
"${CMAKE_CURRENT_SOURCE_DIR}/tests/DoubleType_unittest.cpp")
 target_link_libraries(DoubleType_unittest
   glog

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5815103d/types/DecimalType.cpp
--
diff --git a/types/DecimalType.cpp b/types/DecimalType.cpp
index 29c441a..31ca76d 100644
--- a/types/DecimalType.cpp
+++ b/types/DecimalType.cpp
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -74,7 +75,8 @@ std::string DecimalType::printValueToString(const TypedValue 
) const {
   DecimalLit decimal = value.getLiteral();
   std::stringstream ss;
   ss << decimal.getIntegerPart() << "."
- << decimal.getFractionalPart();
+ << std::setfill('0') << std::setw(DecimalLit::kPrecisionWidth)
+ <<  decimal.getFractionalPart();
   return ss.str();
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5815103d/types/tests/DecimalType_unittest.cpp
--
diff --git a/types/tests/DecimalType_unittest.cpp 
b/types/tests/DecimalType_unittest.cpp
new file mode 100644
index 000..052848b
--- /dev/null
+++ b/types/tests/DecimalType_unittest.cpp
@@ -0,0 +1,64 @@
+#include "types/DecimalLit.hpp"
+#include "types/DecimalType.hpp"
+#include "types/Type.hpp"
+#include "types/TypeFactory.hpp"
+#include "types/TypedValue.hpp"
+
+#include "gtest/gtest.h"
+
+namespace quickstep {
+
+TEST(DecimalTypeTest, PrintValueTest) {
+  const Type _type = TypeFactory::GetType(kDecimal);
+
+  // Try integer version.
+  DecimalLit integer_decimal = DecimalLit::fromInt(36509);
+  TypedValue value_for_integer_decimal(integer_decimal);
+  EXPECT_EQ(std::string("36509.00"),
+decimal_type.printValueToString(value_for_integer_decimal));
+
+  // Try double version.
+  DecimalLit double_decimal = DecimalLit::fromDouble(36509.65);
+  TypedValue value_for_double_decimal(double_decimal);
+  EXPECT_EQ(std::string("36509.65"),
+decimal_type.printValueToString(value_for_double_decimal));
+
+  // Try truncation of double version.
+  DecimalLit double_decimal_truncated = DecimalLit::fromDouble(36509.6526762);
+  TypedValue value_for_double_decimal_truncated(double_decimal_truncated);
+  EXPECT_EQ(std::string("36509.65"),
+decimal_type.printValueToString(
+value_for_double_decimal_truncated));
+
+  // Test that number is truncated, not rounded.
+  double_decimal_truncated = DecimalLit::fromDouble(36509.659);
+  TypedValue 
value_for_double_decimal_truncated_other(double_decimal_truncated);
+  EXPECT_EQ(std::string("36509.65"),
+decimal_type.printValueToString(
+value_for_double_decimal_truncated));
+}
+
+TEST(DecimalTypeTest, DecimalLitOperationsTest) {
+  const Type _type = 

incubator-quickstep git commit: Fixed bug where the wrong operator is used.

2016-06-16 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 4358b6edd -> 6b11fe0c2


Fixed bug where the wrong operator is used.


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

Branch: refs/heads/decimal-type
Commit: 6b11fe0c214fc3d3d849f0916ba67f40fb37ffdd
Parents: 4358b6e
Author: Hakan Memisoglu 
Authored: Thu Jun 16 12:03:13 2016 -0500
Committer: Hakan Memisoglu 
Committed: Thu Jun 16 12:03:13 2016 -0500

--
 types/operations/binary_operations/ArithmeticBinaryOperators.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6b11fe0c/types/operations/binary_operations/ArithmeticBinaryOperators.hpp
--
diff --git a/types/operations/binary_operations/ArithmeticBinaryOperators.hpp 
b/types/operations/binary_operations/ArithmeticBinaryOperators.hpp
index 9b9c3c9..8414da7 100644
--- a/types/operations/binary_operations/ArithmeticBinaryOperators.hpp
+++ b/types/operations/binary_operations/ArithmeticBinaryOperators.hpp
@@ -167,7 +167,7 @@ struct MultiplyFunctor {
 template <>
 struct MultiplyFunctor {
   inline DecimalLit operator() (const DecimalLit , const DecimalLit 
) const {
-return left / right;
+return left * right;
   }
 };
 



incubator-quickstep git commit: Introduced comparator functors for Decimal type.

2016-06-15 Thread hakanmemisoglu
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 400d268b9 -> 4358b6edd


Introduced comparator functors for Decimal type.


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

Branch: refs/heads/decimal-type
Commit: 4358b6eddd63016f665f0774833ce1d0b81cbee5
Parents: 400d268
Author: Hakan Memisoglu 
Authored: Wed Jun 15 16:23:24 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Jun 15 16:23:24 2016 -0500

--
 types/operations/comparisons/ComparisonUtil.hpp | 104 +++
 1 file changed, 104 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4358b6ed/types/operations/comparisons/ComparisonUtil.hpp
--
diff --git a/types/operations/comparisons/ComparisonUtil.hpp 
b/types/operations/comparisons/ComparisonUtil.hpp
index d7da3fd..2e381b7 100644
--- a/types/operations/comparisons/ComparisonUtil.hpp
+++ b/types/operations/comparisons/ComparisonUtil.hpp
@@ -149,6 +149,11 @@ auto InvokeOnLessComparatorForTypeIgnoreNullability(const 
Type ,
  double, false> comp;
   return functor(comp);
 }
+case kDecimal: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
 case kChar: {
   const std::size_t string_length
   = static_cast(type).getStringLength();
@@ -254,6 +259,10 @@ auto 
InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
   LessLiteralUncheckedComparator comp;
   return functor(comp);
 }
+case kDecimal: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
 default:
   return 
comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
   left_type, right_type, functor);
@@ -280,6 +289,11 @@ auto 
InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
  double, false> comp;
   return functor(comp);
 }
+case kDecimal: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
 default:
   return 
comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
   left_type, right_type, functor);
@@ -303,6 +317,10 @@ auto 
InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
   LessLiteralUncheckedComparator comp;
   return functor(comp);
 }
+case kDecimal: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
 default:
   return 
comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
   left_type, right_type, functor);
@@ -326,6 +344,37 @@ auto 
InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
   LessLiteralUncheckedComparator comp;
   return functor(comp);
 }
+case kDecimal: {
+  LessLiteralUncheckedComparator 
comp;
+  return functor(comp);
+}
+default:
+  return 
comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
+  left_type, right_type, functor);
+  }
+}
+case kDecimal: {
+  switch (right_type.getTypeID()) {
+case kInt: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
+case kLong: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
+case kFloat: {
+  LessLiteralUncheckedComparator comp;
+  return functor(comp);
+}
+case kDouble: {
+  LessLiteralUncheckedComparator 
comp;
+  return functor(comp);
+}
+case kDecimal: {
+  LessLiteralUncheckedComparator 
comp;
+  return functor(comp);
+}
 default:
   return 
comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
   left_type, 

[27/50] [abbrv] incubator-quickstep git commit: Reordered Query ID in operators and work orders.

2016-06-15 Thread hakanmemisoglu
Reordered Query ID in operators and work orders.


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

Branch: refs/heads/decimal-type
Commit: 1be47dcbd79e6e2ee01f237d0dbaa8a97e562519
Parents: 4054268
Author: Harshad Deshmukh 
Authored: Fri Jun 3 15:40:34 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 14:00:13 2016 -0700

--
 query_execution/Foreman.cpp |  12 +-
 query_execution/QueryManager.cpp|  12 +-
 query_execution/tests/Foreman_unittest.cpp  |   3 +-
 query_execution/tests/QueryManager_unittest.cpp |   3 +-
 query_optimizer/ExecutionGenerator.cpp  | 194 
 .../tests/ExecutionHeuristics_unittest.cpp  |  34 +--
 relational_operators/AggregationOperator.cpp|   4 +-
 relational_operators/AggregationOperator.hpp|  14 +-
 relational_operators/BuildHashOperator.cpp  |   6 +-
 relational_operators/BuildHashOperator.hpp  |  20 +-
 relational_operators/CreateIndexOperator.hpp|   6 +-
 relational_operators/DeleteOperator.cpp |   8 +-
 relational_operators/DeleteOperator.hpp |  14 +-
 relational_operators/DestroyHashOperator.cpp|   2 +-
 relational_operators/DestroyHashOperator.hpp|  12 +-
 relational_operators/DropTableOperator.hpp  |   6 +-
 .../FinalizeAggregationOperator.hpp |  11 +-
 relational_operators/HashJoinOperator.cpp   |  31 +--
 relational_operators/HashJoinOperator.hpp   | 229 ++-
 relational_operators/InsertOperator.hpp |  11 +-
 .../NestedLoopsJoinOperator.cpp |  45 ++--
 .../NestedLoopsJoinOperator.hpp |  52 +++--
 relational_operators/RebuildWorkOrder.hpp   |  15 +-
 relational_operators/RelationalOperator.hpp |  11 +-
 relational_operators/SampleOperator.cpp |  52 +++--
 relational_operators/SampleOperator.hpp |  39 ++--
 relational_operators/SaveBlocksOperator.cpp |   2 +-
 relational_operators/SaveBlocksOperator.hpp |   9 +-
 relational_operators/SelectOperator.cpp |  27 ++-
 relational_operators/SelectOperator.hpp |  56 ++---
 relational_operators/SortMergeRunOperator.cpp   |   2 +-
 relational_operators/SortMergeRunOperator.hpp   |  27 +--
 .../SortRunGenerationOperator.cpp   |   6 +-
 .../SortRunGenerationOperator.hpp   |  26 ++-
 relational_operators/TableGeneratorOperator.cpp |   2 +-
 relational_operators/TableGeneratorOperator.hpp |  20 +-
 relational_operators/TextScanOperator.cpp   |  21 +-
 relational_operators/TextScanOperator.hpp   |  32 +--
 relational_operators/UpdateOperator.cpp |  22 +-
 relational_operators/UpdateOperator.hpp |  37 +--
 relational_operators/WorkOrderFactory.cpp   |  38 +--
 .../tests/AggregationOperator_unittest.cpp  |  23 +-
 .../tests/HashJoinOperator_unittest.cpp | 181 ---
 .../tests/SortMergeRunOperator_unittest.cpp |  14 +-
 .../SortRunGenerationOperator_unittest.cpp  |  16 +-
 .../tests/TextScanOperator_unittest.cpp |   7 +-
 46 files changed, 745 insertions(+), 669 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1be47dcb/query_execution/Foreman.cpp
--
diff --git a/query_execution/Foreman.cpp b/query_execution/Foreman.cpp
index b358f70..7705819 100644
--- a/query_execution/Foreman.cpp
+++ b/query_execution/Foreman.cpp
@@ -521,12 +521,12 @@ void Foreman::getRebuildWorkOrders(const dag_node_index 
index, WorkOrdersContain
 // Note: The query ID used below is dummy for now, it will be replaced with
 // the true query ID when QueryManager gets used in Foreman.
 container->addRebuildWorkOrder(
-new RebuildWorkOrder(move(partially_filled_block_refs[i]),
-index,
-op.getOutputRelationID(),
-foreman_client_id_,
-0,
-bus_),
+new RebuildWorkOrder(0,
+ move(partially_filled_block_refs[i]),
+ index,
+ op.getOutputRelationID(),
+ foreman_client_id_,
+ bus_),
 index);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1be47dcb/query_execution/QueryManager.cpp
--
diff --git 

[41/50] [abbrv] incubator-quickstep git commit: Long lived Foreman thread

2016-06-15 Thread hakanmemisoglu
Long lived Foreman thread

- Foreman thread lives through the lifetime of the Quickstep process.
- Foreman and main thread communicate through TMB messages.
- Foreman admits queries and routes them to PolicyEnforcer.
- Foreman relays messages to policy enforcer which in turn processes it,
  based on the query ID of the message.
- All the tests modified accordingly.

Created PolicyEnforcer class.

- First point of entry for queries in the scheduler.
- Can perform admission control.
- Can talk to the QueryManagers of the active queries to provide them
  messages to process and collect work orders for execution from them.
- Support for admitting multiple queries to the PolicyEnforcer.


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

Branch: refs/heads/decimal-type
Commit: 8230b12495297b6837a66485119da44d8fb95a26
Parents: 659967a
Author: Harshad Deshmukh 
Authored: Sat Apr 9 15:08:40 2016 -0500
Committer: Harshad Deshmukh 
Committed: Sun Jun 12 09:18:14 2016 -0500

--
 CMakeLists.txt  |   2 +
 catalog/CatalogTypedefs.hpp |   3 +
 cli/CommandExecutor.cpp |  53 +-
 cli/CommandExecutor.hpp |  11 +-
 cli/QuickstepCli.cpp|  66 +-
 cli/tests/CMakeLists.txt|   2 +
 cli/tests/CommandExecutorTestRunner.cpp |  29 +-
 cli/tests/CommandExecutorTestRunner.hpp |  37 +-
 query_execution/AdmitRequestMessage.hpp |  73 ++
 query_execution/CMakeLists.txt  |  70 +-
 query_execution/Foreman.cpp | 578 +++
 query_execution/Foreman.hpp | 393 +---
 query_execution/PolicyEnforcer.cpp  | 183 
 query_execution/PolicyEnforcer.hpp  | 167 
 query_execution/QueryContext.cpp|  16 +-
 query_execution/QueryContext.proto  |   2 +
 query_execution/QueryExecutionMessages.proto|   4 +
 query_execution/QueryExecutionTypedefs.hpp  |   5 +-
 query_execution/QueryExecutionUtil.hpp  |  52 +
 query_execution/QueryManager.hpp|   5 +-
 query_execution/WorkOrdersContainer.hpp |  70 +-
 query_execution/Worker.cpp  |  11 +-
 query_execution/Worker.hpp  |   2 +
 query_execution/WorkerMessage.hpp   |  24 +-
 query_execution/tests/Foreman_unittest.cpp  | 952 ---
 query_execution/tests/QueryManager_unittest.cpp |   7 +-
 .../tests/WorkOrdersContainer_unittest.cpp  |  26 +
 query_optimizer/ExecutionGenerator.hpp  |   1 +
 query_optimizer/tests/CMakeLists.txt|   2 +
 .../tests/ExecutionGeneratorTestRunner.cpp  |  21 +-
 .../tests/ExecutionGeneratorTestRunner.hpp  |  33 +-
 query_optimizer/tests/TestDatabaseLoader.cpp|   1 +
 relational_operators/DeleteOperator.cpp |   1 +
 relational_operators/DeleteOperator.hpp |   1 +
 relational_operators/HashJoinOperator.hpp   |   4 +-
 relational_operators/RebuildWorkOrder.hpp   |   1 +
 relational_operators/SortMergeRunOperator.cpp   |   1 +
 relational_operators/UpdateOperator.cpp |   1 +
 relational_operators/UpdateOperator.hpp |   1 +
 relational_operators/WorkOrder.hpp  |  20 +-
 .../tests/AggregationOperator_unittest.cpp  |   4 +
 .../tests/HashJoinOperator_unittest.cpp |   6 +
 .../tests/SortMergeRunOperator_unittest.cpp |   4 +
 .../SortRunGenerationOperator_unittest.cpp  |   1 +
 .../tests/TextScanOperator_unittest.cpp |   1 +
 storage/InsertDestination.cpp   |  50 +-
 storage/InsertDestination.hpp   |  71 +-
 47 files changed, 1064 insertions(+), 2004 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/8230b124/CMakeLists.txt
--
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 207f313..9e445f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -721,9 +721,11 @@ target_link_libraries(quickstep_cli_shell
   quickstep_cli_PrintToScreen
   quickstep_parser_ParseStatement
   quickstep_parser_SqlParserWrapper
+  quickstep_queryexecution_AdmitRequestMessage
   quickstep_queryexecution_Foreman
   quickstep_queryexecution_QueryContext
   quickstep_queryexecution_QueryExecutionTypedefs
+  

[48/50] [abbrv] incubator-quickstep git commit: New type for fixed precision number: Decimal.

2016-06-15 Thread hakanmemisoglu
New type for fixed precision number: Decimal.


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

Branch: refs/heads/decimal-type
Commit: 5aa559310b017f03e9ef648980f47198ba2e6e9c
Parents: 4931623
Author: Hakan Memisoglu 
Authored: Tue May 31 13:14:42 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Jun 15 14:46:25 2016 -0500

--
 parser/SqlParser.ypp|   2 +-
 types/CMakeLists.txt|  16 +++
 types/DecimalLit.hpp| 131 +++
 types/DecimalType.cpp   | 115 
 types/DecimalType.hpp   | 121 +
 types/NumericSuperType.hpp  |   2 +-
 types/NumericTypeUnifier.hpp|  46 +++
 types/Type.cpp  |   3 +
 types/Type.hpp  |   3 +
 types/Type.proto|   9 +-
 types/TypeFactory.cpp   |  10 ++
 types/TypeFactory.hpp   |   1 +
 types/TypeID.cpp|   1 +
 types/TypeID.hpp|   1 +
 types/TypedValue.cpp|  11 ++
 types/TypedValue.hpp|  21 +++
 types/TypedValue.proto  |   7 +-
 .../binary_operations/AddBinaryOperation.cpp|  10 +-
 .../ArithmeticBinaryOperation.hpp   |  19 +++
 .../ArithmeticBinaryOperators.hpp   | 106 +++
 .../operations/binary_operations/CMakeLists.txt |   2 +
 .../binary_operations/DivideBinaryOperation.cpp |   7 +-
 .../binary_operations/ModuloBinaryOperation.cpp |  13 ++
 .../MultiplyBinaryOperation.cpp |  12 +-
 .../SubtractBinaryOperation.cpp |   9 +-
 .../operations/comparisons/BasicComparison.cpp  |   4 +-
 .../operations/comparisons/BasicComparison.hpp  |  22 +++-
 types/operations/comparisons/CMakeLists.txt |   1 +
 .../comparisons/LiteralComparators.hpp  | 127 ++
 29 files changed, 812 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5aa55931/parser/SqlParser.ypp
--
diff --git a/parser/SqlParser.ypp b/parser/SqlParser.ypp
index b07c48e..eb2d0cf 100644
--- a/parser/SqlParser.ypp
+++ b/parser/SqlParser.ypp
@@ -730,7 +730,7 @@ data_type:
 $$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetime));
   }
   | TOKEN_DECIMAL {
-$$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));
+$$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDecimal));
   }
   | TOKEN_REAL {
 $$ = new 
quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/5aa55931/types/CMakeLists.txt
--
diff --git a/types/CMakeLists.txt b/types/CMakeLists.txt
index 0ccdfd7..eb2d4ba 100644
--- a/types/CMakeLists.txt
+++ b/types/CMakeLists.txt
@@ -35,6 +35,8 @@ add_library(quickstep_types_DateOperatorOverloads 
../empty_src.cpp DateOperatorO
 add_library(quickstep_types_DatetimeIntervalType DatetimeIntervalType.cpp 
DatetimeIntervalType.hpp)
 add_library(quickstep_types_DatetimeLit ../empty_src.cpp DatetimeLit.hpp)
 add_library(quickstep_types_DatetimeType DatetimeType.cpp DatetimeType.hpp)
+add_library(quickstep_types_DecimalLit ../empty_src.cpp DecimalLit.hpp)
+add_library(quickstep_types_DecimalType DecimalType.cpp DecimalType.hpp)
 add_library(quickstep_types_DoubleType DoubleType.cpp DoubleType.hpp)
 add_library(quickstep_types_FloatType FloatType.cpp FloatType.hpp)
 add_library(quickstep_types_IntType IntType.cpp IntType.hpp)
@@ -94,6 +96,16 @@ target_link_libraries(quickstep_types_DatetimeType
   quickstep_types_port_timegm
   quickstep_utility_CheckSnprintf
   quickstep_utility_Macros)
+target_link_libraries(quickstep_types_DecimalType
+  glog
+  quickstep_types_DecimalLit
+  quickstep_types_NullCoercibilityCheckMacro
+  quickstep_types_NumericSuperType
+  quickstep_types_Type
+  quickstep_types_TypeID
+  

[36/50] [abbrv] incubator-quickstep git commit: QUICKSTEP-10: Serialized WorkOrders as proto.

2016-06-15 Thread hakanmemisoglu
QUICKSTEP-10: Serialized WorkOrders as proto.


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

Branch: refs/heads/decimal-type
Commit: c9214ecb1d481b3d1b02db0ffdf53852b11b540f
Parents: ccd11c0
Author: Zuyu Zhang 
Authored: Tue Apr 12 16:55:48 2016 -0700
Committer: Zuyu Zhang 
Committed: Thu Jun 9 17:06:02 2016 -0700

--
 query_execution/CMakeLists.txt  |   6 +
 query_execution/WorkOrderProtosContainer.hpp| 146 +++
 query_execution/tests/Foreman_unittest.cpp  |   6 +
 query_execution/tests/QueryManager_unittest.cpp |   6 +
 relational_operators/AggregationOperator.cpp|  34 +
 relational_operators/AggregationOperator.hpp|  12 ++
 relational_operators/BuildHashOperator.cpp  |  40 +
 relational_operators/BuildHashOperator.hpp  |  12 ++
 relational_operators/CMakeLists.txt |  36 -
 relational_operators/CreateIndexOperator.hpp|   9 ++
 relational_operators/CreateTableOperator.hpp|   8 +
 relational_operators/DeleteOperator.cpp |  38 -
 relational_operators/DeleteOperator.hpp |  14 +-
 relational_operators/DestroyHashOperator.cpp|  17 +++
 relational_operators/DestroyHashOperator.hpp|   3 +
 relational_operators/DropTableOperator.cpp  |  23 +++
 relational_operators/DropTableOperator.hpp  |   3 +
 .../FinalizeAggregationOperator.cpp |  20 +++
 .../FinalizeAggregationOperator.hpp |   3 +
 relational_operators/HashJoinOperator.cpp   | 124 
 relational_operators/HashJoinOperator.hpp   |  21 +++
 relational_operators/InsertOperator.cpp |  19 +++
 relational_operators/InsertOperator.hpp |   3 +
 .../NestedLoopsJoinOperator.cpp | 142 ++
 .../NestedLoopsJoinOperator.hpp |  51 +++
 relational_operators/RelationalOperator.hpp |  22 +++
 relational_operators/SampleOperator.cpp | 101 ++---
 relational_operators/SampleOperator.hpp |  12 ++
 relational_operators/SaveBlocksOperator.cpp |  18 +++
 relational_operators/SaveBlocksOperator.hpp |   3 +
 relational_operators/SelectOperator.cpp |  43 ++
 relational_operators/SelectOperator.hpp |  12 ++
 relational_operators/SortMergeRunOperator.cpp   |  68 +
 relational_operators/SortMergeRunOperator.hpp   |  12 ++
 .../SortRunGenerationOperator.cpp   |  39 +
 .../SortRunGenerationOperator.hpp   |  12 ++
 relational_operators/TableGeneratorOperator.cpp |  20 ++-
 relational_operators/TableGeneratorOperator.hpp |   5 +-
 relational_operators/TextScanOperator.cpp   | 125 
 relational_operators/TextScanOperator.hpp   |  24 ++-
 relational_operators/TextScanOperator.proto |  22 ---
 relational_operators/UpdateOperator.cpp |  23 +++
 relational_operators/UpdateOperator.hpp |   3 +
 relational_operators/WorkOrder.proto|  21 +--
 relational_operators/WorkOrderFactory.cpp   |   7 +-
 45 files changed, 1291 insertions(+), 97 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c9214ecb/query_execution/CMakeLists.txt
--
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
index 8306f78..95bc0d6 100644
--- a/query_execution/CMakeLists.txt
+++ b/query_execution/CMakeLists.txt
@@ -42,6 +42,7 @@ add_library(quickstep_queryexecution_QueryExecutionState 
../empty_src.cpp QueryE
 add_library(quickstep_queryexecution_QueryExecutionTypedefs ../empty_src.cpp 
QueryExecutionTypedefs.hpp)
 add_library(quickstep_queryexecution_QueryExecutionUtil ../empty_src.cpp 
QueryExecutionUtil.hpp)
 add_library(quickstep_queryexecution_QueryManager QueryManager.cpp 
QueryManager.hpp)
+add_library(quickstep_queryexecution_WorkOrderProtosContainer ../empty_src.cpp 
WorkOrderProtosContainer.hpp)
 add_library(quickstep_queryexecution_WorkOrdersContainer 
WorkOrdersContainer.cpp WorkOrdersContainer.hpp)
 add_library(quickstep_queryexecution_Worker Worker.cpp Worker.hpp)
 add_library(quickstep_queryexecution_WorkerDirectory ../empty_src.cpp 
WorkerDirectory.hpp)
@@ -157,6 +158,10 @@ target_link_libraries(quickstep_queryexecution_QueryManager
   quickstep_utility_DAG
   quickstep_utility_Macros
   tmb)
+target_link_libraries(quickstep_queryexecution_WorkOrderProtosContainer
+  glog
+  

[43/50] [abbrv] incubator-quickstep git commit: Add a shell script that logs the build process for later profiling.

2016-06-15 Thread hakanmemisoglu
Add a shell script that logs the build process for later profiling.


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

Branch: refs/heads/decimal-type
Commit: 07c011d27da2e8b14551b439a11e6002fd33c5fa
Parents: 540c09e
Author: Navneet Potti 
Authored: Thu Jun 9 11:18:26 2016 -0500
Committer: Zuyu Zhang 
Committed: Mon Jun 13 15:26:34 2016 -0700

--
 build/profile_build.sh | 104 
 1 file changed, 104 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/07c011d2/build/profile_build.sh
--
diff --git a/build/profile_build.sh b/build/profile_build.sh
new file mode 100755
index 000..5f2fc33
--- /dev/null
+++ b/build/profile_build.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+# This script may be useful for developers to profile the build process itself.
+#
+# This shell script runs CMake and make, dumping all output into a log file.
+# It also logs the CPU usage and memory information during the build.
+# All log messages are timestamped to enable profiling.
+#
+# Dependencies:
+# - ts
+# sudo apt-get install -y libtime-duration-perl moreutils
+# - vmstat and mpstat
+# sudo apt-get install -y sysstat
+#
+# Usage: ./profile_build.sh
+# Set the CMake and make command you want to use below.
+# If CMakeLists.txt is detected, the script exits because in-source-tree build
+# is not supported.
+# If CMakeCache.txt is detected, the script skips cmake and runs make only.
+
+#   Licensed 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.
+
+set -e
+
+CMAKE_COMMAND="cmake \
+-D BUILD_SHARED_LIBS=On \
+-D USE_TCMALLOC=0 \
+-D CMAKE_BUILD_TYPE=Debug \
+.. "
+MAKE_COMMAND="make VERBOSE=1"
+LOG_FILENAME=$LOG_FILENAME
+
+# Continuously dump memory usage and cpu load info to files for later analysis
+function start_stat_collectors {
+  rm -f stats_*.txt
+  vmstat -SM 3 | ts "%.s (%H:%M:%S)" > stats_mem.txt 3>&1 &
+  PID_vmstat=$!
+  mpstat 3 | ts "%.s (%H:%M:%S)" > stats_cpu.txt 2>&1  &
+  PID_mpstat=$!
+}
+
+function kill_stat_collectors {
+  kill $PID_vmstat
+  kill $PID_mpstat
+  exit
+}
+
+function check_directory {
+  if [[ -f CMakeLists.txt ]]; then
+echo "Running the build in the source tree is not supported."
+exit 1
+  fi
+}
+
+function log_repo_version_info {
+  git log master... >> $LOG_FILENAME
+  git diff master >> $LOG_FILENAME
+}
+
+function run_cmake {
+  if [[ ! -f CMakeCache.txt ]]; then
+echo "$CMAKE_COMMAND" | tee -a $LOG_FILENAME
+$CMAKE_COMMAND 2>&1 | ts "%.s (%H:%M:%S)" | tee -a $LOG_FILENAME
+  else
+echo "CMakeCache.txt detected. Not running CMake again."
+  fi
+}
+
+function run_make {
+  echo "$MAKE_COMMAND" | tee -a $LOG_FILENAME
+  $MAKE_COMMAND 2>&1 | ts "%.s (%H:%M:%S)" | tee -a $LOG_FILENAME
+}
+
+function print_stats {
+  avg_mem=`grep -v r stats_mem.txt | tr -s ' ' | awk -F " " '{s+= $6; c++} END 
{print s/c/1024}'`
+  echo -e "\n\n"
+  echo "Average memory used was $avg_mem GB"  | tee -a $LOG_FILENAME
+
+  time_taken=`expr $END_TIME - $START_TIME`
+  mins=`expr $time_taken / 60`
+  secs=`expr $time_taken % 60`
+  echo "Time taken was ${mins}m ${secs}s" | tee -a $LOG_FILENAME
+}
+
+check_directory
+echo "Starting build in " `pwd`  >> $LOG_FILENAME
+start_stat_collectors
+trap kill_stat_collectors SIGHUP SIGINT SIGTERM
+
+START_TIME=`date +"%s"`
+run_cmake
+run_make
+END_TIME=`date +"%s"`
+kill_stat_collectors
+print_stats



[38/50] [abbrv] incubator-quickstep git commit: Test the default vector elision level `selection` in CI.

2016-06-15 Thread hakanmemisoglu
Test the default vector elision level `selection` in CI.


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

Branch: refs/heads/decimal-type
Commit: 659967a96c597ec6c54d277d79e563e7d736d8a0
Parents: e40e3ba
Author: Jignesh Patel 
Authored: Fri Jun 10 12:40:15 2016 -0500
Committer: Zuyu Zhang 
Committed: Fri Jun 10 11:00:08 2016 -0700

--
 .travis.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/659967a9/.travis.yml
--
diff --git a/.travis.yml b/.travis.yml
index 142dfce..fce3ba0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,8 +17,8 @@ compiler:
 env:
   - BUILD_TYPE=Debug VECTOR_COPY_ELISION_LEVEL=joinwithbinaryexpressions
   - BUILD_TYPE=Release VECTOR_COPY_ELISION_LEVEL=joinwithbinaryexpressions
-  - BUILD_TYPE=Debug VECTOR_COPY_ELISION_LEVEL=none
-  - BUILD_TYPE=Release VECTOR_COPY_ELISION_LEVEL=none
+  - BUILD_TYPE=Debug VECTOR_COPY_ELISION_LEVEL=selection
+  - BUILD_TYPE=Release VECTOR_COPY_ELISION_LEVEL=selection
 
 before_install:
   - LLVM_VERSION=3.7.1
@@ -34,7 +34,7 @@ before_install:
 fi
 
 install:
-  - if [ "$VECTOR_COPY_ELISION_LEVEL" = "joinwithbinaryexpressions" ] && [ 
"$CC" = "gcc" ]; then
+  - if [ "$CC" = "gcc" ]; then
   export MAKE_JOBS=1;
 else
   export MAKE_JOBS=2;



[05/50] [abbrv] incubator-quickstep git commit: Fixed a g++ compiler warning (#221)

2016-06-15 Thread hakanmemisoglu
Fixed a g++ compiler warning (#221)

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

Branch: refs/heads/decimal-type
Commit: 43f16262f55126a0c2c27bf4785473dfc6e5bc46
Parents: 7131b0c
Author: Marc S 
Authored: Wed May 11 14:34:37 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:43 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/43f16262/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 7f26e85..7209cfa 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -588,8 +588,8 @@ void ExecutionGenerator::convertHashJoin(const 
P::HashJoinPtr _plan) {
   std::vector probe_original_attribute_ids;
   std::vector build_original_attribute_ids;
 
-  const CatalogRelation *referenced_stored_probe_relation;
-  const CatalogRelation *referenced_stored_build_relation;
+  const CatalogRelation *referenced_stored_probe_relation = nullptr;
+  const CatalogRelation *referenced_stored_build_relation = nullptr;
 
   bool any_probe_attributes_nullable = false;
   bool any_build_attributes_nullable = false;



[31/50] [abbrv] incubator-quickstep git commit: Add options to build gflag as a shared library.

2016-06-15 Thread hakanmemisoglu
Add options to build gflag as a shared library.


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

Branch: refs/heads/decimal-type
Commit: 096abe29ab8f8510b177168f9e492f59b10e49f5
Parents: 2d39b8e
Author: Navneet Potti 
Authored: Wed Jun 8 16:59:07 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 20:30:29 2016 -0700

--
 CMakeLists.txt   |  8 +++-
 cli/CMakeLists.txt   |  8 +++-
 query_execution/CMakeLists.txt   |  8 +++-
 query_optimizer/CMakeLists.txt   |  8 +++-
 query_optimizer/tests/CMakeLists.txt | 10 --
 relational_operators/CMakeLists.txt  | 20 +---
 storage/CMakeLists.txt   | 12 +---
 transaction/CMakeLists.txt   |  8 +++-
 8 files changed, 65 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/CMakeLists.txt
--
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef7fd50..2d10a78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,6 +139,12 @@ endif()
 
 option(ENABLE_DISTRIBUTED "Use the distributed version of Quickstep" OFF)
 
+if (BUILD_SHARED_LIBS)
+  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
+else()
+  set(GFLAGS_LIB_NAME gflags_nothreads-static)
+endif()
+
 # Turn on the QUICKSTEP_DEBUG flag in the source if this is a debug build.
 if (CMAKE_MAJOR_VERSION GREATER 2)
   cmake_policy(SET CMP0043 NEW)
@@ -700,7 +706,7 @@ add_subdirectory(yarn)
 add_executable (quickstep_cli_shell cli/QuickstepCli.cpp)
 # Link against direct deps (will transitively pull in everything needed).
 target_link_libraries(quickstep_cli_shell
-  gflags_nothreads-static
+  ${GFLAGS_LIB_NAME}
   glog
   quickstep_catalog_CatalogRelation
   quickstep_cli_CommandExecutor

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/cli/CMakeLists.txt
--
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
index 8fee7a4..faf5040 100644
--- a/cli/CMakeLists.txt
+++ b/cli/CMakeLists.txt
@@ -30,6 +30,12 @@ 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()
+
 configure_file (
   "${CMAKE_CURRENT_SOURCE_DIR}/CliConfig.h.in"
   "${CMAKE_CURRENT_BINARY_DIR}/CliConfig.h"
@@ -110,7 +116,7 @@ target_link_libraries(quickstep_cli_InputParserUtil
   ${LIBNUMA_LIBRARY})
 endif()
 target_link_libraries(quickstep_cli_PrintToScreen
-  gflags_nothreads-static
+  ${GFLAGS_LIB_NAME}
   quickstep_catalog_CatalogAttribute
   quickstep_catalog_CatalogRelation
   quickstep_storage_StorageBlock

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/query_execution/CMakeLists.txt
--
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
index 7d9d601..8306f78 100644
--- a/query_execution/CMakeLists.txt
+++ b/query_execution/CMakeLists.txt
@@ -19,6 +19,12 @@ 
QS_PROTOBUF_GENERATE_CPP(queryexecution_QueryExecutionMessages_proto_srcs
  queryexecution_QueryExecutionMessages_proto_hdrs
  QueryExecutionMessages.proto)
 
+if (BUILD_SHARED_LIBS)
+  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
+else()
+  set(GFLAGS_LIB_NAME gflags_nothreads-static)
+endif()
+
 # Declare micro-libs:
 if (ENABLE_DISTRIBUTED)
   add_library(quickstep_queryexecution_BlockLocator BlockLocator.cpp 
BlockLocator.hpp)
@@ -202,7 +208,7 @@ if (ENABLE_DISTRIBUTED)
   add_executable(BlockLocator_unittest
  "${CMAKE_CURRENT_SOURCE_DIR}/tests/BlockLocator_unittest.cpp")
   target_link_libraries(BlockLocator_unittest
-gflags_nothreads-static
+${GFLAGS_LIB_NAME}
 glog
 gtest
 quickstep_catalog_CatalogAttribute

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/096abe29/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 

[10/50] [abbrv] incubator-quickstep git commit: Change the default value of Joined Tuple Collector (#226)

2016-06-15 Thread hakanmemisoglu
Change the default value of Joined Tuple Collector (#226)

On NUMA boxes, the vector based joined tuple collector slows down queries.

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

Branch: refs/heads/decimal-type
Commit: aa76e4827adea01c46502fdb3f1c5cec30a81b9f
Parents: 205aa4f
Author: Jignesh Patel 
Authored: Wed May 18 11:56:53 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:44 2016 -0700

--
 relational_operators/HashJoinOperator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/aa76e482/relational_operators/HashJoinOperator.cpp
--
diff --git a/relational_operators/HashJoinOperator.cpp 
b/relational_operators/HashJoinOperator.cpp
index 104a02d..aa03794 100644
--- a/relational_operators/HashJoinOperator.cpp
+++ b/relational_operators/HashJoinOperator.cpp
@@ -59,7 +59,7 @@ namespace quickstep {
 
 namespace {
 
-DEFINE_bool(vector_based_joined_tuple_collector, true,
+DEFINE_bool(vector_based_joined_tuple_collector, false,
 "If true, use simple vector-based joined tuple collector in "
 "hash join, with a final sort pass to group joined tuple pairs "
 "by inner block. If false, use unordered_map based collector that "



[44/50] [abbrv] incubator-quickstep git commit: Fix bug: specify log file name correctly

2016-06-15 Thread hakanmemisoglu
Fix bug: specify log file name correctly


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

Branch: refs/heads/decimal-type
Commit: 31e9e4cefb2a9fffd42138fcd40543f915ed07bb
Parents: 07c011d
Author: Navneet 
Authored: Mon Jun 13 18:34:40 2016 -0500
Committer: Navneet 
Committed: Mon Jun 13 18:39:29 2016 -0500

--
 build/profile_build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/31e9e4ce/build/profile_build.sh
--
diff --git a/build/profile_build.sh b/build/profile_build.sh
index 5f2fc33..b7164ad 100755
--- a/build/profile_build.sh
+++ b/build/profile_build.sh
@@ -37,7 +37,7 @@ CMAKE_COMMAND="cmake \
 -D CMAKE_BUILD_TYPE=Debug \
 .. "
 MAKE_COMMAND="make VERBOSE=1"
-LOG_FILENAME=$LOG_FILENAME
+LOG_FILENAME=build.log
 
 # Continuously dump memory usage and cpu load info to files for later analysis
 function start_stat_collectors {



[46/50] [abbrv] incubator-quickstep git commit: Part I of a sequence of changes to bring the NOTICE and Copyright in line with ASF guidelines

2016-06-15 Thread hakanmemisoglu
Part I of a sequence of changes to bring the NOTICE and Copyright in line with 
ASF guidelines


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

Branch: refs/heads/decimal-type
Commit: dd4495899e22437b9d64bbcb65edcbc7e25ce409
Parents: 29768a7
Author: Jignesh Patel 
Authored: Tue Jun 14 12:31:19 2016 -0500
Committer: Jignesh Patel 
Committed: Tue Jun 14 12:31:19 2016 -0500

--
 NOTICE | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/dd449589/NOTICE
--
diff --git a/NOTICE b/NOTICE
index 6395645..9cfd585 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,15 +1,8 @@
-QUICKSTEP
+Apache Quickstep (incubating)
+Copyright 2016 The Apache Software Foundation.
 
-Copyright (c) 2011-2016 Pivotal Software, Inc. All Rights Reserved.
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
 
-Licensed 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.
+Portions Copyright (c) 2011-2015, Quickstep Technologies, LLC.
+Portions Copyright (c) 2015-2016, Pivotal Software, Inc.



[15/50] [abbrv] incubator-quickstep git commit: Visualize optimized physical plan in DOT format (#232)

2016-06-15 Thread hakanmemisoglu
Visualize optimized physical plan in DOT format (#232)

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

Branch: refs/heads/decimal-type
Commit: 12d7928b8d505c5993ee7b0224b51460a6a3f2b6
Parents: 5e2bb51
Author: Jianqiao Zhu 
Authored: Fri May 20 16:47:31 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:45 2016 -0700

--
 query_optimizer/CMakeLists.txt|   3 +-
 query_optimizer/PhysicalGenerator.cpp |  13 ++-
 utility/CMakeLists.txt|  13 +++
 utility/PlanVisualizer.cpp| 161 +
 utility/PlanVisualizer.hpp|  94 +
 utility/StringUtil.hpp|  30 +-
 6 files changed, 310 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/12d7928b/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index aa2873e..5c9438d 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -194,7 +194,8 @@ 
target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
   quickstep_queryoptimizer_strategy_Selection
   quickstep_queryoptimizer_strategy_Strategy
   quickstep_queryoptimizer_Validator
-  quickstep_utility_Macros)
+  quickstep_utility_Macros
+  quickstep_utility_PlanVisualizer)
 target_link_libraries(quickstep_queryoptimizer_QueryHandle
   quickstep_catalog_Catalog_proto
   quickstep_queryexecution_QueryContext_proto

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/12d7928b/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index 662236f..75a7bc9 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -33,6 +33,7 @@
 #include "query_optimizer/strategy/OneToOne.hpp"
 #include "query_optimizer/strategy/Selection.hpp"
 #include "query_optimizer/strategy/Strategy.hpp"
+#include "utility/PlanVisualizer.hpp"
 
 #include "gflags/gflags.h"
 
@@ -45,7 +46,12 @@ DEFINE_bool(reorder_hash_joins, true,
 "If true, apply hash join order optimization to each group of hash 
"
 "joins. The optimization applies a greedy algorithm to favor 
smaller "
 "cardinality and selective tables to be joined first, which is 
suitable "
-"for queries on star-schema tables");
+"for queries on star-schema tables.");
+
+DEFINE_bool(visualize_plan, false,
+"If true, visualize the final physical plan into a graph in DOT 
format "
+"(DOT is a plain text graph description language). Then print the "
+"generated graph through stderr.");
 
 namespace L = ::quickstep::optimizer::logical;
 namespace P = ::quickstep::optimizer::physical;
@@ -101,6 +107,11 @@ P::PhysicalPtr PhysicalGenerator::optimizePlan() {
 
   DVLOG(4) << "Optimized physical plan:\n" << physical_plan_->toString();
 
+  if (FLAGS_visualize_plan) {
+  quickstep::PlanVisualizer plan_visualizer;
+std::cerr << "\n" << plan_visualizer.visualize(physical_plan_) << "\n";
+  }
+
 #ifdef QUICKSTEP_DEBUG
   Validate(physical_plan_);
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/12d7928b/utility/CMakeLists.txt
--
diff --git a/utility/CMakeLists.txt b/utility/CMakeLists.txt
index 6d1eeab..2d3db8f 100644
--- a/utility/CMakeLists.txt
+++ b/utility/CMakeLists.txt
@@ -171,6 +171,7 @@ add_library(quickstep_utility_Glob Glob.cpp Glob.hpp)
 add_library(quickstep_utility_HashPair ../empty_src.cpp HashPair.hpp)
 add_library(quickstep_utility_Macros ../empty_src.cpp Macros.hpp)
 add_library(quickstep_utility_MemStream ../empty_src.cpp MemStream.hpp)
+add_library(quickstep_utility_PlanVisualizer PlanVisualizer.cpp 
PlanVisualizer.hpp)
 add_library(quickstep_utility_PrimeNumber PrimeNumber.cpp PrimeNumber.hpp)
 add_library(quickstep_utility_PtrList ../empty_src.cpp PtrList.hpp)
 add_library(quickstep_utility_PtrMap ../empty_src.cpp PtrMap.hpp)
@@ -231,6 +232,17 @@ target_link_libraries(quickstep_utility_MemStream
   quickstep_utility_Macros)
 target_link_libraries(quickstep_utility_PrimeNumber
  

[07/50] [abbrv] incubator-quickstep git commit: In ScopedBuffer, initialize the allocated memory bytes to 0 (#230)

2016-06-15 Thread hakanmemisoglu
In ScopedBuffer, initialize the allocated memory bytes to 0 (#230)

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

Branch: refs/heads/decimal-type
Commit: ebfe9521f869543f058bb4c984fcd29511b9bd60
Parents: cd9db29
Author: Jianqiao Zhu 
Authored: Thu May 19 18:20:53 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:44 2016 -0700

--
 utility/ScopedBuffer.hpp | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ebfe9521/utility/ScopedBuffer.hpp
--
diff --git a/utility/ScopedBuffer.hpp b/utility/ScopedBuffer.hpp
index b6fddc5..03290ff 100644
--- a/utility/ScopedBuffer.hpp
+++ b/utility/ScopedBuffer.hpp
@@ -43,9 +43,13 @@ class ScopedBuffer {
*size.
*
* @param alloc_size The number of bytes of memory to allocate.
+   * @param initialize If true, initialize all the bytes of the allocated 
memory to 0.
**/
-  explicit ScopedBuffer(const std::size_t alloc_size) {
+  explicit ScopedBuffer(const std::size_t alloc_size, bool initialize = true) {
 internal_ptr_ = std::malloc(alloc_size);
+if (initialize) {
+  memset(internal_ptr_, 0x0, alloc_size);
+}
   }
 
   /**
@@ -54,10 +58,15 @@ class ScopedBuffer {
*
* @param alloc_size The number of bytes of memory to allocate.
* @param alloc_alignment The alignment of the memory to allocate.
+   * @param initialize If true, initialize all the bytes of the allocated 
memory to 0.
**/
   ScopedBuffer(const std::size_t alloc_size,
-   const std::size_t alloc_alignment) {
+   const std::size_t alloc_alignment,
+   const bool initialize = true) {
 internal_ptr_ = malloc_with_alignment(alloc_size, alloc_alignment);
+if (initialize) {
+  memset(internal_ptr_, 0x0, alloc_size);
+}
   }
 
   /**
@@ -110,12 +119,16 @@ class ScopedBuffer {
*size.
*
* @param alloc_size The number of bytes of memory to allocate.
+   * @param initialize If true, initialize all the bytes of the allocated 
memory to 0.
**/
-  void reset(const std::size_t alloc_size) {
+  void reset(const std::size_t alloc_size, const bool initialize = true) {
 if (internal_ptr_ != nullptr) {
   std::free(internal_ptr_);
 }
 internal_ptr_ = std::malloc(alloc_size);
+if (initialize) {
+  memset(internal_ptr_, 0x0, alloc_size);
+}
   }
 
   /**



[34/50] [abbrv] incubator-quickstep git commit: Use shared libraries when building on Travis

2016-06-15 Thread hakanmemisoglu
Use shared libraries when building on Travis


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

Branch: refs/heads/decimal-type
Commit: ccd11c0858362e4af45822181dc3a8d0c4db539b
Parents: 4f8fdbe
Author: navsan 
Authored: Thu Jun 9 11:03:42 2016 -0500
Committer: Navneet Potti 
Committed: Thu Jun 9 15:22:22 2016 -0500

--
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ccd11c08/.travis.yml
--
diff --git a/.travis.yml b/.travis.yml
index df39fb0..142dfce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -58,6 +58,7 @@ before_script:
   - $CLINKER --version
   - (cd build &&
  cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE
+   -D BUILD_SHARED_LIBS=On
-D CMAKE_C_FLAGS_DEBUG="$DEBUG_FLAGS"
-D CMAKE_CXX_FLAGS_DEBUG="$DEBUG_FLAGS"
-D CMAKE_C_FLAGS_RELEASE="$RELEASE_FLAGS"



[50/50] [abbrv] incubator-quickstep git commit: Make scale fixed to 10^2.

2016-06-15 Thread hakanmemisoglu
Make scale fixed to 10^2.


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

Branch: refs/heads/decimal-type
Commit: 400d268b9d28e331707cc58094b9f0decc415d5c
Parents: d71599f
Author: Hakan Memisoglu 
Authored: Wed Jun 15 13:16:18 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Jun 15 14:46:25 2016 -0500

--
 types/DecimalLit.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/400d268b/types/DecimalLit.hpp
--
diff --git a/types/DecimalLit.hpp b/types/DecimalLit.hpp
index a9f3825..d1e2255 100644
--- a/types/DecimalLit.hpp
+++ b/types/DecimalLit.hpp
@@ -43,9 +43,9 @@ struct DecimalLit {
 
   data_type data_;
 
-  static constexpr std::uint64_t kPrecisionWidth = 4;
+  static constexpr std::int64_t kPrecisionWidth = 2;
 
-  static constexpr std::int64_t kMaxFractionInt = 1;
+  static constexpr std::int64_t kMaxFractionInt = 100;
 
   inline std::uint64_t getFractionalPart() const {
 return 
static_cast(static_cast(std::abs(data_)) % 
kMaxFractionInt);



[23/50] [abbrv] incubator-quickstep git commit: Added Query ID to Relational operators and WorkOrders.

2016-06-15 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/40542682/relational_operators/SortMergeRunOperator.hpp
--
diff --git a/relational_operators/SortMergeRunOperator.hpp 
b/relational_operators/SortMergeRunOperator.hpp
index f92affe..f54e925 100644
--- a/relational_operators/SortMergeRunOperator.hpp
+++ b/relational_operators/SortMergeRunOperator.hpp
@@ -88,6 +88,7 @@ class SortMergeRunOperator : public RelationalOperator {
*  \c top_k is 0.
* @param input_relation_is_stored Boolean to indicate is input relation is
* stored or streamed.
+   * @param query_id The ID of the query to which this operator belongs.
**/
   SortMergeRunOperator(const CatalogRelation _relation,
const CatalogRelation _relation,
@@ -97,8 +98,10 @@ class SortMergeRunOperator : public RelationalOperator {
const QueryContext::sort_config_id sort_config_index,
const std::size_t merge_factor,
const std::size_t top_k,
-   const bool input_relation_is_stored)
-  : input_relation_(input_relation),
+   const bool input_relation_is_stored,
+   const std::size_t query_id)
+  : RelationalOperator(query_id),
+input_relation_(input_relation),
 output_relation_(output_relation),
 output_destination_index_(output_destination_index),
 sort_config_index_(sort_config_index),
@@ -216,6 +219,7 @@ class SortMergeRunWorkOrder : public WorkOrder {
* @param input_runs Input runs to merge.
* @param top_k If non-zero will merge only \c top_k tuples.
* @param merge_level Merge level in the merge tree.
+   * @param query_id The ID of the query to which this WorkOrder belongs.
* @param output_destination The InsertDestination to create new blocks.
* @param storage_manager The StorageManager to use.
* @param operator_index Merge-run operator index to send feedback messages
@@ -229,12 +233,14 @@ class SortMergeRunWorkOrder : public WorkOrder {
   std::vector &_runs,
   const std::size_t top_k,
   const std::size_t merge_level,
+  const std::size_t query_id,
   InsertDestination *output_destination,
   StorageManager *storage_manager,
   const std::size_t operator_index,
   const tmb::client_id scheduler_client_id,
   MessageBus *bus)
-  : sort_config_(sort_config),
+  : WorkOrder(query_id),
+sort_config_(sort_config),
 run_relation_(run_relation),
 input_runs_(std::move(input_runs)),
 top_k_(top_k),

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/40542682/relational_operators/SortRunGenerationOperator.cpp
--
diff --git a/relational_operators/SortRunGenerationOperator.cpp 
b/relational_operators/SortRunGenerationOperator.cpp
index 9bb3f51..e352f9e 100644
--- a/relational_operators/SortRunGenerationOperator.cpp
+++ b/relational_operators/SortRunGenerationOperator.cpp
@@ -54,6 +54,7 @@ bool SortRunGenerationOperator::getAllWorkOrders(
 new SortRunGenerationWorkOrder(input_relation_,
input_block_id,
sort_config,
+   query_id_,
output_destination,
storage_manager),
 op_index_);
@@ -69,6 +70,7 @@ bool SortRunGenerationOperator::getAllWorkOrders(
   input_relation_,
   input_relation_block_ids_[num_workorders_generated_],
   sort_config,
+  query_id_,
   output_destination,
   storage_manager),
   op_index_);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/40542682/relational_operators/SortRunGenerationOperator.hpp
--
diff --git a/relational_operators/SortRunGenerationOperator.hpp 
b/relational_operators/SortRunGenerationOperator.hpp
index 04290a9..3da9813 100644
--- a/relational_operators/SortRunGenerationOperator.hpp
+++ b/relational_operators/SortRunGenerationOperator.hpp
@@ -83,13 +83,16 @@ class SortRunGenerationOperator : public RelationalOperator 
{
* @param input_relation_is_stored Does the input relation contain the blocks
* to sort. If \c false, the blocks are
* streamed.
+   * @param query_id The ID of the query to which this operator belongs.
**/
   SortRunGenerationOperator(const CatalogRelation _relation,
 const CatalogRelation _relation,
 const QueryContext::insert_destination_id 
output_destination_index,
  

[32/50] [abbrv] incubator-quickstep git commit: Fixed a potential segfault with CompressedBlockBuilder.

2016-06-15 Thread hakanmemisoglu
Fixed a potential segfault with CompressedBlockBuilder.


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

Branch: refs/heads/decimal-type
Commit: eebb4644f195fd82b28e77aafcf60344c33d6197
Parents: 096abe2
Author: Jianqiao Zhu 
Authored: Thu Jun 9 00:43:16 2016 -0500
Committer: Zuyu Zhang 
Committed: Thu Jun 9 10:52:12 2016 -0700

--
 storage/CompressedBlockBuilder.cpp | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/eebb4644/storage/CompressedBlockBuilder.cpp
--
diff --git a/storage/CompressedBlockBuilder.cpp 
b/storage/CompressedBlockBuilder.cpp
index 4a181eb..1ca0c07 100644
--- a/storage/CompressedBlockBuilder.cpp
+++ b/storage/CompressedBlockBuilder.cpp
@@ -321,6 +321,9 @@ void 
CompressedBlockBuilder::buildCompressedColumnStoreTupleStorageSubBlock(void
 bool CompressedBlockBuilder::addTupleInternal(Tuple *candidate_tuple) {
   DEBUG_ASSERT(candidate_tuple->size() == relation_.size());
 
+  // Ensure that the tuple is the owner of its values.
+  candidate_tuple->ensureLiteral();
+
   // Modify dictionaries and maximum integers to reflect the new tuple's
   // values. Keep track of what has changed in case a rollback is needed.
   vector modified_dictionaries;



[03/50] [abbrv] incubator-quickstep git commit: Fix bug in the SMA code (#223)

2016-06-15 Thread hakanmemisoglu
Fix bug in the SMA code (#223)

* Fix bug in the SMA code so that the SMA predicate evaluation is only
applied if at least one of the operands in the predicate is a
static value.


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

Branch: refs/heads/decimal-type
Commit: 847941dfe48f8055be1ea2f6a420fc5613c80653
Parents: 43f1626
Author: Jignesh Patel 
Authored: Mon May 16 12:04:32 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:43 2016 -0700

--
 storage/SMAIndexSubBlock.cpp | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/847941df/storage/SMAIndexSubBlock.cpp
--
diff --git a/storage/SMAIndexSubBlock.cpp b/storage/SMAIndexSubBlock.cpp
index 2a0e4f9..aa9bc54 100644
--- a/storage/SMAIndexSubBlock.cpp
+++ b/storage/SMAIndexSubBlock.cpp
@@ -621,9 +621,14 @@ Selectivity 
SMAIndexSubBlock::getSelectivityForPredicate(const ComparisonPredica
 predicate_cost_t SMAIndexSubBlock::estimatePredicateEvaluationCost(
 const ComparisonPredicate ) const {
   DCHECK(initialized_);
-  Selectivity selectivity = getSelectivityForPredicate(predicate);
-  if (selectivity == Selectivity::kAll || selectivity == Selectivity::kNone) {
-return predicate_cost::kConstantTime;
+
+  // Check that at least one of the operands has a static value.
+  if (predicate.getLeftOperand().hasStaticValue() ||
+  predicate.getRightOperand().hasStaticValue()) {
+Selectivity selectivity = getSelectivityForPredicate(predicate);
+if (selectivity == Selectivity::kAll || selectivity == Selectivity::kNone) 
{
+  return predicate_cost::kConstantTime;
+}
   }
   return predicate_cost::kInfinite;
 }



[42/50] [abbrv] incubator-quickstep git commit: Add option to enable Google Profiler.

2016-06-15 Thread hakanmemisoglu
Add option to enable Google Profiler.


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

Branch: refs/heads/decimal-type
Commit: 540c09e623744c5ebf24f845372baaddca4265d1
Parents: 8230b12
Author: Navneet Potti 
Authored: Mon Jun 13 15:17:06 2016 -0500
Committer: Zuyu Zhang 
Committed: Mon Jun 13 14:57:16 2016 -0700

--
 CMakeLists.txt   | 26 ++
 cli/CMakeLists.txt   |  6 +-
 cli/CliConfig.h.in   |  1 +
 cli/QuickstepCli.cpp | 47 ++-
 4 files changed, 78 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/540c09e6/CMakeLists.txt
--
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e445f0..20e1fb9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -159,6 +159,32 @@ else()
   )
 endif()
 
+# Include Google Perftools CPU Profiler. You probably want to
+# use this option with CMAKE_BUILD_TYPE=RelWithDebInfo.
+# Pass profiler_file_name to quickstep_cli_shell to actually
+# run the profiler. The profiler only starts collecting
+# samples after the first query, so that it runs against a
+# warm buffer pool and caches. If you want to profile everything,
+# including the first query run, set the environment variable
+# CPUPROFILE instead of passing the flag profile_file_name
+# Use google-pprof on the output file to convert it into a useful
+# format like graphviz (dot).
+option(ENABLE_GOOGLE_PROFILER "Include Google Perftools CPU Profiler." OFF)
+
+if (ENABLE_GOOGLE_PROFILER)
+  set_property(
+DIRECTORY
+APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_PROFILER
+  )
+
+  # TODO(navsan) Add a FindGperftools.cmake module and use that here.
+  check_include_files("gperftools/profiler.h" HAVE_GPERFTOOLS_PROFILER)
+  if (NOT HAVE_GPERFTOOLS_PROFILER)
+message(FATAL_ERROR "Could not find gperftools. Ensure that it is 
installed.")
+  endif()
+  set(LIBS ${LIBS} profiler)
+endif()
+
 # Link against the system's threading library.
 find_package(Threads REQUIRED)
 set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/540c09e6/cli/CMakeLists.txt
--
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
index faf5040..44ec223 100644
--- a/cli/CMakeLists.txt
+++ b/cli/CMakeLists.txt
@@ -36,6 +36,10 @@ 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"
@@ -106,7 +110,7 @@ target_link_libraries(quickstep_cli_DefaultsConfigurator
 if(QUICKSTEP_HAVE_LIBNUMA)
   target_link_libraries(quickstep_cli_DefaultsConfigurator
   ${LIBNUMA_LIBRARY})
-endif() 
+endif()
 target_link_libraries(quickstep_cli_InputParserUtil
   glog
   quickstep_utility_Macros

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/540c09e6/cli/CliConfig.h.in
--
diff --git a/cli/CliConfig.h.in b/cli/CliConfig.h.in
index b44dfb7..69f4d8a 100644
--- a/cli/CliConfig.h.in
+++ b/cli/CliConfig.h.in
@@ -17,3 +17,4 @@
 
 #cmakedefine QUICKSTEP_USE_LINENOISE
 #cmakedefine QUICKSTEP_OS_WINDOWS
+#cmakedefine QUICKSTEP_ENABLE_GOOGLE_PROFILER

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/540c09e6/cli/QuickstepCli.cpp
--
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
index fbe7e3b..0b64fda 100644
--- a/cli/QuickstepCli.cpp
+++ b/cli/QuickstepCli.cpp
@@ -36,7 +36,7 @@
 #include 
 #endif
 
-#include "cli/CliConfig.h"  // For QUICKSTEP_USE_LINENOISE.
+#include "cli/CliConfig.h"  // For QUICKSTEP_USE_LINENOISE, 
QUICKSTEP_ENABLE_GOOGLE_PROFILER.
 #include "cli/CommandExecutor.hpp"
 #include "cli/DropRelation.hpp"
 
@@ -48,6 +48,10 @@ typedef quickstep::LineReaderLineNoise LineReaderImpl;
 typedef quickstep::LineReaderDumb LineReaderImpl;
 #endif
 
+#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER
+#include 
+#endif
+
 #include "cli/DefaultsConfigurator.hpp"
 #include "cli/InputParserUtil.hpp"
 #include "cli/PrintToScreen.hpp"
@@ -157,6 +161,30 @@ DEFINE_bool(initialize_db, false, "If true, initialize a 
database.");
 DEFINE_bool(print_query, false,
 "Print each input query statement. 

[08/50] [abbrv] incubator-quickstep git commit: Added hash join order optimization for star schema queries. (#229)

2016-06-15 Thread hakanmemisoglu
Added hash join order optimization for star schema queries. (#229)

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

Branch: refs/heads/decimal-type
Commit: cd9db299cbceb6cd850ac06a41cf53c310953046
Parents: c677259
Author: Jianqiao Zhu 
Authored: Thu May 19 18:19:28 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:44 2016 -0700

--
 query_optimizer/CMakeLists.txt  |   2 +
 query_optimizer/PhysicalGenerator.cpp   |  14 +
 query_optimizer/cost_model/CMakeLists.txt   |  32 +-
 .../cost_model/StarSchemaSimpleCostModel.cpp| 258 
 .../cost_model/StarSchemaSimpleCostModel.hpp| 115 +++
 query_optimizer/rules/CMakeLists.txt|  20 +-
 .../StarSchemaHashJoinOrderOptimization.cpp | 309 +++
 .../StarSchemaHashJoinOrderOptimization.hpp | 136 
 query_optimizer/tests/CMakeLists.txt|   1 +
 query_optimizer/tests/OptimizerTextTest.cpp |  14 +
 10 files changed, 899 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cd9db299/query_optimizer/CMakeLists.txt
--
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index feaecb3..aa2873e 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -182,10 +182,12 @@ 
target_link_libraries(quickstep_queryoptimizer_OptimizerTree
   quickstep_utility_Macros
   quickstep_utility_TreeStringSerializable)
 target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
+  gflags_nothreads-static
   quickstep_queryoptimizer_LogicalToPhysicalMapper
   quickstep_queryoptimizer_logical_Logical
   quickstep_queryoptimizer_physical_Physical
   quickstep_queryoptimizer_rules_PruneColumns
+  
quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
   quickstep_queryoptimizer_strategy_Aggregate
   quickstep_queryoptimizer_strategy_Join
   quickstep_queryoptimizer_strategy_OneToOne

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/cd9db299/query_optimizer/PhysicalGenerator.cpp
--
diff --git a/query_optimizer/PhysicalGenerator.cpp 
b/query_optimizer/PhysicalGenerator.cpp
index ee52966..662236f 100644
--- a/query_optimizer/PhysicalGenerator.cpp
+++ b/query_optimizer/PhysicalGenerator.cpp
@@ -1,6 +1,8 @@
 /**
  *   Copyright 2011-2015 Quickstep Technologies LLC.
  *   Copyright 2015 Pivotal Software, Inc.
+ *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+ * University of Wisconsin—Madison.
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -25,17 +27,26 @@
 #include "query_optimizer/logical/Logical.hpp"
 #include "query_optimizer/physical/Physical.hpp"
 #include "query_optimizer/rules/PruneColumns.hpp"
+#include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
 #include "query_optimizer/strategy/Aggregate.hpp"
 #include "query_optimizer/strategy/Join.hpp"
 #include "query_optimizer/strategy/OneToOne.hpp"
 #include "query_optimizer/strategy/Selection.hpp"
 #include "query_optimizer/strategy/Strategy.hpp"
 
+#include "gflags/gflags.h"
+
 #include "glog/logging.h"
 
 namespace quickstep {
 namespace optimizer {
 
+DEFINE_bool(reorder_hash_joins, true,
+"If true, apply hash join order optimization to each group of hash 
"
+"joins. The optimization applies a greedy algorithm to favor 
smaller "
+"cardinality and selective tables to be joined first, which is 
suitable "
+"for queries on star-schema tables");
+
 namespace L = ::quickstep::optimizer::logical;
 namespace P = ::quickstep::optimizer::physical;
 namespace S = ::quickstep::optimizer::strategy;
@@ -77,6 +88,9 @@ P::PhysicalPtr PhysicalGenerator::generateInitialPlan(
 
 P::PhysicalPtr PhysicalGenerator::optimizePlan() {
   std::vector> rules;
+  if (FLAGS_reorder_hash_joins) {
+rules.emplace_back(new StarSchemaHashJoinOrderOptimization());
+  }
   rules.emplace_back(new PruneColumns());
 
   for (std::unique_ptr  : rules) {


[18/50] [abbrv] incubator-quickstep git commit: Added BlockLocator.

2016-06-15 Thread hakanmemisoglu
Added BlockLocator.


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

Branch: refs/heads/decimal-type
Commit: 3789da728e95b91bd97587f5e34da6ff1b55ea5f
Parents: 4503198
Author: Zuyu Zhang 
Authored: Sat May 28 14:24:13 2016 -0700
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:46 2016 -0700

--
 query_execution/BlockLocator.cpp| 223 +++
 query_execution/BlockLocator.hpp| 125 +
 query_execution/CMakeLists.txt  |  48 
 query_execution/QueryExecutionMessages.proto|  34 +++
 query_execution/QueryExecutionTypedefs.hpp  |  16 ++
 query_execution/tests/BlockLocator_unittest.cpp | 270 +++
 storage/CMakeLists.txt  |   9 +-
 storage/StorageManager.cpp  | 190 -
 storage/StorageManager.hpp  |  76 +-
 9 files changed, 984 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3789da72/query_execution/BlockLocator.cpp
--
diff --git a/query_execution/BlockLocator.cpp b/query_execution/BlockLocator.cpp
new file mode 100644
index 000..6cf5249
--- /dev/null
+++ b/query_execution/BlockLocator.cpp
@@ -0,0 +1,223 @@
+/**
+ *   Copyright 2016 Pivotal Software, Inc.
+ *
+ *   Licensed 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 "query_execution/BlockLocator.hpp"
+
+#include 
+#include 
+#include 
+
+#include "query_execution/QueryExecutionMessages.pb.h"
+#include "query_execution/QueryExecutionTypedefs.hpp"
+#include "query_execution/QueryExecutionUtil.hpp"
+#include "storage/StorageBlockInfo.hpp"
+#include "threading/ThreadUtil.hpp"
+
+#include "glog/logging.h"
+
+#include "tmb/id_typedefs.h"
+#include "tmb/message_bus.h"
+#include "tmb/tagged_message.h"
+
+using std::free;
+using std::malloc;
+using std::move;
+
+using tmb::TaggedMessage;
+using tmb::client_id;
+
+namespace quickstep {
+
+void BlockLocator::run() {
+  if (cpu_id_ >= 0) {
+ThreadUtil::BindToCPU(cpu_id_);
+  }
+
+  for (;;) {
+// Receive() is a blocking call, causing this thread to sleep until next
+// message is received.
+const tmb::AnnotatedMessage annotated_message = 
bus_->Receive(locator_client_id_, 0, true);
+const TaggedMessage _message = annotated_message.tagged_message;
+const client_id sender = annotated_message.sender;
+LOG(INFO) << "BlockLocator received the typed '" << 
tagged_message.message_type()
+  << "' message from TMB Client " << sender;
+switch (tagged_message.message_type()) {
+  case kBlockDomainRegistrationMessage: {
+serialization::BlockDomainRegistrationMessage proto;
+CHECK(proto.ParseFromArray(tagged_message.message(), 
tagged_message.message_bytes()));
+
+processBlockDomainRegistrationMessage(sender, 
proto.domain_network_address());
+break;
+  }
+  case kAddBlockLocationMessage: {
+serialization::BlockLocationMessage proto;
+CHECK(proto.ParseFromArray(tagged_message.message(), 
tagged_message.message_bytes()));
+
+const block_id block = proto.block_id();
+const block_id_domain domain = proto.block_domain();
+
+const auto result_block_locations = 
block_locations_[block].insert(domain);
+const auto result_domain_blocks = domain_blocks_[domain].insert(block);
+DCHECK_EQ(result_block_locations.second, result_domain_blocks.second);
+
+if (result_domain_blocks.second) {
+  LOG(INFO) << "Block " << BlockIdUtil::ToString(block) << " loaded in 
Domain " << domain;
+} else {
+  LOG(INFO) << "Block " << BlockIdUtil::ToString(block) << " existed 
in Domain " << domain;
+}
+break;
+  }
+  case kDeleteBlockLocationMessage: {
+serialization::BlockLocationMessage proto;
+CHECK(proto.ParseFromArray(tagged_message.message(), 
tagged_message.message_bytes()));
+
+const 

[49/50] [abbrv] incubator-quickstep git commit: New changes.

2016-06-15 Thread hakanmemisoglu
New changes.


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

Branch: refs/heads/decimal-type
Commit: d71599fd124d9ddaf97150b52c7e701e4bcd121b
Parents: 5aa5593
Author: Hakan Memisoglu 
Authored: Tue Jun 14 10:09:25 2016 -0500
Committer: Hakan Memisoglu 
Committed: Wed Jun 15 14:46:25 2016 -0500

--
 .../unary_operations/ArithmeticUnaryOperations.cpp | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d71599fd/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
--
diff --git a/types/operations/unary_operations/ArithmeticUnaryOperations.cpp 
b/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
index 1e61db3..003c17e 100644
--- a/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
+++ b/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
@@ -20,6 +20,7 @@
 #include 
 
 #include "types/DatetimeIntervalType.hpp"
+#include "types/DecimalType.hpp"
 #include "types/DoubleType.hpp"
 #include "types/FloatType.hpp"
 #include "types/IntType.hpp"
@@ -40,7 +41,7 @@ namespace quickstep {
 bool ArithmeticUnaryOperation::canApplyToType(const Type ) const {
   return QUICKSTEP_EQUALS_ANY_CONSTANT(
   type.getTypeID(),
-  kInt, kLong, kFloat, kDouble, kDatetimeInterval, kYearMonthInterval);
+  kInt, kLong, kFloat, kDouble, kDecimal, kDatetimeInterval, 
kYearMonthInterval);
 }
 
 const Type* ArithmeticUnaryOperation::resultTypeForArgumentType(const Type 
) const {
@@ -66,7 +67,7 @@ const Type* ArithmeticUnaryOperation::pushDownTypeHint(const 
Type *type_hint) co
 bool NegateUnaryOperation::resultTypeIsPlausible(const Type _type) 
const {
   return QUICKSTEP_EQUALS_ANY_CONSTANT(
   result_type.getTypeID(),
-  kInt, kLong, kFloat, kDouble, kDatetimeInterval, kYearMonthInterval);
+  kInt, kLong, kFloat, kDouble, kDecimal, kDatetimeInterval, 
kYearMonthInterval);
 }
 
 TypedValue NegateUnaryOperation::applyToChecked(const TypedValue ,
@@ -86,6 +87,8 @@ TypedValue NegateUnaryOperation::applyToChecked(const 
TypedValue ,
   return TypedValue(-argument.getLiteral());
 case kDouble:
   return TypedValue(-argument.getLiteral());
+case kDecimal:
+  return TypedValue(-argument.getLiteral());
 case kDatetimeInterval:
   return TypedValue(-argument.getLiteral());
 case kYearMonthInterval:
@@ -123,6 +126,12 @@ UncheckedUnaryOperator* 
NegateUnaryOperation::makeUncheckedUnaryOperatorForType(
   } else {
 return new NegateUncheckedUnaryOperator();
   }
+case kDecimal:
+  if (type.isNullable()) {
+return new NegateUncheckedUnaryOperator();
+  } else {
+return new NegateUncheckedUnaryOperator();
+  }
 case kDatetimeInterval:
   if (type.isNullable()) {
 return new NegateUncheckedUnaryOperator();



[09/50] [abbrv] incubator-quickstep git commit: Initial support for collecting table statistics: number of distinct values (#227)

2016-06-15 Thread hakanmemisoglu
Initial support for collecting table statistics: number of distinct values 
(#227)

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

Branch: refs/heads/decimal-type
Commit: c677259754249038670ec003dfc24de6d430e8e9
Parents: aa76e48
Author: Jianqiao Zhu 
Authored: Thu May 19 10:58:43 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:44 2016 -0700

--
 catalog/CMakeLists.txt  |  11 +++
 catalog/Catalog.proto   |  13 ++-
 catalog/CatalogRelation.cpp |  11 +++
 catalog/CatalogRelation.hpp |  24 -
 catalog/CatalogRelationStatistics.cpp   |  49 ++
 catalog/CatalogRelationStatistics.hpp   | 122 +++
 cli/CMakeLists.txt  |  21 +++-
 cli/CommandExecutor.cpp | 138 ++-
 cli/CommandExecutor.hpp |  17 ++--
 cli/QuickstepCli.cpp|   2 +
 cli/tests/CommandExecutorTestRunner.cpp |   2 +
 query_optimizer/ExecutionGenerator.cpp  |   6 +-
 query_optimizer/QueryProcessor.hpp  |  10 ++
 13 files changed, 410 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c6772597/catalog/CMakeLists.txt
--
diff --git a/catalog/CMakeLists.txt b/catalog/CMakeLists.txt
index 94da838..64b4f16 100644
--- a/catalog/CMakeLists.txt
+++ b/catalog/CMakeLists.txt
@@ -1,5 +1,7 @@
 #   Copyright 2011-2015 Quickstep Technologies LLC.
 #   Copyright 2015-2016 Pivotal Software, Inc.
+#   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+# University of Wisconsin—Madison.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -36,6 +38,9 @@ add_library(quickstep_catalog_CatalogRelation 
CatalogRelation.cpp CatalogRelatio
 add_library(quickstep_catalog_CatalogRelationSchema
 CatalogRelationSchema.cpp
 CatalogRelationSchema.hpp)
+add_library(quickstep_catalog_CatalogRelationStatistics
+CatalogRelationStatistics.cpp
+CatalogRelationStatistics.hpp)
 add_library(quickstep_catalog_CatalogTypedefs ../empty_src.cpp 
CatalogTypedefs.hpp)
 add_library(quickstep_catalog_IndexScheme IndexScheme.cpp IndexScheme.hpp)
 if(QUICKSTEP_HAVE_LIBNUMA)
@@ -98,6 +103,7 @@ target_link_libraries(quickstep_catalog_CatalogRelation
   glog
   quickstep_catalog_CatalogAttribute
   quickstep_catalog_CatalogRelationSchema
+  quickstep_catalog_CatalogRelationStatistics
   quickstep_catalog_CatalogTypedefs
   quickstep_catalog_Catalog_proto
   quickstep_catalog_IndexScheme
@@ -111,6 +117,10 @@ target_link_libraries(quickstep_catalog_CatalogRelation
   quickstep_threading_SpinSharedMutex
   quickstep_utility_Macros
   quickstep_utility_PtrVector)
+target_link_libraries(quickstep_catalog_CatalogRelationStatistics
+  quickstep_catalog_CatalogTypedefs
+  quickstep_catalog_Catalog_proto
+  quickstep_utility_Macros)
 target_link_libraries(quickstep_catalog_IndexScheme
   glog
   quickstep_catalog_Catalog_proto
@@ -173,6 +183,7 @@ target_link_libraries(quickstep_catalog
   quickstep_catalog_CatalogErrors
   quickstep_catalog_CatalogRelation
   quickstep_catalog_CatalogRelationSchema
+  quickstep_catalog_CatalogRelationStatistics
   quickstep_catalog_CatalogTypedefs
   quickstep_catalog_IndexScheme
   quickstep_catalog_PartitionScheme

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c6772597/catalog/Catalog.proto
--
diff --git a/catalog/Catalog.proto b/catalog/Catalog.proto
index 81e28cf..ce4bc2e 100644
--- a/catalog/Catalog.proto
+++ b/catalog/Catalog.proto
@@ -1,7 +1,7 @@
 //   Copyright 2011-2015 Quickstep Technologies LLC.
 //   Copyright 2015-2016 Pivotal Software, Inc.
 //   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
-//University of Wisconsin—Madison.
+// University of Wisconsin—Madison.
 //
 //   Licensed under the Apache 

[33/50] [abbrv] incubator-quickstep git commit: Improved TextScanOperator.

2016-06-15 Thread hakanmemisoglu
Improved TextScanOperator.


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

Branch: refs/heads/decimal-type
Commit: 4f8fdbe8451aed1ad1c07a8badb5be85bee1ff57
Parents: eebb464
Author: Jianqiao Zhu 
Authored: Thu Jun 9 03:18:37 2016 -0500
Committer: Zuyu Zhang 
Committed: Thu Jun 9 10:52:40 2016 -0700

--
 query_optimizer/ExecutionGenerator.cpp  |   1 -
 relational_operators/CMakeLists.txt |  23 +-
 relational_operators/TextScanOperator.cpp   | 818 ++-
 relational_operators/TextScanOperator.hpp   | 286 +++
 relational_operators/WorkOrder.proto|  15 +-
 relational_operators/WorkOrderFactory.cpp   |  72 +-
 .../tests/TextScanOperator_unittest.cpp |   1 -
 relational_operators/tests/text_scan_input.txt  |   8 +-
 8 files changed, 384 insertions(+), 840 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4f8fdbe8/query_optimizer/ExecutionGenerator.cpp
--
diff --git a/query_optimizer/ExecutionGenerator.cpp 
b/query_optimizer/ExecutionGenerator.cpp
index 99c2a21..f9fd742 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -945,7 +945,6 @@ void ExecutionGenerator::convertCopyFrom(
   physical_plan->file_name(),
   physical_plan->column_delimiter(),
   physical_plan->escape_strings(),
-  FLAGS_parallelize_load,
   *output_relation,
   insert_destination_index));
   insert_destination_proto->set_relational_op_index(scan_operator_index);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4f8fdbe8/relational_operators/CMakeLists.txt
--
diff --git a/relational_operators/CMakeLists.txt 
b/relational_operators/CMakeLists.txt
index d2693eb..eb73c07 100644
--- a/relational_operators/CMakeLists.txt
+++ b/relational_operators/CMakeLists.txt
@@ -1,5 +1,7 @@
 #   Copyright 2011-2015 Quickstep Technologies LLC.
 #   Copyright 2015-2016 Pivotal Software, Inc.
+#   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+# University of Wisconsin—Madison.
 #
 #   Licensed under the Apache License, Version 2.0 (the "License");
 #   you may not use this file except in compliance with the License.
@@ -16,9 +18,6 @@
 QS_PROTOBUF_GENERATE_CPP(relationaloperators_SortMergeRunOperator_proto_srcs
  relationaloperators_SortMergeRunOperator_proto_hdrs
  SortMergeRunOperator.proto)
-QS_PROTOBUF_GENERATE_CPP(relationaloperators_TextScanOperator_proto_srcs
- relationaloperators_TextScanOperator_proto_hdrs
- TextScanOperator.proto)
 QS_PROTOBUF_GENERATE_CPP(relationaloperators_WorkOrder_proto_srcs
  relationaloperators_WorkOrder_proto_hdrs
  WorkOrder.proto)
@@ -61,9 +60,6 @@ 
add_library(quickstep_relationaloperators_SortRunGenerationOperator SortRunGener
 SortRunGenerationOperator.hpp)
 add_library(quickstep_relationaloperators_TableGeneratorOperator 
TableGeneratorOperator.cpp TableGeneratorOperator.hpp)
 add_library(quickstep_relationaloperators_TextScanOperator 
TextScanOperator.cpp TextScanOperator.hpp)
-add_library(quickstep_relationaloperators_TextScanOperator_proto
-${relationaloperators_TextScanOperator_proto_srcs}
-${relationaloperators_TextScanOperator_proto_hdrs})
 add_library(quickstep_relationaloperators_UpdateOperator UpdateOperator.cpp 
UpdateOperator.hpp)
 add_library(quickstep_relationaloperators_WorkOrder ../empty_src.cpp 
WorkOrder.hpp)
 add_library(quickstep_relationaloperators_WorkOrderFactory 
WorkOrderFactory.cpp WorkOrderFactory.hpp)
@@ -360,27 +356,19 @@ 
target_link_libraries(quickstep_relationaloperators_TextScanOperator
   glog
   quickstep_catalog_CatalogAttribute
   quickstep_catalog_CatalogRelation
-  quickstep_catalog_CatalogRelationSchema
   quickstep_catalog_CatalogTypedefs
   quickstep_queryexecution_QueryContext
-  quickstep_queryexecution_QueryExecutionMessages_proto
-  quickstep_queryexecution_QueryExecutionTypedefs
-  quickstep_queryexecution_QueryExecutionUtil
   quickstep_queryexecution_WorkOrdersContainer
 

[19/50] [abbrv] incubator-quickstep git commit: Groupby hashtable pool (#236)

2016-06-15 Thread hakanmemisoglu
Groupby hashtable pool (#236)

- Created a HashTablePool class for group by clause.
- Each thread can checkout it's own hash table while doing group by
  aggregation.
- AggregationOperationState uses one hash table pool per group by
  clause.


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

Branch: refs/heads/decimal-type
Commit: 13281d86d5232185afc021866b58c66181992a08
Parents: 44eff0d
Author: Harshad Deshmukh 
Authored: Tue May 24 19:04:39 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:46 2016 -0700

--
 .../aggregation/AggregationConcreteHandle.hpp   | 105 
 expressions/aggregation/AggregationHandle.hpp   |  15 +-
 .../aggregation/AggregationHandleAvg.cpp|   9 +
 .../aggregation/AggregationHandleAvg.hpp|   4 +
 .../aggregation/AggregationHandleCount.cpp  |  11 ++
 .../aggregation/AggregationHandleCount.hpp  |   4 +
 .../aggregation/AggregationHandleDistinct.hpp   |   7 +
 .../aggregation/AggregationHandleMax.cpp|   9 +
 .../aggregation/AggregationHandleMax.hpp|   4 +
 .../aggregation/AggregationHandleMin.cpp|   9 +
 .../aggregation/AggregationHandleMin.hpp|   4 +
 .../aggregation/AggregationHandleSum.cpp|   9 +
 .../aggregation/AggregationHandleSum.hpp|   4 +
 expressions/aggregation/CMakeLists.txt  |   2 +
 .../tests/AggregationHandleAvg_unittest.cpp | 109 
 .../tests/AggregationHandleCount_unittest.cpp   | 126 +-
 .../tests/AggregationHandleMax_unittest.cpp | 122 ++
 .../tests/AggregationHandleMin_unittest.cpp | 121 ++
 .../tests/AggregationHandleSum_unittest.cpp | 124 ++
 query_execution/QueryContext.hpp|   2 +-
 storage/AggregationOperationState.cpp   |  84 --
 storage/AggregationOperationState.hpp   |   4 +
 storage/CMakeLists.txt  |  10 ++
 storage/HashTablePool.hpp   | 166 +++
 storage/StorageManager.cpp  |   3 +-
 25 files changed, 1045 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/13281d86/expressions/aggregation/AggregationConcreteHandle.hpp
--
diff --git a/expressions/aggregation/AggregationConcreteHandle.hpp 
b/expressions/aggregation/AggregationConcreteHandle.hpp
index 52249f7..0267e17 100644
--- a/expressions/aggregation/AggregationConcreteHandle.hpp
+++ b/expressions/aggregation/AggregationConcreteHandle.hpp
@@ -44,6 +44,90 @@ class ValueAccessor;
  *  @{
  */
 
+/**
+ * @brief An upserter class for modifying the destination hash table while
+ *merging two group by hash tables.
+ **/
+template 
+class HashTableStateUpserter {
+ public:
+  /**
+   * @brief Constructor.
+   *
+   * @param handle The aggregation handle being used.
+   * @param source_state The aggregation state in the source aggregation hash
+   *table. The corresponding state (for the same key) in the 
destination
+   *hash table will be upserted.
+   **/
+  HashTableStateUpserter(const HandleT , const StateT _state)
+  : handle_(handle), source_state_(source_state) {}
+
+  /**
+   * @brief The operator for the functor required for the upsert.
+   *
+   * @param destination_state The aggregation state in the aggregation hash
+   *table that is being upserted.
+   **/
+  void operator()(StateT *destination_state) {
+handle_.mergeStates(source_state_, destination_state);
+  }
+
+ private:
+  const HandleT _;
+  const StateT _state_;
+
+  DISALLOW_COPY_AND_ASSIGN(HashTableStateUpserter);
+};
+
+/**
+ * @brief A class to support the functor for merging group by hash tables.
+ **/
+template 
+class HashTableMerger {
+ public:
+  /**
+   * @brief Constructor
+   *
+   * @param handle The Aggregation handle being used.
+   * @param destination_hash_table The destination hash table to which other
+   *hash tables will be merged.
+   **/
+  HashTableMerger(const HandleT ,
+  AggregationStateHashTableBase *destination_hash_table)
+  : handle_(handle),
+destination_hash_table_(
+static_cast(destination_hash_table)) {}
+
+  /**
+   * @brief The operator for the functor.
+   *
+   * @param group_by_key The group by key being merged.
+   * @param source_state The aggregation state for the given key in the source
+   *aggregation hash table.
+   **/
+  inline void operator()(const 

[47/50] [abbrv] incubator-quickstep git commit: BugFix: Update NumQueuedWorkOrders to fix scheduling

2016-06-15 Thread hakanmemisoglu
BugFix: Update NumQueuedWorkOrders to fix scheduling


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

Branch: refs/heads/decimal-type
Commit: 49316237f54cfff6e2ea92fe3c4333f35d46190f
Parents: dd44958
Author: Navneet Potti 
Authored: Tue Jun 14 21:52:25 2016 -0500
Committer: Harshad Deshmukh 
Committed: Wed Jun 15 00:20:34 2016 -0500

--
 query_execution/CMakeLists.txt | 1 +
 query_execution/Foreman.cpp| 8 ++--
 query_execution/PolicyEnforcer.cpp | 2 ++
 query_execution/PolicyEnforcer.hpp | 4 
 4 files changed, 13 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/49316237/query_execution/CMakeLists.txt
--
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
index 323e4a9..501166e 100644
--- a/query_execution/CMakeLists.txt
+++ b/query_execution/CMakeLists.txt
@@ -93,6 +93,7 @@ target_link_libraries(quickstep_queryexecution_PolicyEnforcer
   quickstep_queryexecution_QueryExecutionMessages_proto
   quickstep_queryexecution_QueryExecutionTypedefs
   quickstep_queryexecution_QueryManager
+  quickstep_queryexecution_WorkerDirectory
   quickstep_queryexecution_WorkerMessage
   quickstep_queryoptimizer_QueryHandle
   quickstep_relationaloperators_WorkOrder

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/49316237/query_execution/Foreman.cpp
--
diff --git a/query_execution/Foreman.cpp b/query_execution/Foreman.cpp
index 0577e20..828834d 100644
--- a/query_execution/Foreman.cpp
+++ b/query_execution/Foreman.cpp
@@ -89,6 +89,7 @@ Foreman::Foreman(const tmb::client_id main_thread_client_id,
   num_numa_nodes,
   catalog_database_,
   storage_manager_,
+  worker_directory_,
   bus_));
 }
 
@@ -115,6 +116,7 @@ void Foreman::run() {
 policy_enforcer_->processMessage(tagged_message);
 break;
   }
+
   case kAdmitRequestMessage: {
 const AdmitRequestMessage *msg =
 static_cast(tagged_message.message());
@@ -195,9 +197,11 @@ void Foreman::dispatchWorkerMessages(const 
vector 
 if (recipient_worker_thread_index != 
WorkerMessage::kInvalidRecipientIndexHint) {
   sendWorkerMessage(static_cast(recipient_worker_thread_index),
 *message);
+  
worker_directory_->incrementNumQueuedWorkOrders(recipient_worker_thread_index);
 } else {
-  sendWorkerMessage(worker_directory_->getLeastLoadedWorker().first,
-*message);
+  const size_t least_loaded_worker_thread_index = 
worker_directory_->getLeastLoadedWorker().first;
+  sendWorkerMessage(least_loaded_worker_thread_index, *message);
+  
worker_directory_->incrementNumQueuedWorkOrders(least_loaded_worker_thread_index);
 }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/49316237/query_execution/PolicyEnforcer.cpp
--
diff --git a/query_execution/PolicyEnforcer.cpp 
b/query_execution/PolicyEnforcer.cpp
index 2145429..4501026 100644
--- a/query_execution/PolicyEnforcer.cpp
+++ b/query_execution/PolicyEnforcer.cpp
@@ -27,6 +27,7 @@
 #include "catalog/CatalogTypedefs.hpp"
 #include "query_execution/QueryExecutionMessages.pb.h"
 #include "query_execution/QueryManager.hpp"
+#include "query_execution/WorkerDirectory.hpp"
 #include "query_optimizer/QueryHandle.hpp"
 #include "relational_operators/WorkOrder.hpp"
 
@@ -72,6 +73,7 @@ void PolicyEnforcer::processMessage(const TaggedMessage 
_message) {
   CHECK(proto.ParseFromArray(tagged_message.message(),
  tagged_message.message_bytes()));
   query_id = proto.query_id();
+  
worker_directory_->decrementNumQueuedWorkOrders(proto.worker_thread_index());
   break;
 }
 case kCatalogRelationNewBlockMessage: {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/49316237/query_execution/PolicyEnforcer.hpp
--
diff --git a/query_execution/PolicyEnforcer.hpp 
b/query_execution/PolicyEnforcer.hpp
index 5915b79..9f87056 100644
--- a/query_execution/PolicyEnforcer.hpp
+++ b/query_execution/PolicyEnforcer.hpp
@@ -40,6 +40,7 @@ namespace quickstep {
 class 

[25/50] [abbrv] incubator-quickstep git commit: Reordered Query ID in operators and work orders.

2016-06-15 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1be47dcb/relational_operators/tests/HashJoinOperator_unittest.cpp
--
diff --git a/relational_operators/tests/HashJoinOperator_unittest.cpp 
b/relational_operators/tests/HashJoinOperator_unittest.cpp
index 4ef5a5c..074b603 100644
--- a/relational_operators/tests/HashJoinOperator_unittest.cpp
+++ b/relational_operators/tests/HashJoinOperator_unittest.cpp
@@ -92,6 +92,7 @@ constexpr tuple_id kNumDimTuples = 200;
 constexpr tuple_id kNumFactTuples = 300;
 constexpr tuple_id kBlockSize = 10;
 
+constexpr std::size_t kQueryId = 0;
 constexpr int kOpIndex = 0;
 
 }  // namespace
@@ -332,12 +333,12 @@ TEST_P(HashJoinOperatorTest, LongKeyHashJoinTest) {
 
   // Create the builder operator.
   unique_ptr builder(
-  new BuildHashOperator(*dim_table_,
+  new BuildHashOperator(kQueryId,
+*dim_table_,
 true /* is_stored */,
 std::vector(1, dim_col_long.getID()),
 dim_col_long.getType().isNullable(),
-join_hash_table_index,
-0));  // dummy query ID
+join_hash_table_index));
 
   // Create the prober operator with one selection attribute.
   const QueryContext::scalar_group_id selection_index = 
query_context_proto.scalar_groups_size();
@@ -359,18 +360,18 @@ TEST_P(HashJoinOperatorTest, LongKeyHashJoinTest) {
   insert_destination_proto->set_relation_id(output_relation_id);
   insert_destination_proto->set_relational_op_index(kOpIndex);
 
-  unique_ptr prober(
-  new HashJoinOperator(*dim_table_,
-   *fact_table_,
-   true /* is_stored */,
-   std::vector(1, fact_col_long.getID()),
-   fact_col_long.getType().isNullable(),
-   *result_table,
-   output_destination_index,
-   join_hash_table_index,
-   QueryContext::kInvalidPredicateId /* 
residual_predicate_index */,
-   selection_index,
-   0  /* dummy query ID */));
+  unique_ptr prober(new HashJoinOperator(
+  kQueryId,
+  *dim_table_,
+  *fact_table_,
+  true /* is_stored */,
+  std::vector(1, fact_col_long.getID()),
+  fact_col_long.getType().isNullable(),
+  *result_table,
+  output_destination_index,
+  join_hash_table_index,
+  QueryContext::kInvalidPredicateId /* residual_predicate_index */,
+  selection_index));
 
   // Set up the QueryContext.
   query_context_.reset(new QueryContext(query_context_proto,
@@ -423,7 +424,7 @@ TEST_P(HashJoinOperatorTest, LongKeyHashJoinTest) {
   }
 
   // Create cleaner operator.
-  unique_ptr cleaner(new 
DestroyHashOperator(join_hash_table_index, 0  /* dummy query ID */));
+  unique_ptr cleaner(new DestroyHashOperator(kQueryId, 
join_hash_table_index));
   cleaner->informAllBlockingDependenciesMet();
   fetchAndExecuteWorkOrders(cleaner.get());
 
@@ -475,12 +476,12 @@ TEST_P(HashJoinOperatorTest, IntDuplicateKeyHashJoinTest) 
{
 
   // Create the builder operator.
   unique_ptr builder(
-  new BuildHashOperator(*dim_table_,
+  new BuildHashOperator(kQueryId,
+*dim_table_,
 true /* is_stored */,
 std::vector(1, dim_col_int.getID()),
 dim_col_int.getType().isNullable(),
-join_hash_table_index,
-0));  // dummy query ID
+join_hash_table_index));
 
   // Create the prober operator with two selection attributes.
   const QueryContext::scalar_group_id selection_index = 
query_context_proto.scalar_groups_size();
@@ -507,18 +508,19 @@ TEST_P(HashJoinOperatorTest, IntDuplicateKeyHashJoinTest) 
{
   insert_destination_proto->set_relation_id(output_relation_id);
   insert_destination_proto->set_relational_op_index(kOpIndex);
 
-  unique_ptr prober(
-  new HashJoinOperator(*dim_table_,
-   *fact_table_,
-   true /* is_stored */,
-   std::vector(1, fact_col_int.getID()),
-   fact_col_int.getType().isNullable(),
-   *result_table,
-   output_destination_index,
-   join_hash_table_index,
-   QueryContext::kInvalidPredicateId /* 
residual_predicate_index */,
-   selection_index,
-   0  /* dummy query ID */));
+  unique_ptr prober(new HashJoinOperator(
+  kQueryId,
+  *dim_table_,
+  *fact_table_,
+  true /* is_stored */,
+  std::vector(1, fact_col_int.getID()),
+  

[45/50] [abbrv] incubator-quickstep git commit: Fix conditional per-target flags for lexer

2016-06-15 Thread hakanmemisoglu
Fix conditional per-target flags for lexer


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

Branch: refs/heads/decimal-type
Commit: 29768a7297746606089c6b2ebca1a9bf44180614
Parents: 31e9e4c
Author: Craig Chasseur 
Authored: Tue Jun 14 00:51:52 2016 -0700
Committer: Craig Chasseur 
Committed: Tue Jun 14 00:51:52 2016 -0700

--
 parser/CMakeLists.txt | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/29768a72/parser/CMakeLists.txt
--
diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt
index 9738c2c..2488d30 100644
--- a/parser/CMakeLists.txt
+++ b/parser/CMakeLists.txt
@@ -374,12 +374,15 @@ set_property(SOURCE 
${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp APPEND PROPERT
 include(CheckCXXCompilerFlag)
 CHECK_CXX_COMPILER_FLAG("-Wno-deprecated-register" 
COMPILER_HAS_WNO_DEPRECATED_REGISTER)
 if (COMPILER_HAS_WNO_DEPRECATED_REGISTER)
-  set_target_properties(quickstep_parser_SqlLexer PROPERTIES COMPILE_FLAGS 
"-Wno-deprecated-register")
+  set_property(TARGET quickstep_parser_SqlLexer APPEND_STRING PROPERTY 
COMPILE_FLAGS " -Wno-deprecated-register")
 endif()
 
 # GCC will make a warning for unsigned-signed comparisons which are inherent
 # in the lexer. For this, we turn off the sign compare.
-set_target_properties(quickstep_parser_SqlLexer PROPERTIES COMPILE_FLAGS 
"-Wno-sign-compare")
+CHECK_CXX_COMPILER_FLAG("-Wno-sign-compare" COMPILER_HAS_WNO_SIGN_COMPARE)
+if (COMPILER_HAS_WNO_SIGN_COMPARE)
+  set_property(TARGET quickstep_parser_SqlLexer APPEND_STRING PROPERTY 
COMPILE_FLAGS " -Wno-sign-compare")
+endif()
 
 add_subdirectory(tests)
 



[26/50] [abbrv] incubator-quickstep git commit: Reordered Query ID in operators and work orders.

2016-06-15 Thread hakanmemisoglu
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/1be47dcb/relational_operators/NestedLoopsJoinOperator.hpp
--
diff --git a/relational_operators/NestedLoopsJoinOperator.hpp 
b/relational_operators/NestedLoopsJoinOperator.hpp
index f165442..0b13842 100644
--- a/relational_operators/NestedLoopsJoinOperator.hpp
+++ b/relational_operators/NestedLoopsJoinOperator.hpp
@@ -59,6 +59,7 @@ class NestedLoopsJoinOperator : public RelationalOperator {
   /**
* @brief Constructor.
*
+   * @param query_id The ID of the query to which this operator belongs.
* @param left_input_relation The first relation in the join (order is not
*actually important).
* @param right_input_relation The second relation in the join (order is not
@@ -76,17 +77,17 @@ class NestedLoopsJoinOperator : public RelationalOperator {
* @param left_relation_is_stored If left_input_relation is a stored 
relation.
* @param right_relation_is_stored If right_input_relation is a stored
* relation.
-   * @param query_id The ID of the query to which this operator belongs.
**/
-  NestedLoopsJoinOperator(const CatalogRelation _input_relation,
-  const CatalogRelation _input_relation,
-  const CatalogRelation _relation,
-  const QueryContext::insert_destination_id 
output_destination_index,
-  const QueryContext::predicate_id 
join_predicate_index,
-  const QueryContext::scalar_group_id selection_index,
-  bool left_relation_is_stored,
-  bool right_relation_is_stored,
-  const std::size_t query_id)
+  NestedLoopsJoinOperator(
+  const std::size_t query_id,
+  const CatalogRelation _input_relation,
+  const CatalogRelation _input_relation,
+  const CatalogRelation _relation,
+  const QueryContext::insert_destination_id output_destination_index,
+  const QueryContext::predicate_id join_predicate_index,
+  const QueryContext::scalar_group_id selection_index,
+  bool left_relation_is_stored,
+  bool right_relation_is_stored)
   : RelationalOperator(query_id),
 left_input_relation_(left_input_relation),
 right_input_relation_(right_input_relation),
@@ -96,10 +97,12 @@ class NestedLoopsJoinOperator : public RelationalOperator {
 selection_index_(selection_index),
 left_relation_is_stored_(left_relation_is_stored),
 right_relation_is_stored_(right_relation_is_stored),
-left_relation_block_ids_(left_relation_is_stored ? 
left_input_relation.getBlocksSnapshot()
- : 
std::vector()),
-right_relation_block_ids_(right_relation_is_stored ? 
right_input_relation.getBlocksSnapshot()
-   : 
std::vector()),
+left_relation_block_ids_(left_relation_is_stored
+ ? left_input_relation.getBlocksSnapshot()
+ : std::vector()),
+right_relation_block_ids_(right_relation_is_stored
+  ? 
right_input_relation.getBlocksSnapshot()
+  : std::vector()),
 num_left_workorders_generated_(0),
 num_right_workorders_generated_(0),
 done_feeding_left_relation_(false),
@@ -222,6 +225,7 @@ class NestedLoopsJoinWorkOrder : public WorkOrder {
   /**
* @brief Constructor.
*
+   * @param query_id The ID of the query to which this operator belongs.
* @param left_input_relation The first relation in the join (order is not
*actually important).
* @param right_input_relation The second relation in the join (order is not
@@ -233,19 +237,19 @@ class NestedLoopsJoinWorkOrder : public WorkOrder {
* @param selection A list of Scalars corresponding to the relation 
attributes
*in \c output_destination. Each Scalar is evaluated for the joined
*tuples, and the resulting value is inserted into the join result.
-   * @param query_id The ID of the query to which this operator belongs.
* @param output_destination The InsertDestination to insert the join 
results.
* @param storage_manager The StorageManager to use.
**/
-  NestedLoopsJoinWorkOrder(const CatalogRelationSchema _input_relation,
-   const CatalogRelationSchema _input_relation,
-   const block_id left_block_id,
-   const block_id right_block_id,
-   const Predicate *join_predicate,
-   const std::vector 
,
-   const std::size_t query_id,
-   InsertDestination *output_destination,
-   

[11/50] [abbrv] incubator-quickstep git commit: Resolves SMA bugs revealed by TPCH. (#234)

2016-06-15 Thread hakanmemisoglu
Resolves SMA bugs revealed by TPCH. (#234)


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

Branch: refs/heads/decimal-type
Commit: 882cd386ab184c69508a4d4ff71a64cca0053969
Parents: 0115e96
Author: Marc S 
Authored: Mon May 23 11:11:44 2016 -0700
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:45 2016 -0700

--
 storage/CMakeLists.txt  |  1 +
 storage/SMAIndexSubBlock.cpp| 55 +++-
 storage/SMAIndexSubBlock.hpp|  3 +-
 storage/tests/SMAIndexSubBlock_unittest.cpp | 52 ++
 4 files changed, 99 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/882cd386/storage/CMakeLists.txt
--
diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt
index 26a3e32..a3093df 100644
--- a/storage/CMakeLists.txt
+++ b/storage/CMakeLists.txt
@@ -1451,6 +1451,7 @@ target_link_libraries(SMAIndexSubBlock_unittest
   quickstep_types_CharType
   quickstep_types_DoubleType
   quickstep_types_FloatType
+  quickstep_types_IntType
   quickstep_types_LongType
   quickstep_types_TypeFactory
   quickstep_types_TypeID

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/882cd386/storage/SMAIndexSubBlock.cpp
--
diff --git a/storage/SMAIndexSubBlock.cpp b/storage/SMAIndexSubBlock.cpp
index aa9bc54..3a1ccc2 100644
--- a/storage/SMAIndexSubBlock.cpp
+++ b/storage/SMAIndexSubBlock.cpp
@@ -181,19 +181,22 @@ Selectivity getSelectivity(const TypedValue ,
 }
 
 SMAPredicate* SMAPredicate::ExtractSMAPredicate(const ComparisonPredicate 
) {
-  if (predicate.getLeftOperand().hasStaticValue()) {
-DLOG_IF(FATAL, predicate.getRightOperand().getDataSource() != 
Scalar::kAttribute);
+  // Check that the predicate is contains an attribute and a literal value.
+  if (predicate.getLeftOperand().hasStaticValue() &&
+  predicate.getRightOperand().getDataSource() == Scalar::kAttribute) {
 return new SMAPredicate(
  static_cast(predicate.getRightOperand()).getAttribute().getID(),
  flipComparisonID(predicate.getComparison().getComparisonID()),
  predicate.getLeftOperand().getStaticValue().makeReferenceToThis());
-  } else {
-DLOG_IF(FATAL, predicate.getLeftOperand().getDataSource() != 
Scalar::kAttribute);
+  } else if (predicate.getRightOperand().hasStaticValue() &&
+  predicate.getLeftOperand().getDataSource() == Scalar::kAttribute) {
 return new SMAPredicate(
 static_cast(predicate.getLeftOperand()).getAttribute().getID(),
 predicate.getComparison().getComparisonID(),
 predicate.getRightOperand().getStaticValue().makeReferenceToThis());
   }
+  // Predicate is improper form, so return nullptr.
+  return nullptr;
 }
 
 /**
@@ -603,12 +606,47 @@ Selectivity 
SMAIndexSubBlock::getSelectivityForPredicate(const ComparisonPredica
   }
 
   std::unique_ptr 
sma_predicate(SMAPredicate::ExtractSMAPredicate(predicate));
+  // The predicate did not contain a static value to compare against.
+  if (!sma_predicate) {
+return Selectivity::kUnknown;
+  }
+
   const SMAEntry *entry = getEntryChecked(sma_predicate->attribute);
 
   // The attribute wasn't indexed.
   if (entry == nullptr || !entry->min_entry_ref.valid || 
!entry->max_entry_ref.valid) {
 return Selectivity::kUnknown;
   }
+
+  // Check that the type of the comparison is the same or can be coerced the
+  // type of the underlying attribute.
+  if (sma_predicate->literal.getTypeID() != entry->type_id) {
+// Try to coerce the literal type to the entry type.
+// It may have to account for variable length attributes.
+int literal_length = -1;
+if 
(TypeFactory::TypeRequiresLengthParameter(sma_predicate->literal.getTypeID())) {
+  literal_length = sma_predicate->literal.getAsciiStringLength();
+}
+
+const Type _type = literal_length == -1 ?
+TypeFactory::GetType(sma_predicate->literal.getTypeID(), false) :
+TypeFactory::GetType(sma_predicate->literal.getTypeID(), 
static_cast(literal_length), false);
+const Type _type = literal_length == -1 ?
+TypeFactory::GetType(entry->type_id, false) :
+TypeFactory::GetType(entry->type_id, 
static_cast(literal_length), false);
+if 

[14/50] [abbrv] incubator-quickstep git commit: Reverting the PR that gets the number of rows (#233)

2016-06-15 Thread hakanmemisoglu
Reverting the PR that gets the number of rows (#233)

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

Branch: refs/heads/decimal-type
Commit: 0115e961b214287f34ee14944e540462fb720918
Parents: 12d7928
Author: Rogers Jeffrey Leo John 
Authored: Sat May 21 07:36:06 2016 -0500
Committer: Zuyu Zhang 
Committed: Wed Jun 8 11:57:45 2016 -0700

--
 cli/CommandExecutor.cpp| 23 +++
 cli/tests/command_executor/D.test  | 14 +++---
 cli/tests/command_executor/Dt.test | 20 ++--
 3 files changed, 20 insertions(+), 37 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0115e961/cli/CommandExecutor.cpp
--
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index 3cb3f86..ddcd38f 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -72,7 +72,6 @@ void executeDescribeDatabase(
   // Column width initialized to 6 to take into account the header name
   // and the column value table
   int max_column_width = C::kInitMaxColumnWidth;
-  vector num_tuples;
   vector num_blocks;
   const CatalogRelation *relation = nullptr;
   if (arguments->size() == 0) {
@@ -80,8 +79,6 @@ void executeDescribeDatabase(
   max_column_width =
   std::max(static_cast(rel.getName().length()), max_column_width);
   num_blocks.push_back(rel.size_blocks());
-  num_tuples.push_back(
-  PrintToScreen::GetNumTuplesInRelation(rel, storage_manager));
 }
   } else {
 const ParseString _name = arguments->front();
@@ -94,49 +91,35 @@ void executeDescribeDatabase(
 max_column_width = std::max(static_cast(relation->getName().length()),
 max_column_width);
 num_blocks.push_back(relation->size_blocks());
-num_tuples.push_back(PrintToScreen::GetNumTuplesInRelation(
-*relation,
-storage_manager));
   }
   // Only if we have relations work on the printing logic.
   if (catalog_database.size() > 0) {
 const std::size_t max_num_blocks = *std::max_element(num_blocks.begin(), 
num_blocks.end());
-const std::size_t max_num_rows = *std::max_element(num_tuples.begin(), 
num_tuples.end());
-const int max_num_rows_digits = 
std::max(PrintToScreen::GetNumberOfDigits(max_num_rows),
-C::kInitMaxColumnWidth);
 const int max_num_blocks_digits = 
std::max(PrintToScreen::GetNumberOfDigits(max_num_blocks),
   C::kInitMaxColumnWidth+2);
-
 vector column_widths;
 column_widths.push_back(max_column_width +1);
 column_widths.push_back(C::kInitMaxColumnWidth + 1);
 column_widths.push_back(max_num_blocks_digits + 1);
-column_widths.push_back(max_num_rows_digits + 1);
 fputs("   List of relations\n\n", out);
 fprintf(out, "%-*s |", max_column_width+1, " Name");
 fprintf(out, "%-*s |", C::kInitMaxColumnWidth, " Type");
-fprintf(out, "%-*s |", max_num_blocks_digits, " Blocks");
-fprintf(out, "%-*s\n", max_num_rows_digits, " Rows");
+fprintf(out, "%-*s\n", max_num_blocks_digits, " Blocks");
 PrintToScreen::printHBar(column_widths, out);
 //  If there are no argument print the entire list of tables
 //  else print the particular table only.
-vector::const_iterator num_tuples_it = num_tuples.begin();
 vector::const_iterator num_blocks_it = num_blocks.begin();
 if (arguments->size() == 0) {
   for (const CatalogRelation  : catalog_database) {
 fprintf(out, " %-*s |", max_column_width, rel.getName().c_str());
 fprintf(out, " %-*s |", C::kInitMaxColumnWidth - 1, "table");
-fprintf(out, " %-*lu |", max_num_blocks_digits - 1, *num_blocks_it);
-fprintf(out, " %-*lu\n", max_num_rows_digits - 1, *num_tuples_it);
-++num_tuples_it;
+fprintf(out, " %-*lu\n", max_num_blocks_digits - 1, *num_blocks_it);
 ++num_blocks_it;
   }
 } else {
   fprintf(out, " %-*s |", max_column_width, relation->getName().c_str());
   fprintf(out, " %-*s |", C::kInitMaxColumnWidth -1, "table");
-  fprintf(out, " %-*lu |", max_num_blocks_digits - 1, *num_blocks_it);
-  fprintf(out, " %-*lu\n", max_num_rows_digits - 1, *num_tuples_it);
-  ++num_tuples_it;
+  fprintf(out, " %-*lu\n", max_num_blocks_digits - 1, *num_blocks_it);
   ++num_blocks_it;
 }
 fputc('\n', out);


[28/50] [abbrv] incubator-quickstep git commit: Fix typos in CMakeLists.txt.

2016-06-15 Thread hakanmemisoglu
Fix typos in CMakeLists.txt.


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

Branch: refs/heads/decimal-type
Commit: fd75e17576118ef539d696e3663691ce12518a3b
Parents: 1be47dc
Author: Navneet Potti 
Authored: Wed Jun 8 16:57:18 2016 -0500
Committer: Navneet Potti 
Committed: Wed Jun 8 17:21:33 2016 -0500

--
 expressions/CMakeLists.txt | 2 +-
 expressions/aggregation/CMakeLists.txt | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/fd75e175/expressions/CMakeLists.txt
--
diff --git a/expressions/CMakeLists.txt b/expressions/CMakeLists.txt
index d8452b2..53ad5d4 100644
--- a/expressions/CMakeLists.txt
+++ b/expressions/CMakeLists.txt
@@ -63,6 +63,6 @@ add_library(quickstep_expressions ../empty_src.cpp 
ExpressionsModule.hpp)
 target_link_libraries(quickstep_expressions
   quickstep_expressions_ExpressionFactories
   quickstep_expressions_Expressions_proto
-  quickstep_expressions_aggregate
+  quickstep_expressions_aggregation
   quickstep_expressions_predicate
   quickstep_expressions_scalar)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/fd75e175/expressions/aggregation/CMakeLists.txt
--
diff --git a/expressions/aggregation/CMakeLists.txt 
b/expressions/aggregation/CMakeLists.txt
index 416c4c6..5744c52 100644
--- a/expressions/aggregation/CMakeLists.txt
+++ b/expressions/aggregation/CMakeLists.txt
@@ -266,7 +266,6 @@ target_link_libraries(quickstep_expressions_aggregation
   quickstep_expressions_aggregation_AggregationHandleMax
   quickstep_expressions_aggregation_AggregationHandleMin
   quickstep_expressions_aggregation_AggregationHandleSum
-  quickstep_expressions_aggregation_AggregationHandleUtil
   quickstep_expressions_aggregation_AggregationID)
 
 # Tests:



  1   2   >