You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by hb...@apache.org on 2016/10/05 21:42:30 UTC
[1/7] incubator-quickstep git commit: Refactored RebuildStatus.
[Forced Update!]
Repository: incubator-quickstep
Updated Branches:
refs/heads/partitioned-aggregate-new eac0940e0 -> f6ab30f37 (forced update)
Refactored RebuildStatus.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/6b377d5d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/6b377d5d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/6b377d5d
Branch: refs/heads/partitioned-aggregate-new
Commit: 6b377d5d6c6f2e05ef74a4c1a022590af2db6571
Parents: ac3512c
Author: Zuyu Zhang <zu...@twitter.com>
Authored: Sat Sep 24 15:05:16 2016 -0700
Committer: Zuyu Zhang <zu...@twitter.com>
Committed: Sat Sep 24 15:05:16 2016 -0700
----------------------------------------------------------------------
query_execution/QueryExecutionState.hpp | 72 ++++++++++++++++++++--------
1 file changed, 53 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/6b377d5d/query_execution/QueryExecutionState.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionState.hpp b/query_execution/QueryExecutionState.hpp
index 9ae9563..f5281d5 100644
--- a/query_execution/QueryExecutionState.hpp
+++ b/query_execution/QueryExecutionState.hpp
@@ -92,8 +92,15 @@ class QueryExecutionState {
const std::size_t num_rebuild_workorders,
const bool rebuild_initiated) {
DCHECK(operator_index < num_operators_);
- rebuild_status_[operator_index].second = num_rebuild_workorders;
- rebuild_status_[operator_index].first = rebuild_initiated;
+ auto search_res = rebuild_status_.find(operator_index);
+ if (search_res != rebuild_status_.end()) {
+ search_res->second.has_initiated = rebuild_initiated;
+ search_res->second.num_pending_workorders = num_rebuild_workorders;
+ } else {
+ RebuildStatus rebuild_status(rebuild_initiated, num_rebuild_workorders);
+
+ rebuild_status_.emplace(operator_index, std::move(rebuild_status));
+ }
}
/**
@@ -107,7 +114,7 @@ class QueryExecutionState {
DCHECK(operator_index < num_operators_);
const auto search_res = rebuild_status_.find(operator_index);
if (search_res != rebuild_status_.end()) {
- return search_res->second.first;
+ return search_res->second.has_initiated;
}
return false;
}
@@ -124,7 +131,7 @@ class QueryExecutionState {
DCHECK(operator_index < num_operators_);
const auto search_res = rebuild_status_.find(operator_index);
if (search_res != rebuild_status_.end()) {
- return search_res->second.second;
+ return search_res->second.num_pending_workorders;
}
LOG(WARNING) << "Called QueryExecutionState::getNumRebuildWorkOrders() "
"for an operator whose rebuild entry doesn't exist.";
@@ -132,22 +139,39 @@ class QueryExecutionState {
}
/**
+ * @brief Increment the number of rebuild WorkOrders for the given operator.
+ *
+ * @param operator_index The index of the given operator.
+ * @param num_rebuild_workorders The number of rebuild workorders of the given
+ * operator.
+ **/
+ inline void incrementNumRebuildWorkOrders(const std::size_t operator_index,
+ const std::size_t num_rebuild_workorders) {
+ DCHECK_LT(operator_index, num_operators_);
+ auto search_res = rebuild_status_.find(operator_index);
+ DCHECK(search_res != rebuild_status_.end())
+ << "Called for an operator whose rebuild status does not exist.";
+ DCHECK(search_res->second.has_initiated);
+
+ search_res->second.num_pending_workorders += num_rebuild_workorders;
+ }
+
+ /**
* @brief Decrement the number of rebuild WorkOrders for the given operator.
*
* @param operator_index The index of the given operator.
**/
inline void decrementNumRebuildWorkOrders(const std::size_t operator_index) {
DCHECK(operator_index < num_operators_);
- const auto search_res = rebuild_status_.find(operator_index);
- if (search_res != rebuild_status_.end()) {
- DCHECK(search_res->second.first);
- DCHECK_GE(search_res->second.second, 1u);
- --rebuild_status_[operator_index].second;
- } else {
- LOG(FATAL) <<
- "Called QueryExecutionState::decrementNumRebuildWorkOrders() for an "
- "operator whose rebuild entry doesn't exist.";
- }
+ auto search_res = rebuild_status_.find(operator_index);
+ CHECK(search_res != rebuild_status_.end())
+ << "Called QueryExecutionState::decrementNumRebuildWorkOrders() for an "
+ "operator whose rebuild entry doesn't exist.";
+
+ DCHECK(search_res->second.has_initiated);
+ DCHECK_GE(search_res->second.num_pending_workorders, 1u);
+
+ --(search_res->second.num_pending_workorders);
}
/**
@@ -279,11 +303,21 @@ class QueryExecutionState {
// The ith bit denotes if the operator with ID = i has finished its execution.
std::vector<bool> execution_finished_;
- // Key is dag_node_index for which rebuild is required. Value is a pair -
- // first element is a bool (whether rebuild for operator at index i has been
- // initiated) and if the boolean is true, the second element denotes the
- // number of pending rebuild workorders for the operator.
- std::unordered_map<std::size_t, std::pair<bool, std::size_t>> rebuild_status_;
+ struct RebuildStatus {
+ RebuildStatus(const bool initiated,
+ const std::size_t num_workorders)
+ : has_initiated(initiated),
+ num_pending_workorders(num_workorders) {}
+
+ // Whether rebuild for operator at index i has been initiated.
+ bool has_initiated;
+ // The number of pending rebuild workorders for the operator.
+ // Valid if and only if 'has_initiated' is true.
+ std::size_t num_pending_workorders;
+ };
+
+ // Key is dag_node_index for which rebuild is required.
+ std::unordered_map<std::size_t, RebuildStatus> rebuild_status_;
DISALLOW_COPY_AND_ASSIGN(QueryExecutionState);
};
[7/7] incubator-quickstep git commit: Support for performing
partitioned aggregation.
Posted by hb...@apache.org.
Support for performing partitioned aggregation.
- Used for creating a pool of hash tables such that each hash table
belongs to a unique partition.
- The partitioning is done on the group-by keys.
- Wrote a utility function to compute composite hash of a group of
TypedValues.
- Added a check for whether the aggregation is partitioned or not.
- The conditions for whether the aggregation can be partitioned
are as follows:
1. The query has a GROUP BY clause.
2. There are no aggrgeations with a DISTINCT clause.
3. The estimated number of groups are greater than a pre-defined
threshold.
4. The query has at least one aggregation function.
- Method for partitioned aggregation with GROUP BY
- StorageBlock now provides a method for performing GROUP BY aggregation
in a partitioned way.
- The Tuple class now supports a method to compute the hash of the entire
tuple (i.e. hash key is the composite key made up of all the
attributes in the tuple).
- AggregationOperationState calls appropriate method (i.e.
aggregateGroupBy or aggregateGroupByPartitioned) based on the way in
which aggregation is being performed.
- Set each hash table's size estimate to be overall estimate divided by
the number of partitions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/f6ab30f3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/f6ab30f3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/f6ab30f3
Branch: refs/heads/partitioned-aggregate-new
Commit: f6ab30f375ae6854c109ddef127b01a1a502c9aa
Parents: ad1f8c4
Author: Harshad Deshmukh <hb...@apache.org>
Authored: Wed Sep 21 11:43:39 2016 -0500
Committer: Harshad Deshmukh <hb...@apache.org>
Committed: Wed Oct 5 16:41:34 2016 -0500
----------------------------------------------------------------------
.../FinalizeAggregationOperator.cpp | 35 ++-
.../FinalizeAggregationOperator.hpp | 9 +-
storage/AggregationOperationState.cpp | 135 ++++++++---
storage/AggregationOperationState.hpp | 52 +++++
storage/CMakeLists.txt | 12 +
storage/HashTablePool.hpp | 17 +-
storage/PartitionedHashTablePool.hpp | 224 +++++++++++++++++++
storage/StorageBlock.cpp | 115 ++++++++++
storage/StorageBlock.hpp | 43 ++++
types/containers/CMakeLists.txt | 1 +
types/containers/Tuple.hpp | 8 +
utility/CMakeLists.txt | 6 +
utility/CompositeHash.hpp | 52 +++++
13 files changed, 661 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/relational_operators/FinalizeAggregationOperator.cpp
----------------------------------------------------------------------
diff --git a/relational_operators/FinalizeAggregationOperator.cpp b/relational_operators/FinalizeAggregationOperator.cpp
index 7e337de..55d1357 100644
--- a/relational_operators/FinalizeAggregationOperator.cpp
+++ b/relational_operators/FinalizeAggregationOperator.cpp
@@ -41,12 +41,29 @@ bool FinalizeAggregationOperator::getAllWorkOrders(
if (blocking_dependencies_met_ && !started_) {
started_ = true;
- container->addNormalWorkOrder(
- new FinalizeAggregationWorkOrder(
- query_id_,
- query_context->getAggregationState(aggr_state_index_),
- query_context->getInsertDestination(output_destination_index_)),
- op_index_);
+ DCHECK(query_context->getAggregationState(aggr_state_index_) != nullptr);
+ if (query_context->getAggregationState(aggr_state_index_)->isAggregatePartitioned()) {
+ // The same AggregationState is shared across all the WorkOrders.
+ for (std::size_t part_id = 0;
+ part_id < query_context->getAggregationState(aggr_state_index_)
+ ->getNumPartitions();
+ ++part_id) {
+ container->addNormalWorkOrder(
+ new FinalizeAggregationWorkOrder(
+ query_id_,
+ query_context->getAggregationState(aggr_state_index_),
+ query_context->getInsertDestination(output_destination_index_),
+ static_cast<int>(part_id)),
+ op_index_);
+ }
+ } else {
+ container->addNormalWorkOrder(
+ new FinalizeAggregationWorkOrder(
+ query_id_,
+ query_context->getAggregationState(aggr_state_index_),
+ query_context->getInsertDestination(output_destination_index_)),
+ op_index_);
+ }
}
return started_;
}
@@ -70,7 +87,11 @@ bool FinalizeAggregationOperator::getAllWorkOrderProtos(WorkOrderProtosContainer
void FinalizeAggregationWorkOrder::execute() {
- state_->finalizeAggregate(output_destination_);
+ if (state_->isAggregatePartitioned()) {
+ state_->finalizeAggregatePartitioned(part_id_, output_destination_);
+ } else {
+ state_->finalizeAggregate(output_destination_);
+ }
}
} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/relational_operators/FinalizeAggregationOperator.hpp
----------------------------------------------------------------------
diff --git a/relational_operators/FinalizeAggregationOperator.hpp b/relational_operators/FinalizeAggregationOperator.hpp
index 0aeac2a..ae7127a 100644
--- a/relational_operators/FinalizeAggregationOperator.hpp
+++ b/relational_operators/FinalizeAggregationOperator.hpp
@@ -119,13 +119,17 @@ class FinalizeAggregationWorkOrder : public WorkOrder {
* @param state The AggregationState to use.
* @param output_destination The InsertDestination to insert aggregation
* results.
+ * @param part_id The partition ID for which the Finalize aggregation work
+ * order is issued. Ignore if aggregation is not partitioned.
*/
FinalizeAggregationWorkOrder(const std::size_t query_id,
AggregationOperationState *state,
- InsertDestination *output_destination)
+ InsertDestination *output_destination,
+ const int part_id = -1)
: WorkOrder(query_id),
state_(DCHECK_NOTNULL(state)),
- output_destination_(DCHECK_NOTNULL(output_destination)) {}
+ output_destination_(DCHECK_NOTNULL(output_destination)),
+ part_id_(part_id) {}
~FinalizeAggregationWorkOrder() override {}
@@ -134,6 +138,7 @@ class FinalizeAggregationWorkOrder : public WorkOrder {
private:
AggregationOperationState *state_;
InsertDestination *output_destination_;
+ const int part_id_;
DISALLOW_COPY_AND_ASSIGN(FinalizeAggregationWorkOrder);
};
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/AggregationOperationState.cpp
----------------------------------------------------------------------
diff --git a/storage/AggregationOperationState.cpp b/storage/AggregationOperationState.cpp
index 073b813..3282736 100644
--- a/storage/AggregationOperationState.cpp
+++ b/storage/AggregationOperationState.cpp
@@ -69,6 +69,8 @@ AggregationOperationState::AggregationOperationState(
const std::vector<HashTableImplType> &distinctify_hash_table_impl_types,
StorageManager *storage_manager)
: input_relation_(input_relation),
+ is_aggregate_partitioned_(checkAggregatePartitioned(
+ estimated_num_entries, is_distinct, group_by, aggregate_functions)),
predicate_(predicate),
group_by_list_(std::move(group_by)),
arguments_(std::move(arguments)),
@@ -166,18 +168,16 @@ AggregationOperationState::AggregationOperationState(
}
// Initialize the corresponding distinctify hash table if this is a
- // DISTINCT
- // aggregation.
+ // DISTINCT aggregation.
if (*is_distinct_it) {
std::vector<const Type *> 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 may estimate
- // for each distinct aggregation an estimated_num_distinct_keys value
- // during
- // query optimization, if it worths.
+ // estimating the number of entries in the distinctify hash table.
+ // We may estimate for each distinct aggregation an
+ // estimated_num_distinct_keys value during query optimization, if it's
+ // worth.
distinctify_hashtables_.emplace_back(
AggregationStateFastHashTableFactory::CreateResizable(
*distinctify_hash_table_impl_types_it,
@@ -193,14 +193,24 @@ AggregationOperationState::AggregationOperationState(
}
if (!group_by_handles.empty()) {
- // Aggregation with GROUP BY: create a HashTable pool for per-group
- // states.
- group_by_hashtable_pool_.reset(new HashTablePool(estimated_num_entries,
- hash_table_impl_type,
- group_by_types,
- payload_sizes,
- group_by_handles,
- storage_manager));
+ // Aggregation with GROUP BY: create a HashTable pool.
+ if (!is_aggregate_partitioned_) {
+ group_by_hashtable_pool_.reset(new HashTablePool(estimated_num_entries,
+ hash_table_impl_type,
+ group_by_types,
+ payload_sizes,
+ group_by_handles,
+ storage_manager));
+ } else {
+ partitioned_group_by_hashtable_pool_.reset(
+ new PartitionedHashTablePool(estimated_num_entries,
+ kNumPartitionsForAggregate,
+ hash_table_impl_type,
+ group_by_types,
+ payload_sizes,
+ group_by_handles,
+ storage_manager));
+ }
}
}
}
@@ -439,20 +449,30 @@ void AggregationOperationState::aggregateBlockHashTable(
}
}
- // Call StorageBlock::aggregateGroupBy() to aggregate this block's values
- // directly into the (threadsafe) shared global HashTable for this
- // aggregate.
- DCHECK(group_by_hashtable_pool_ != nullptr);
- AggregationStateHashTableBase *agg_hash_table =
+ if (!is_aggregate_partitioned_) {
+ // Call StorageBlock::aggregateGroupBy() to aggregate this block's values
+ // directly into the (threadsafe) shared global HashTable for this
+ // aggregate.
+ DCHECK(group_by_hashtable_pool_ != nullptr);
+ AggregationStateHashTableBase *agg_hash_table =
group_by_hashtable_pool_->getHashTableFast();
- DCHECK(agg_hash_table != nullptr);
- block->aggregateGroupBy(arguments_,
- group_by_list_,
- predicate_.get(),
- agg_hash_table,
- &reuse_matches,
- &reuse_group_by_vectors);
- group_by_hashtable_pool_->returnHashTable(agg_hash_table);
+ DCHECK(agg_hash_table != nullptr);
+ block->aggregateGroupBy(arguments_,
+ group_by_list_,
+ predicate_.get(),
+ agg_hash_table,
+ &reuse_matches,
+ &reuse_group_by_vectors);
+ group_by_hashtable_pool_->returnHashTable(agg_hash_table);
+ } else {
+ block->aggregateGroupByPartitioned(
+ arguments_,
+ group_by_list_,
+ predicate_.get(),
+ &reuse_matches,
+ &reuse_group_by_vectors,
+ partitioned_group_by_hashtable_pool_.get());
+ }
}
void AggregationOperationState::finalizeSingleState(
@@ -595,4 +615,63 @@ void AggregationOperationState::finalizeHashTable(
output_destination->bulkInsertTuples(&complete_result);
}
+void AggregationOperationState::finalizeAggregatePartitioned(
+ const std::size_t partition_id, InsertDestination *output_destination) {
+ // Each element of 'group_by_keys' is a vector of values for a particular
+ // group (which is also the prefix of the finalized Tuple for that group).
+ std::vector<std::vector<TypedValue>> group_by_keys;
+
+ // Collect per-aggregate finalized values.
+ std::vector<std::unique_ptr<ColumnVector>> final_values;
+ for (std::size_t agg_idx = 0; agg_idx < handles_.size(); ++agg_idx) {
+ AggregationStateHashTableBase *hash_table =
+ partitioned_group_by_hashtable_pool_->getHashTable(partition_id);
+ ColumnVector *agg_result_col = handles_[agg_idx]->finalizeHashTable(
+ *hash_table, &group_by_keys, agg_idx);
+ if (agg_result_col != nullptr) {
+ final_values.emplace_back(agg_result_col);
+ }
+ }
+
+ // Reorganize 'group_by_keys' in column-major order so that we can make a
+ // ColumnVectorsValueAccessor to bulk-insert results.
+ //
+ // TODO(chasseur): Shuffling around the GROUP BY keys like this is suboptimal
+ // if there is only one aggregate. The need to do this should hopefully go
+ // away when we work out storing composite structures for multiple aggregates
+ // in a single HashTable.
+ std::vector<std::unique_ptr<ColumnVector>> group_by_cvs;
+ std::size_t group_by_element_idx = 0;
+ for (const std::unique_ptr<const Scalar> &group_by_element : group_by_list_) {
+ const Type &group_by_type = group_by_element->getType();
+ if (NativeColumnVector::UsableForType(group_by_type)) {
+ NativeColumnVector *element_cv = new NativeColumnVector(group_by_type, group_by_keys.size());
+ group_by_cvs.emplace_back(element_cv);
+ for (std::vector<TypedValue> &group_key : group_by_keys) {
+ element_cv->appendTypedValue(std::move(group_key[group_by_element_idx]));
+ }
+ } else {
+ IndirectColumnVector *element_cv = new IndirectColumnVector(group_by_type, group_by_keys.size());
+ group_by_cvs.emplace_back(element_cv);
+ for (std::vector<TypedValue> &group_key : group_by_keys) {
+ element_cv->appendTypedValue(std::move(group_key[group_by_element_idx]));
+ }
+ }
+ ++group_by_element_idx;
+ }
+
+ // Stitch together a ColumnVectorsValueAccessor combining the GROUP BY keys
+ // and the finalized aggregates.
+ ColumnVectorsValueAccessor complete_result;
+ for (std::unique_ptr<ColumnVector> &group_by_cv : group_by_cvs) {
+ complete_result.addColumn(group_by_cv.release());
+ }
+ for (std::unique_ptr<ColumnVector> &final_value_cv : final_values) {
+ complete_result.addColumn(final_value_cv.release());
+ }
+
+ // Bulk-insert the complete result.
+ output_destination->bulkInsertTuples(&complete_result);
+}
+
} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/AggregationOperationState.hpp
----------------------------------------------------------------------
diff --git a/storage/AggregationOperationState.hpp b/storage/AggregationOperationState.hpp
index cbbfc22..4dae8c7 100644
--- a/storage/AggregationOperationState.hpp
+++ b/storage/AggregationOperationState.hpp
@@ -32,6 +32,7 @@
#include "storage/AggregationOperationState.pb.h"
#include "storage/HashTableBase.hpp"
#include "storage/HashTablePool.hpp"
+#include "storage/PartitionedHashTablePool.hpp"
#include "storage/StorageBlockInfo.hpp"
#include "utility/Macros.hpp"
@@ -167,12 +168,31 @@ class AggregationOperationState {
**/
void finalizeAggregate(InsertDestination *output_destination);
+ void finalizeAggregatePartitioned(
+ const std::size_t partition_id, InsertDestination *output_destination);
+
static void mergeGroupByHashTables(AggregationStateHashTableBase *src,
AggregationStateHashTableBase *dst);
+ bool isAggregatePartitioned() const {
+ return is_aggregate_partitioned_;
+ }
+
+ /**
+ * @note This method is relevant only when the aggregate is partitioned.
+ **/
+ std::size_t getNumPartitions() const {
+ return is_aggregate_partitioned_
+ ? partitioned_group_by_hashtable_pool_->getNumPartitions()
+ : 1;
+ }
+
int dflag;
private:
+ static constexpr std::size_t kPartitionedAggregateThreshold = 100;
+ static constexpr std::size_t kNumPartitionsForAggregate = 40;
+
// Merge locally (per storage block) aggregated states with global aggregation
// states.
void mergeSingleState(
@@ -185,9 +205,39 @@ class AggregationOperationState {
void finalizeSingleState(InsertDestination *output_destination);
void finalizeHashTable(InsertDestination *output_destination);
+ bool checkAggregatePartitioned(
+ const std::size_t estimated_num_groups,
+ const std::vector<bool> &is_distinct,
+ const std::vector<std::unique_ptr<const Scalar>> &group_by,
+ const std::vector<const AggregateFunction *> &aggregate_functions) const {
+ // If there's no aggregation, return false.
+ if (aggregate_functions.empty()) {
+ return false;
+ }
+ // Check if there's a distinct operation involved in any aggregate, if so
+ // the aggregate can't be partitioned.
+ for (auto distinct : is_distinct) {
+ if (distinct) {
+ return false;
+ }
+ }
+ // There's no distinct aggregation involved, Check if there's at least one
+ // GROUP BY operation.
+ if (group_by.empty()) {
+ return false;
+ }
+ // There are GROUP BYs without DISTINCT. Check if the estimated number of
+ // groups is large enough to warrant a partitioned aggregation.
+ return estimated_num_groups > kPartitionedAggregateThreshold;
+ }
+
// Common state for all aggregates in this operation: the input relation, the
// filter predicate (if any), and the list of GROUP BY expressions (if any).
const CatalogRelationSchema &input_relation_;
+
+ // Whether the aggregation is partitioned or not.
+ const bool is_aggregate_partitioned_;
+
std::unique_ptr<const Predicate> predicate_;
std::vector<std::unique_ptr<const Scalar>> group_by_list_;
@@ -224,6 +274,8 @@ class AggregationOperationState {
// A vector of group by hash table pools.
std::unique_ptr<HashTablePool> group_by_hashtable_pool_;
+ std::unique_ptr<PartitionedHashTablePool> partitioned_group_by_hashtable_pool_;
+
StorageManager *storage_manager_;
DISALLOW_COPY_AND_ASSIGN(AggregationOperationState);
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt
index f05cc46..9c1ebd0 100644
--- a/storage/CMakeLists.txt
+++ b/storage/CMakeLists.txt
@@ -235,6 +235,7 @@ add_library(quickstep_storage_PackedRowStoreTupleStorageSubBlock
add_library(quickstep_storage_PackedRowStoreValueAccessor
../empty_src.cpp
PackedRowStoreValueAccessor.hpp)
+add_library(quickstep_storage_PartitionedHashTablePool ../empty_src.cpp PartitionedHashTablePool.hpp)
add_library(quickstep_storage_PreloaderThread PreloaderThread.cpp PreloaderThread.hpp)
add_library(quickstep_storage_SMAIndexSubBlock SMAIndexSubBlock.cpp SMAIndexSubBlock.hpp)
add_library(quickstep_storage_SeparateChainingHashTable ../empty_src.cpp SeparateChainingHashTable.hpp)
@@ -289,6 +290,7 @@ target_link_libraries(quickstep_storage_AggregationOperationState
quickstep_storage_HashTableFactory
quickstep_storage_HashTablePool
quickstep_storage_InsertDestination
+ quickstep_storage_PartitionedHashTablePool
quickstep_storage_StorageBlock
quickstep_storage_StorageBlockInfo
quickstep_storage_StorageManager
@@ -850,6 +852,14 @@ target_link_libraries(quickstep_storage_PackedRowStoreValueAccessor
quickstep_types_TypedValue
quickstep_utility_BitVector
quickstep_utility_Macros)
+target_link_libraries(quickstep_storage_PartitionedHashTablePool
+ glog
+ quickstep_expressions_aggregation_AggregationHandle
+ quickstep_storage_FastHashTable
+ quickstep_storage_FastHashTableFactory
+ quickstep_storage_HashTableBase
+ quickstep_utility_Macros
+ quickstep_utility_StringUtil)
target_link_libraries(quickstep_storage_PreloaderThread
glog
quickstep_catalog_CatalogDatabase
@@ -971,6 +981,7 @@ target_link_libraries(quickstep_storage_StorageBlock
quickstep_storage_IndexSubBlock
quickstep_storage_InsertDestinationInterface
quickstep_storage_PackedRowStoreTupleStorageSubBlock
+ quickstep_storage_PartitionedHashTablePool
quickstep_storage_SMAIndexSubBlock
quickstep_storage_SplitRowStoreTupleStorageSubBlock
quickstep_storage_StorageBlockBase
@@ -1167,6 +1178,7 @@ target_link_libraries(quickstep_storage
quickstep_storage_LinearOpenAddressingHashTable
quickstep_storage_PackedRowStoreTupleStorageSubBlock
quickstep_storage_PackedRowStoreValueAccessor
+ quickstep_storage_PartitionedHashTablePool
quickstep_storage_PreloaderThread
quickstep_storage_SMAIndexSubBlock
quickstep_storage_SeparateChainingHashTable
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/HashTablePool.hpp
----------------------------------------------------------------------
diff --git a/storage/HashTablePool.hpp b/storage/HashTablePool.hpp
index 3cdfcb3..c34a435 100644
--- a/storage/HashTablePool.hpp
+++ b/storage/HashTablePool.hpp
@@ -77,7 +77,7 @@ class HashTablePool {
const std::vector<const Type *> &group_by_types,
AggregationHandle *agg_handle,
StorageManager *storage_manager)
- : estimated_num_entries_(reduceEstimatedCardinality(estimated_num_entries)),
+ : estimated_num_entries_(setHashTableSize()),
hash_table_impl_type_(hash_table_impl_type),
group_by_types_(group_by_types),
agg_handle_(DCHECK_NOTNULL(agg_handle)),
@@ -104,7 +104,7 @@ class HashTablePool {
const std::vector<std::size_t> &payload_sizes,
const std::vector<AggregationHandle *> &handles,
StorageManager *storage_manager)
- : estimated_num_entries_(reduceEstimatedCardinality(estimated_num_entries)),
+ : estimated_num_entries_(setHashTableSize()),
hash_table_impl_type_(hash_table_impl_type),
group_by_types_(group_by_types),
payload_sizes_(payload_sizes),
@@ -196,17 +196,12 @@ class HashTablePool {
storage_manager_);
}
- inline std::size_t reduceEstimatedCardinality(
- const std::size_t original_estimate) const {
- if (original_estimate < kEstimateReductionFactor) {
- return original_estimate;
- } else {
- DCHECK_GT(kEstimateReductionFactor, 0u);
- return original_estimate / kEstimateReductionFactor;
- }
+ inline std::size_t setHashTableSize() const {
+ return kHashTableSize;
}
- static constexpr std::size_t kEstimateReductionFactor = 100;
+ // L2 cache size.
+ static constexpr std::size_t kHashTableSize = 262144;
std::vector<std::unique_ptr<AggregationStateHashTableBase>> hash_tables_;
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/PartitionedHashTablePool.hpp
----------------------------------------------------------------------
diff --git a/storage/PartitionedHashTablePool.hpp b/storage/PartitionedHashTablePool.hpp
new file mode 100644
index 0000000..c7ce0c4
--- /dev/null
+++ b/storage/PartitionedHashTablePool.hpp
@@ -0,0 +1,224 @@
+/**
+ * Copyright 2016, Quickstep Research Group, Computer Sciences Department,
+ * University of Wisconsin\u2014Madison.
+ *
+ * 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.
+ **/
+
+#ifndef QUICKSTEP_STORAGE_PARTITIONED_HASH_TABLE_POOL_HPP_
+#define QUICKSTEP_STORAGE_PARTITIONED_HASH_TABLE_POOL_HPP_
+
+#include <algorithm>
+#include <chrono>
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "expressions/aggregation/AggregationHandle.hpp"
+#include "storage/HashTableBase.hpp"
+#include "storage/FastHashTable.hpp"
+#include "storage/FastHashTableFactory.hpp"
+#include "utility/Macros.hpp"
+#include "utility/StringUtil.hpp"
+
+#include "glog/logging.h"
+
+namespace quickstep {
+
+class StorageManager;
+class Type;
+
+/** \addtogroup Storage
+ * @{
+ */
+
+/**
+ * @brief A pool of HashTables used for a single aggregation handle. Each
+ * HashTable represents values from a given partition, which is
+ * determined by the keys in the group by clause.
+ **/
+class PartitionedHashTablePool {
+ public:
+ /**
+ * @brief Constructor.
+ *
+ * @param estimated_num_entries The maximum number of entries in a hash table.
+ * @param num_partitions The number of partitions (i.e. number of HashTables)
+ * @param hash_table_impl_type The type of hash table implementation.
+ * @param group_by_types A vector of pointer of types which form the group by
+ * key.
+ * @param agg_handle The aggregation handle.
+ * @param storage_manager A pointer to the storage manager.
+ *
+ * @note The estimate of number of entries is quite inaccurate at this time.
+ * If we go by the current estimate, each hash table demands much
+ * larger space than it actually needs, which causes the system to
+ * either trigger evictions or worse - run out of memory. To fix this
+ * issue, we divide the estimate by 100. The division will not affect
+ * correctness, however it may allocate some hash tables smaller space
+ * than their requirement, causing them to be resized during build
+ * phase, which has a performance penalty.
+ **/
+ PartitionedHashTablePool(const std::size_t estimated_num_entries,
+ const std::size_t num_partitions,
+ const HashTableImplType hash_table_impl_type,
+ const std::vector<const Type *> &group_by_types,
+ AggregationHandle *agg_handle,
+ StorageManager *storage_manager)
+ : estimated_num_entries_(
+ setHashTableSize(estimated_num_entries, num_partitions)),
+ num_partitions_(num_partitions),
+ hash_table_impl_type_(hash_table_impl_type),
+ group_by_types_(group_by_types),
+ agg_handle_(DCHECK_NOTNULL(agg_handle)),
+ storage_manager_(DCHECK_NOTNULL(storage_manager)) {
+ initializeAllHashTables();
+ }
+
+ /**
+ * @brief Constructor.
+ *
+ * @note This constructor is relevant for the HashTable specialized for
+ * aggregation.
+ *
+ * @param estimated_num_entries The maximum number of entries in a hash table.
+ * @param num_partitions The number of partitions (i.e. number of HashTables)
+ * @param hash_table_impl_type The type of hash table implementation.
+ * @param group_by_types A vector of pointer of types which form the group by
+ * key.
+ * @param payload_sizes The sizes of the payload elements (i.e.
+ * AggregationStates).
+ * @param handles The aggregation handles.
+ * @param storage_manager A pointer to the storage manager.
+ **/
+ PartitionedHashTablePool(const std::size_t estimated_num_entries,
+ const std::size_t num_partitions,
+ const HashTableImplType hash_table_impl_type,
+ const std::vector<const Type *> &group_by_types,
+ const std::vector<std::size_t> &payload_sizes,
+ const std::vector<AggregationHandle *> &handles,
+ StorageManager *storage_manager)
+ : estimated_num_entries_(
+ setHashTableSize(estimated_num_entries, num_partitions)),
+ num_partitions_(num_partitions),
+ hash_table_impl_type_(hash_table_impl_type),
+ group_by_types_(group_by_types),
+ payload_sizes_(payload_sizes),
+ handles_(handles),
+ storage_manager_(DCHECK_NOTNULL(storage_manager)) {
+ initializeAllHashTables();
+ }
+
+ /**
+ * @brief Check out a hash table for insertion.
+ *
+ * @param partition_id The ID of the partitioned HashTable.
+ *
+ * @return A hash table pointer for the given HashTable.
+ **/
+ AggregationStateHashTableBase* getHashTable(const std::size_t partition_id) {
+ DCHECK_LT(partition_id, num_partitions_);
+ DCHECK_LT(partition_id, hash_tables_.size());
+ return hash_tables_[partition_id].get();
+ }
+
+ /**
+ * @brief Check out a hash table for insertion.
+ *
+ * @param partition_id The ID of the partitioned HashTable.
+ *
+ * @return A hash table pointer for the given HashTable.
+ **/
+ AggregationStateHashTableBase* getHashTableFast(const std::size_t partition_id) {
+ DCHECK_LT(partition_id, num_partitions_);
+ DCHECK_LT(partition_id, hash_tables_.size());
+ return hash_tables_[partition_id].get();
+ }
+
+ /**
+ * @brief Get all the hash tables from the pool.
+ *
+ * @warning The caller should ensure that this call is made when no hash table
+ * is being checked in or checked out from the pool. In other words
+ * the hash table pool is in read-only state.
+ *
+ * @param All the hash tables in the pool.
+ *
+ **/
+ std::vector<std::unique_ptr<AggregationStateHashTableBase>>*
+ getAllHashTables() {
+ return &hash_tables_;
+ }
+
+ /**
+ * @brief Get the number of partitions used for the aggregation.
+ **/
+ inline std::size_t getNumPartitions() const {
+ return num_partitions_;
+ }
+
+ private:
+ void initializeAllHashTables() {
+ for (std::size_t part_num = 0; part_num < num_partitions_; ++part_num) {
+ AggregationStateHashTableBase *part_hash_table = createNewHashTableFast();
+ hash_tables_.push_back(
+ std::unique_ptr<AggregationStateHashTableBase>(part_hash_table));
+ }
+ }
+
+ AggregationStateHashTableBase* createNewHashTable() {
+ return agg_handle_->createGroupByHashTable(hash_table_impl_type_,
+ group_by_types_,
+ estimated_num_entries_,
+ storage_manager_);
+ }
+
+ AggregationStateHashTableBase* createNewHashTableFast() {
+ return AggregationStateFastHashTableFactory::CreateResizable(
+ hash_table_impl_type_,
+ group_by_types_,
+ estimated_num_entries_,
+ payload_sizes_,
+ handles_,
+ storage_manager_);
+ }
+
+ inline std::size_t setHashTableSize(const std::size_t overall_estimate,
+ const std::size_t num_partitions) const {
+ CHECK(num_partitions != 0);
+ return std::min(overall_estimate/num_partitions, 1);
+ }
+
+ std::vector<std::unique_ptr<AggregationStateHashTableBase>> hash_tables_;
+
+ const std::size_t estimated_num_entries_;
+ const std::size_t num_partitions_;
+
+ const HashTableImplType hash_table_impl_type_;
+
+ const std::vector<const Type *> group_by_types_;
+
+ std::vector<std::size_t> payload_sizes_;
+
+ AggregationHandle *agg_handle_;
+ const std::vector<AggregationHandle *> handles_;
+ StorageManager *storage_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(PartitionedHashTablePool);
+};
+
+/** @} */
+
+} // namespace quickstep
+
+#endif // QUICKSTEP_STORAGE_HASH_TABLE_POOL_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/StorageBlock.cpp
----------------------------------------------------------------------
diff --git a/storage/StorageBlock.cpp b/storage/StorageBlock.cpp
index ec5990f..94c46a8 100644
--- a/storage/StorageBlock.cpp
+++ b/storage/StorageBlock.cpp
@@ -41,6 +41,7 @@
#include "storage/IndexSubBlock.hpp"
#include "storage/InsertDestinationInterface.hpp"
#include "storage/PackedRowStoreTupleStorageSubBlock.hpp"
+#include "storage/PartitionedHashTablePool.hpp"
#include "storage/SMAIndexSubBlock.hpp"
#include "storage/SplitRowStoreTupleStorageSubBlock.hpp"
#include "storage/StorageBlockBase.hpp"
@@ -1369,4 +1370,118 @@ const std::size_t StorageBlock::getNumTuples() const {
return tuple_store_->numTuples();
}
+void StorageBlock::aggregateGroupByPartitioned(
+ const std::vector<std::vector<std::unique_ptr<const Scalar>>> &arguments,
+ const std::vector<std::unique_ptr<const Scalar>> &group_by,
+ const Predicate *predicate,
+ std::unique_ptr<TupleIdSequence> *reuse_matches,
+ std::vector<std::unique_ptr<ColumnVector>> *reuse_group_by_vectors,
+ PartitionedHashTablePool *hashtable_pool) const {
+ DCHECK(!group_by.empty())
+ << "Called aggregateGroupByPartitioned() with zero GROUP BY expressions";
+
+ SubBlocksReference sub_blocks_ref(*tuple_store_,
+ indices_,
+ indices_consistent_);
+
+ // IDs of 'arguments' as attributes in the ValueAccessor we create below.
+ std::vector<attribute_id> arg_ids;
+ std::vector<attribute_id> argument_ids;
+
+ // IDs of GROUP BY key element(s) in the ValueAccessor we create below.
+ std::vector<attribute_id> key_ids;
+
+ // An intermediate ValueAccessor that stores the materialized 'arguments' for
+ // this aggregate, as well as the GROUP BY expression values.
+ ColumnVectorsValueAccessor temp_result;
+ std::unique_ptr<ValueAccessor> accessor;
+ if (predicate) {
+ if (!*reuse_matches) {
+ // If there is a filter predicate that hasn't already been evaluated,
+ // evaluate it now and save the results for other aggregates on this
+ // same block.
+ reuse_matches->reset(getMatchesForPredicate(predicate));
+ }
+
+ // Create a filtered ValueAccessor that only iterates over predicate
+ // matches.
+ accessor.reset(tuple_store_->createValueAccessor(reuse_matches->get()));
+ } else {
+ // Create a ValueAccessor that iterates over all tuples in this block
+ accessor.reset(tuple_store_->createValueAccessor());
+ }
+
+ attribute_id attr_id = 0;
+
+ // First, put GROUP BY keys into 'temp_result'.
+ if (reuse_group_by_vectors->empty()) {
+ // Compute GROUP BY values from group_by Scalars, and store them in
+ // reuse_group_by_vectors for reuse by other aggregates on this same
+ // block.
+ reuse_group_by_vectors->reserve(group_by.size());
+ for (const std::unique_ptr<const Scalar> &group_by_element : group_by) {
+ reuse_group_by_vectors->emplace_back(
+ group_by_element->getAllValues(accessor.get(), &sub_blocks_ref));
+ temp_result.addColumn(reuse_group_by_vectors->back().get(), false);
+ key_ids.push_back(attr_id++);
+ }
+ } else {
+ // Reuse precomputed GROUP BY values from reuse_group_by_vectors.
+ DCHECK_EQ(group_by.size(), reuse_group_by_vectors->size())
+ << "Wrong number of reuse_group_by_vectors";
+ for (const std::unique_ptr<ColumnVector> &reuse_cv : *reuse_group_by_vectors) {
+ temp_result.addColumn(reuse_cv.get(), false);
+ key_ids.push_back(attr_id++);
+ }
+ }
+
+ // Compute argument vectors and add them to 'temp_result'.
+ for (const std::vector<std::unique_ptr<const Scalar>> &argument : arguments) {
+ arg_ids.clear();
+ for (const std::unique_ptr<const Scalar> &args : argument) {
+ temp_result.addColumn(args->getAllValues(accessor.get(), &sub_blocks_ref));
+ argument_ids.push_back(attr_id++);
+ }
+ if (argument.empty()) {
+ argument_ids.push_back(kInvalidAttributeID);
+ }
+ }
+
+ // Compute the partitions for the tuple formed by group by values.
+ std::vector<std::unique_ptr<TupleIdSequence>> partition_membership;
+ partition_membership.resize(hashtable_pool->getNumPartitions());
+
+ // Create a tuple-id sequence for each partition.
+ for (std::size_t partition = 0;
+ partition < hashtable_pool->getNumPartitions();
+ ++partition) {
+ partition_membership[partition].reset(new TupleIdSequence(temp_result.getEndPosition()));
+ }
+
+ // Iterate over ValueAccessor for each tuple,
+ // set a bit in the appropriate TupleIdSequence.
+ temp_result.beginIteration();
+ while (temp_result.next()) {
+ const std::size_t curr_tuple_partition_id =
+ temp_result.getTupleWithAttributes(key_ids)->getTupleHash() %
+ hashtable_pool->getNumPartitions();
+ partition_membership[curr_tuple_partition_id]->set(
+ temp_result.getCurrentPosition(), true);
+ }
+ // For each partition, create an adapter around Value Accessor and
+ // TupleIdSequence.
+ std::vector<std::unique_ptr<
+ TupleIdSequenceAdapterValueAccessor<ColumnVectorsValueAccessor>>> adapter;
+ adapter.resize(hashtable_pool->getNumPartitions());
+ for (std::size_t partition = 0;
+ partition < hashtable_pool->getNumPartitions();
+ ++partition) {
+ adapter[partition].reset(temp_result.createSharedTupleIdSequenceAdapter(
+ *partition_membership[partition]));
+ hashtable_pool->getHashTable(partition)
+ ->upsertValueAccessorCompositeKeyFast(
+ argument_ids, adapter[partition].get(), key_ids, true);
+ }
+}
+
} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/storage/StorageBlock.hpp
----------------------------------------------------------------------
diff --git a/storage/StorageBlock.hpp b/storage/StorageBlock.hpp
index bab5bab..3fcaddf 100644
--- a/storage/StorageBlock.hpp
+++ b/storage/StorageBlock.hpp
@@ -44,6 +44,7 @@ class AggregationState;
class CatalogRelationSchema;
class ColumnVector;
class InsertDestinationInterface;
+class PartitionedHashTablePool;
class Predicate;
class Scalar;
class StorageBlockLayout;
@@ -466,6 +467,48 @@ class StorageBlock : public StorageBlockBase {
std::unique_ptr<TupleIdSequence> *reuse_matches,
std::vector<std::unique_ptr<ColumnVector>> *reuse_group_by_vectors) const;
+
+ /**
+ * @brief Perform the GROUP BY aggregation for the case when aggregation is
+ * partitioned.
+ *
+ * @note The difference between this method and the aggregateGroupBy method
+ * is that in this method, the tuples are routed to different HashTables
+ * based on the partition to which they belong to. The partition is
+ * determined by the GROUP BY attributes. Right now hash based
+ * partitioning is performed.
+ *
+ * @param arguments The arguments to the aggregation function as Scalars.
+ * @param group_by The list of GROUP BY attributes/expressions. The tuples in
+ * this storage block are grouped by these attributes before
+ * aggregation.
+ * @param predicate A predicate for selection. nullptr indicates that all
+ * tuples should be aggregated on.
+ * @param reuse_matches This parameter is used to store and reuse tuple-id
+ * sequence of matches pre-computed in an earlier invocations of
+ * aggregateGroupBy(). \c reuse_matches is never \c nullptr for ease of
+ * use. Current invocation of aggregateGroupBy() will reuse
+ * TupleIdSequence if passed, otherwise computes a TupleIdSequence based
+ * on \c predicate and stores in \c reuse_matches. We use
+ * std::unique_ptr for each of use, since the caller will not have to
+ * selective free.
+ * @param reuse_group_by_vectors This parameter is used to store and reuse
+ * GROUP BY attribute vectors pre-computed in an earlier invocation of
+ * aggregateGroupBy(). \c reuse_group_by_vectors is never \c nullptr
+ * for ease of use. Current invocation of aggregateGroupBy() will reuse
+ * ColumnVectors if non-empty, otherwise computes ColumnVectors based
+ * on \c group_by and stores them in \c reuse_group_by_vectors.
+ * @param hashtable_pool The pool of aggregation HashTables. Each hash table
+ * in this pool belongs to a unique partition.
+ **/
+ void aggregateGroupByPartitioned(
+ const std::vector<std::vector<std::unique_ptr<const Scalar>>> &arguments,
+ const std::vector<std::unique_ptr<const Scalar>> &group_by,
+ const Predicate *predicate,
+ std::unique_ptr<TupleIdSequence> *reuse_matches,
+ std::vector<std::unique_ptr<ColumnVector>> *reuse_group_by_vectors,
+ PartitionedHashTablePool *hashtable_pool) const;
+
/**
* @brief Inserts the GROUP BY expressions and aggregation arguments together
* as keys into the distinctify hash table.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/types/containers/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/types/containers/CMakeLists.txt b/types/containers/CMakeLists.txt
index aacb63a..c2a6623 100644
--- a/types/containers/CMakeLists.txt
+++ b/types/containers/CMakeLists.txt
@@ -49,6 +49,7 @@ target_link_libraries(quickstep_types_containers_Tuple
quickstep_catalog_CatalogTypedefs
quickstep_types_TypedValue
quickstep_types_containers_Tuple_proto
+ quickstep_utility_CompositeHash
quickstep_utility_Macros)
target_link_libraries(quickstep_types_containers_Tuple_proto
quickstep_types_TypedValue_proto
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/types/containers/Tuple.hpp
----------------------------------------------------------------------
diff --git a/types/containers/Tuple.hpp b/types/containers/Tuple.hpp
index 60f832c..6237d54 100644
--- a/types/containers/Tuple.hpp
+++ b/types/containers/Tuple.hpp
@@ -28,6 +28,7 @@
#include "catalog/CatalogTypedefs.hpp"
#include "types/TypedValue.hpp"
#include "types/containers/Tuple.pb.h"
+#include "utility/CompositeHash.hpp"
#include "utility/Macros.hpp"
#include "glog/logging.h"
@@ -218,6 +219,13 @@ class Tuple {
return attribute_values_.size();
}
+ /**
+ * @brief Get the hash value of the tuple.
+ **/
+ std::size_t getTupleHash() const {
+ return HashCompositeKey(attribute_values_);
+ }
+
private:
/**
* @brief Constructor which does not create any attributes, nor pre-reserve
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/utility/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utility/CMakeLists.txt b/utility/CMakeLists.txt
index ddaae45..4fb6e5b 100644
--- a/utility/CMakeLists.txt
+++ b/utility/CMakeLists.txt
@@ -167,6 +167,7 @@ add_library(quickstep_utility_BloomFilter_proto
add_library(quickstep_utility_CalculateInstalledMemory CalculateInstalledMemory.cpp CalculateInstalledMemory.hpp)
add_library(quickstep_utility_Cast ../empty_src.cpp Cast.hpp)
add_library(quickstep_utility_CheckSnprintf ../empty_src.cpp CheckSnprintf.hpp)
+add_library(quickstep_utility_CompositeHash ../empty_src.cpp CompositeHash.hpp)
add_library(quickstep_utility_DAG ../empty_src.cpp DAG.hpp)
add_library(quickstep_utility_EqualsAnyConstant ../empty_src.cpp EqualsAnyConstant.hpp)
add_library(quickstep_utility_ExecutionDAGVisualizer
@@ -227,6 +228,10 @@ target_link_libraries(quickstep_utility_CalculateInstalledMemory
glog)
target_link_libraries(quickstep_utility_CheckSnprintf
glog)
+target_link_libraries(quickstep_utility_CompositeHash
+ quickstep_types_TypedValue
+ quickstep_utility_HashPair
+ glog)
target_link_libraries(quickstep_utility_DAG
glog
quickstep_utility_Macros)
@@ -318,6 +323,7 @@ target_link_libraries(quickstep_utility
quickstep_utility_CalculateInstalledMemory
quickstep_utility_Cast
quickstep_utility_CheckSnprintf
+ quickstep_utility_CompositeHash
quickstep_utility_DAG
quickstep_utility_EqualsAnyConstant
quickstep_utility_ExecutionDAGVisualizer
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f6ab30f3/utility/CompositeHash.hpp
----------------------------------------------------------------------
diff --git a/utility/CompositeHash.hpp b/utility/CompositeHash.hpp
new file mode 100644
index 0000000..517bc96
--- /dev/null
+++ b/utility/CompositeHash.hpp
@@ -0,0 +1,52 @@
+/**
+ * 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_UTILITY_COMPOSITE_HASH_HPP_
+#define QUICKSTEP_UTILITY_COMPOSITE_HASH_HPP_
+
+#include <cstddef>
+#include <vector>
+
+#include "types/TypedValue.hpp"
+#include "utility/HashPair.hpp"
+
+#include "glog/logging.h"
+
+namespace quickstep {
+
+/**
+ * @brief Compute the hash value of a composite key.
+ *
+ * @param key A vector of TypedValues which together form the composite key.
+ * @return The hash value.
+ **/
+static std::size_t HashCompositeKey(const std::vector<TypedValue> &key) {
+ DCHECK(!key.empty());
+ std::size_t hash = key.front().getHash();
+ for (std::vector<TypedValue>::const_iterator key_it = key.begin() + 1;
+ key_it != key.end();
+ ++key_it) {
+ hash = CombineHashes(hash, key_it->getHash());
+ }
+ return hash;
+}
+
+} // namespace quickstep
+
+#endif // QUICKSTEP_UTILITY_COMPOSITE_HASH_HPP_
[3/7] incubator-quickstep git commit: Checking in preprocessed files
for datetime change.
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0820e3d9/parser/preprocessed/SqlParser_gen.cpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlParser_gen.cpp b/parser/preprocessed/SqlParser_gen.cpp
index 8fdf490..283bcbe 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.2. */
/* 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-2013 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 <http://www.gnu.org/licenses/>. */
@@ -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.2"
/* 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 <first_line> and <first_column>. */
@@ -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 <cstdlib>
#include <string>
@@ -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,
- 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_PRIORITY = 354,
- TOKEN_QUIT = 355,
- TOKEN_RANGE = 356,
- TOKEN_REAL = 357,
- TOKEN_REFERENCES = 358,
- TOKEN_RIGHT = 359,
- TOKEN_ROW = 360,
- TOKEN_ROW_DELIMITER = 361,
- TOKEN_ROWS = 362,
- TOKEN_SECOND = 363,
- TOKEN_SELECT = 364,
- TOKEN_SET = 365,
- TOKEN_SMA = 366,
- TOKEN_SMALLINT = 367,
- TOKEN_SUBSTRING = 368,
- TOKEN_TABLE = 369,
- TOKEN_THEN = 370,
- TOKEN_TIME = 371,
- TOKEN_TIMESTAMP = 372,
- TOKEN_TRUE = 373,
- TOKEN_TUPLESAMPLE = 374,
- TOKEN_UNBOUNDED = 375,
- TOKEN_UNIQUE = 376,
- TOKEN_UPDATE = 377,
- TOKEN_USING = 378,
- TOKEN_VALUES = 379,
- TOKEN_VARCHAR = 380,
- TOKEN_WHEN = 381,
- TOKEN_WHERE = 382,
- TOKEN_WINDOW = 383,
- TOKEN_WITH = 384,
- TOKEN_YEAR = 385,
- TOKEN_YEARMONTH = 386,
- TOKEN_EOF = 387,
- TOKEN_LEX_ERROR = 388
- };
+ 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_PRIORITY = 354,
+ TOKEN_QUIT = 355,
+ TOKEN_RANGE = 356,
+ TOKEN_REAL = 357,
+ TOKEN_REFERENCES = 358,
+ TOKEN_RIGHT = 359,
+ TOKEN_ROW = 360,
+ TOKEN_ROW_DELIMITER = 361,
+ TOKEN_ROWS = 362,
+ TOKEN_SECOND = 363,
+ TOKEN_SELECT = 364,
+ TOKEN_SET = 365,
+ TOKEN_SMA = 366,
+ TOKEN_SMALLINT = 367,
+ TOKEN_SUBSTRING = 368,
+ TOKEN_TABLE = 369,
+ TOKEN_THEN = 370,
+ TOKEN_TIME = 371,
+ TOKEN_TIMESTAMP = 372,
+ TOKEN_TRUE = 373,
+ TOKEN_TUPLESAMPLE = 374,
+ TOKEN_UNBOUNDED = 375,
+ TOKEN_UNIQUE = 376,
+ TOKEN_UPDATE = 377,
+ TOKEN_USING = 378,
+ TOKEN_VALUES = 379,
+ TOKEN_VARCHAR = 380,
+ TOKEN_WHEN = 381,
+ TOKEN_WHERE = 382,
+ TOKEN_WINDOW = 383,
+ TOKEN_WITH = 384,
+ TOKEN_YEAR = 385,
+ TOKEN_YEARMONTH = 386,
+ TOKEN_EOF = 387,
+ TOKEN_LEX_ERROR = 388
+ };
#endif
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
{
-/* Line 387 of yacc.c */
-#line 120 "../SqlParser.ypp"
+#line 120 "../SqlParser.ypp" /* yacc.c:355 */
quickstep::ParseString *string_value_;
@@ -432,55 +426,40 @@ typedef union YYSTYPE
quickstep::ParsePriority *opt_priority_clause_;
-
-/* Line 387 of yacc.c */
-#line 438 "SqlParser_gen.cpp"
-} YYSTYPE;
+#line 430 "SqlParser_gen.cpp" /* yacc.c:355 */
+};
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+/* Location type. */
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+};
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int quickstep_yyparse (void *YYPARSE_PARAM);
-#else
-int quickstep_yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
+
int quickstep_yyparse (yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement);
-#else
-int quickstep_yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
#endif /* !YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED */
/* Copy the second part of user declarations. */
-/* Line 390 of yacc.c */
-#line 220 "../SqlParser.ypp"
+#line 220 "../SqlParser.ypp" /* yacc.c:358 */
/* This header needs YYSTYPE, which is defined by the %union directive above */
#include "SqlLexer_gen.hpp"
void NotSupported(const YYLTYPE *location, yyscan_t yyscanner, const std::string &feature);
-/* Line 390 of yacc.c */
-#line 484 "SqlParser_gen.cpp"
+#line 463 "SqlParser_gen.cpp" /* yacc.c:358 */
#ifdef short
# undef short
@@ -494,11 +473,8 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -518,8 +494,7 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -541,6 +516,33 @@ typedef short int yytype_int16;
# endif
#endif
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
@@ -548,24 +550,26 @@ typedef short int yytype_int16;
# define YYUSE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -583,8 +587,7 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
@@ -596,8 +599,8 @@ YYID (yyi)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -613,7 +616,7 @@ YYID (yyi)
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -621,15 +624,13 @@ YYID (yyi)
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -639,8 +640,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -666,16 +667,16 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
@@ -694,7 +695,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (YYID (0))
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -710,17 +711,19 @@ union yyalloc
#define YYNNTS 107
/* YYNRULES -- Number of rules. */
#define YYNRULES 289
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 536
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 388
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -765,139 +768,7 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 6, 9, 12, 15, 17, 19, 21,
- 23, 25, 27, 29, 31, 33, 35, 37, 39, 41,
- 48, 55, 62, 69, 79, 89, 93, 97, 99, 103,
- 105, 107, 109, 111, 113, 115, 117, 119, 121, 123,
- 125, 127, 129, 131, 134, 137, 142, 147, 149, 152,
- 154, 157, 160, 165, 171, 174, 176, 177, 179, 184,
- 190, 201, 206, 210, 212, 213, 215, 216, 220, 221,
- 227, 228, 237, 239, 241, 243, 247, 249, 251, 253,
- 256, 259, 264, 267, 269, 271, 273, 275, 276, 280,
- 291, 299, 304, 310, 316, 317, 322, 325, 328, 333,
- 338, 344, 349, 353, 355, 359, 362, 366, 367, 371,
- 374, 376, 380, 384, 395, 396, 398, 400, 402, 404,
- 406, 410, 414, 417, 419, 422, 426, 427, 431, 435,
- 436, 438, 440, 443, 445, 448, 450, 453, 460, 462,
- 465, 469, 472, 475, 477, 481, 483, 486, 488, 493,
- 495, 499, 500, 504, 505, 508, 509, 513, 514, 517,
- 518, 520, 522, 525, 532, 536, 537, 541, 542, 546,
- 547, 553, 555, 557, 560, 563, 566, 569, 572, 575,
- 577, 581, 585, 586, 588, 590, 591, 594, 597, 598,
- 600, 603, 607, 609, 613, 615, 618, 620, 626, 633,
- 638, 642, 646, 650, 653, 657, 663, 668, 675, 679,
- 681, 685, 687, 690, 692, 694, 696, 698, 702, 708,
- 710, 712, 714, 718, 720, 724, 729, 734, 740, 747,
- 754, 763, 769, 774, 776, 779, 784, 786, 789, 794,
- 795, 798, 800, 804, 806, 808, 811, 814, 816, 819,
- 823, 826, 828, 830, 832, 834, 836, 838, 840, 844,
- 846, 850, 852, 856, 858, 860, 862, 864, 866, 868,
- 870, 873, 875, 878, 880, 882, 884, 886, 888, 890,
- 892, 896, 898, 900, 902, 904, 906, 908, 911, 914
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int16 yyrhs[] =
-{
- 146, 0, -1, 147, 139, -1, 147, 137, -1, 250,
- 140, -1, 250, 137, -1, 1, -1, 137, -1, 149,
- -1, 174, -1, 150, -1, 151, -1, 178, -1, 152,
- -1, 173, -1, 148, -1, 181, -1, 177, -1, 105,
- -1, 30, 119, 248, 28, 44, 153, -1, 30, 119,
- 248, 28, 45, 159, -1, 30, 119, 248, 59, 44,
- 248, -1, 30, 119, 248, 59, 45, 248, -1, 47,
- 119, 248, 141, 154, 142, 161, 163, 164, -1, 47,
- 78, 248, 95, 248, 162, 128, 171, 172, -1, 59,
- 119, 248, -1, 248, 155, 158, -1, 153, -1, 154,
- 143, 153, -1, 34, -1, 49, -1, 50, -1, 121,
- -1, 122, -1, 52, -1, 107, -1, 58, -1, 67,
- -1, 117, -1, 81, -1, 33, -1, 89, -1, 82,
- -1, 50, 82, -1, 136, 82, -1, 42, 141, 7,
- 142, -1, 130, 141, 7, 142, -1, 92, -1, 10,
- 92, -1, 126, -1, 103, 85, -1, 53, 238, -1,
- 43, 141, 220, 142, -1, 108, 248, 141, 248, 142,
- -1, 157, 156, -1, 156, -1, -1, 157, -1, 126,
- 141, 247, 142, -1, 103, 85, 141, 247, 142, -1,
- 70, 85, 141, 247, 142, 108, 248, 141, 247, 142,
- -1, 43, 141, 220, 142, -1, 160, 143, 159, -1,
- 159, -1, -1, 160, -1, -1, 141, 242, 142, -1,
- -1, 134, 36, 141, 166, 142, -1, -1, 99, 40,
- 165, 141, 247, 142, 100, 7, -1, 74, -1, 106,
- -1, 167, -1, 166, 143, 167, -1, 168, -1, 169,
- -1, 170, -1, 248, 248, -1, 248, 29, -1, 248,
- 141, 247, 142, -1, 248, 7, -1, 35, -1, 38,
- -1, 39, -1, 116, -1, -1, 141, 166, 142, -1,
- 80, 83, 248, 141, 247, 142, 129, 141, 240, 142,
- -1, 80, 83, 248, 129, 141, 240, 142, -1, 80,
- 83, 248, 186, -1, 183, 80, 83, 248, 186, -1,
- 46, 248, 71, 5, 175, -1, -1, 134, 141, 176,
- 142, -1, 55, 5, -1, 62, 249, -1, 176, 143,
- 55, 5, -1, 176, 143, 62, 249, -1, 127, 248,
- 115, 179, 218, -1, 54, 71, 248, 218, -1, 179,
- 143, 180, -1, 180, -1, 248, 11, 224, -1, 186,
- 182, -1, 183, 186, 182, -1, -1, 134, 104, 7,
- -1, 134, 184, -1, 185, -1, 184, 143, 185, -1,
- 198, 31, 192, -1, 114, 187, 188, 191, 218, 200,
- 201, 202, 203, 204, -1, -1, 29, -1, 57, -1,
- 23, -1, 189, -1, 190, -1, 189, 143, 190, -1,
- 224, 31, 248, -1, 224, 248, -1, 224, -1, 71,
- 199, -1, 141, 186, 142, -1, -1, 37, 7, 101,
- -1, 124, 7, 101, -1, -1, 79, -1, 87, -1,
- 87, 97, -1, 109, -1, 109, 97, -1, 72, -1,
- 72, 97, -1, 195, 194, 84, 196, 95, 220, -1,
- 196, -1, 192, 197, -1, 248, 193, 197, -1, 248,
- 193, -1, 228, 197, -1, 228, -1, 141, 195, 142,
- -1, 198, -1, 31, 198, -1, 248, -1, 248, 141,
- 247, 142, -1, 195, -1, 199, 143, 195, -1, -1,
- 73, 40, 237, -1, -1, 75, 220, -1, -1, 96,
- 40, 214, -1, -1, 88, 7, -1, -1, 205, -1,
- 206, -1, 205, 206, -1, 133, 248, 31, 141, 207,
- 142, -1, 208, 209, 210, -1, -1, 99, 40, 237,
- -1, -1, 96, 40, 214, -1, -1, 211, 19, 212,
- 9, 213, -1, 112, -1, 106, -1, 7, 102, -1,
- 125, 102, -1, 48, 110, -1, 7, 68, -1, 125,
- 68, -1, 48, 110, -1, 215, -1, 214, 143, 215,
- -1, 224, 216, 217, -1, -1, 32, -1, 56, -1,
- -1, 93, 66, -1, 93, 86, -1, -1, 219, -1,
- 132, 220, -1, 220, 8, 221, -1, 221, -1, 221,
- 9, 222, -1, 222, -1, 10, 223, -1, 223, -1,
- 224, 19, 224, 9, 224, -1, 224, 10, 19, 224,
- 9, 224, -1, 241, 20, 10, 92, -1, 241, 20,
- 92, -1, 224, 243, 224, -1, 141, 220, 142, -1,
- 63, 192, -1, 224, 77, 192, -1, 224, 77, 141,
- 237, 142, -1, 224, 10, 77, 192, -1, 224, 10,
- 77, 141, 237, 142, -1, 224, 245, 225, -1, 225,
- -1, 225, 246, 226, -1, 226, -1, 244, 227, -1,
- 227, -1, 241, -1, 238, -1, 228, -1, 228, 98,
- 248, -1, 228, 98, 141, 207, 142, -1, 229, -1,
- 230, -1, 231, -1, 141, 224, 142, -1, 192, -1,
- 248, 141, 142, -1, 248, 141, 23, 142, -1, 248,
- 141, 237, 142, -1, 248, 141, 57, 237, 142, -1,
- 64, 141, 239, 71, 224, 142, -1, 118, 141, 224,
- 71, 7, 142, -1, 118, 141, 224, 71, 7, 69,
- 7, 142, -1, 41, 224, 232, 236, 61, -1, 41,
- 234, 236, 61, -1, 233, -1, 232, 233, -1, 131,
- 224, 120, 224, -1, 235, -1, 234, 235, -1, 131,
- 220, 120, 224, -1, -1, 60, 224, -1, 224, -1,
- 237, 143, 224, -1, 92, -1, 7, -1, 21, 7,
- -1, 22, 7, -1, 5, -1, 82, 5, -1, 82,
- 5, 239, -1, 155, 5, -1, 135, -1, 91, -1,
- 51, -1, 76, -1, 90, -1, 113, -1, 238, -1,
- 240, 143, 238, -1, 248, -1, 248, 27, 248, -1,
- 241, -1, 242, 143, 241, -1, 11, -1, 12, -1,
- 16, -1, 15, -1, 14, -1, 13, -1, 18, -1,
- 10, 18, -1, 17, -1, 10, 17, -1, 22, -1,
- 21, -1, 22, -1, 144, -1, 23, -1, 24, -1,
- 248, -1, 247, 143, 248, -1, 4, -1, 6, -1,
- 123, -1, 95, -1, 65, -1, 94, -1, 3, 251,
- -1, 251, 3, -1, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 629, 629, 633, 637, 641, 645, 648, 655, 658,
@@ -940,9 +811,9 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "TOKEN_COMMAND", "TOKEN_NAME",
"TOKEN_STRING_SINGLE_QUOTED", "TOKEN_STRING_DOUBLE_QUOTED",
"TOKEN_UNSIGNED_NUMVAL", "TOKEN_OR", "TOKEN_AND", "TOKEN_NOT",
- "TOKEN_EQ", "TOKEN_NEQ", "TOKEN_GEQ", "TOKEN_GT", "TOKEN_LEQ",
- "TOKEN_LT", "TOKEN_REGEXP", "TOKEN_LIKE", "TOKEN_BETWEEN", "TOKEN_IS",
- "'+'", "'-'", "'*'", "'/'", "UNARY_MINUS", "UNARY_PLUS", "'.'",
+ "TOKEN_EQ", "TOKEN_LT", "TOKEN_LEQ", "TOKEN_GT", "TOKEN_GEQ",
+ "TOKEN_NEQ", "TOKEN_LIKE", "TOKEN_REGEXP", "TOKEN_BETWEEN", "TOKEN_IS",
+ "'+'", "'-'", "'*'", "'/'", "UNARY_PLUS", "UNARY_MINUS", "'.'",
"TOKEN_ADD", "TOKEN_ALL", "TOKEN_ALTER", "TOKEN_AS", "TOKEN_ASC",
"TOKEN_BIGINT", "TOKEN_BIT", "TOKEN_BITWEAVING", "TOKEN_BLOCKPROPERTIES",
"TOKEN_BLOCKSAMPLE", "TOKEN_BLOOM_FILTER", "TOKEN_CSB_TREE", "TOKEN_BY",
@@ -1004,13 +875,13 @@ static const char *const yytname[] =
"literal_value_commalist", "attribute_ref", "attribute_ref_list",
"comparison_operation", "unary_operation", "add_operation",
"multiply_operation", "name_commalist", "any_name", "boolean_value",
- "command", "command_argument_list", YY_NULL
+ "command", "command_argument_list", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -1031,154 +902,18 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 145, 146, 146, 146, 146, 146, 146, 147, 147,
- 147, 147, 147, 147, 147, 147, 147, 147, 148, 149,
- 149, 149, 149, 150, 151, 152, 153, 154, 154, 155,
- 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
- 155, 155, 155, 155, 155, 155, 155, 156, 156, 156,
- 156, 156, 156, 156, 157, 157, 158, 158, 159, 159,
- 159, 159, 160, 160, 161, 161, 162, 162, 163, 163,
- 164, 164, 165, 165, 166, 166, 167, 167, 167, 168,
- 168, 169, 170, 171, 171, 171, 171, 172, 172, 173,
- 173, 173, 173, 174, 175, 175, 176, 176, 176, 176,
- 177, 178, 179, 179, 180, 181, 181, 182, 182, 183,
- 184, 184, 185, 186, 187, 187, 187, 188, 188, 189,
- 189, 190, 190, 190, 191, 192, 193, 193, 193, 194,
- 194, 194, 194, 194, 194, 194, 194, 195, 195, 196,
- 196, 196, 196, 196, 196, 197, 197, 198, 198, 199,
- 199, 200, 200, 201, 201, 202, 202, 203, 203, 204,
- 204, 205, 205, 206, 207, 208, 208, 209, 209, 210,
- 210, 211, 211, 212, 212, 212, 213, 213, 213, 214,
- 214, 215, 216, 216, 216, 217, 217, 217, 218, 218,
- 219, 220, 220, 221, 221, 222, 222, 223, 223, 223,
- 223, 223, 223, 223, 223, 223, 223, 223, 224, 224,
- 225, 225, 226, 226, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 228, 228, 228, 228, 229, 230,
- 230, 231, 231, 232, 232, 233, 234, 234, 235, 236,
- 236, 237, 237, 238, 238, 238, 238, 238, 238, 238,
- 238, 239, 239, 239, 239, 239, 239, 240, 240, 241,
- 241, 242, 242, 243, 243, 243, 243, 243, 243, 243,
- 243, 243, 243, 244, 245, 245, 246, 246, 246, 247,
- 247, 248, 248, 249, 249, 249, 249, 250, 251, 251
-};
+#define YYPACT_NINF -234
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 2, 2, 2, 2, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 6,
- 6, 6, 6, 9, 9, 3, 3, 1, 3, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 2, 4, 4, 1, 2, 1,
- 2, 2, 4, 5, 2, 1, 0, 1, 4, 5,
- 10, 4, 3, 1, 0, 1, 0, 3, 0, 5,
- 0, 8, 1, 1, 1, 3, 1, 1, 1, 2,
- 2, 4, 2, 1, 1, 1, 1, 0, 3, 10,
- 7, 4, 5, 5, 0, 4, 2, 2, 4, 4,
- 5, 4, 3, 1, 3, 2, 3, 0, 3, 2,
- 1, 3, 3, 10, 0, 1, 1, 1, 1, 1,
- 3, 3, 2, 1, 2, 3, 0, 3, 3, 0,
- 1, 1, 2, 1, 2, 1, 2, 6, 1, 2,
- 3, 2, 2, 1, 3, 1, 2, 1, 4, 1,
- 3, 0, 3, 0, 2, 0, 3, 0, 2, 0,
- 1, 1, 2, 6, 3, 0, 3, 0, 3, 0,
- 5, 1, 1, 2, 2, 2, 2, 2, 2, 1,
- 3, 3, 0, 1, 1, 0, 2, 2, 0, 1,
- 2, 3, 1, 3, 1, 2, 1, 5, 6, 4,
- 3, 3, 3, 2, 3, 5, 4, 6, 3, 1,
- 3, 1, 2, 1, 1, 1, 1, 3, 5, 1,
- 1, 1, 3, 1, 3, 4, 4, 5, 6, 6,
- 8, 5, 4, 1, 2, 4, 1, 2, 4, 0,
- 2, 1, 3, 1, 1, 2, 2, 1, 2, 3,
- 2, 1, 1, 1, 1, 1, 1, 1, 3, 1,
- 3, 1, 3, 1, 1, 1, 1, 1, 1, 1,
- 2, 1, 2, 1, 1, 1, 1, 1, 1, 1,
- 3, 1, 1, 1, 1, 1, 1, 2, 2, 0
-};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-234)))
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint16 yydefact[] =
-{
- 0, 6, 289, 0, 0, 0, 0, 0, 0, 18,
- 114, 0, 0, 7, 0, 0, 15, 8, 10, 11,
- 13, 14, 9, 17, 12, 16, 0, 107, 0, 287,
- 0, 281, 282, 0, 0, 0, 0, 0, 0, 115,
- 116, 0, 0, 109, 110, 0, 147, 1, 3, 2,
- 0, 107, 0, 105, 5, 4, 288, 0, 0, 0,
- 0, 188, 25, 0, 247, 244, 0, 273, 117, 40,
- 29, 0, 0, 30, 31, 34, 36, 0, 37, 39,
- 0, 41, 243, 35, 38, 0, 32, 33, 0, 0,
- 0, 0, 0, 118, 119, 223, 123, 209, 211, 213,
- 216, 219, 220, 221, 215, 214, 0, 259, 0, 0,
- 0, 0, 0, 106, 0, 0, 0, 94, 0, 0,
- 0, 101, 189, 0, 0, 91, 245, 246, 0, 0,
- 239, 236, 0, 43, 0, 248, 0, 0, 44, 0,
- 0, 250, 0, 188, 0, 274, 275, 0, 0, 122,
- 277, 278, 276, 0, 0, 0, 212, 0, 0, 188,
- 103, 0, 111, 0, 112, 0, 279, 0, 108, 0,
- 0, 0, 0, 0, 93, 66, 27, 0, 0, 0,
- 0, 0, 190, 192, 194, 196, 0, 214, 0, 0,
- 0, 0, 239, 233, 0, 237, 0, 0, 253, 254,
- 255, 252, 256, 251, 0, 249, 0, 0, 125, 222,
- 0, 0, 149, 138, 124, 143, 126, 151, 120, 121,
- 208, 210, 165, 217, 260, 0, 0, 224, 241, 0,
- 0, 100, 0, 148, 0, 92, 19, 0, 0, 0,
- 0, 20, 21, 22, 0, 0, 0, 64, 0, 42,
- 56, 195, 203, 0, 0, 0, 0, 0, 263, 264,
- 268, 267, 266, 265, 271, 269, 0, 0, 0, 0,
- 257, 0, 0, 0, 0, 234, 0, 240, 232, 45,
- 0, 0, 46, 129, 0, 139, 145, 135, 130, 131,
- 133, 0, 0, 142, 0, 0, 141, 0, 153, 0,
- 0, 167, 225, 0, 226, 0, 102, 104, 280, 0,
- 0, 0, 0, 0, 0, 0, 261, 0, 259, 0,
- 63, 65, 68, 28, 0, 0, 0, 47, 0, 0,
- 49, 55, 57, 26, 202, 191, 193, 272, 270, 0,
- 0, 0, 0, 204, 201, 0, 200, 90, 0, 0,
- 238, 0, 231, 0, 0, 144, 146, 136, 132, 134,
- 0, 150, 0, 0, 140, 0, 0, 155, 0, 218,
- 0, 169, 227, 242, 0, 0, 0, 0, 96, 285,
- 286, 284, 283, 97, 95, 0, 67, 0, 83, 84,
- 85, 86, 87, 0, 0, 70, 48, 0, 51, 50,
- 0, 54, 0, 0, 206, 0, 0, 199, 258, 0,
- 235, 228, 0, 229, 0, 127, 128, 152, 154, 0,
- 157, 166, 0, 172, 171, 164, 0, 61, 0, 0,
- 58, 0, 0, 262, 0, 24, 62, 0, 0, 23,
- 0, 0, 0, 0, 197, 205, 0, 0, 0, 0,
- 0, 159, 168, 179, 182, 0, 0, 59, 98, 99,
- 0, 74, 76, 77, 78, 0, 0, 0, 52, 0,
- 198, 207, 89, 230, 137, 156, 158, 0, 113, 160,
- 161, 0, 183, 184, 185, 0, 0, 0, 0, 0,
- 88, 0, 82, 80, 0, 79, 0, 72, 73, 0,
- 53, 0, 162, 180, 0, 181, 173, 175, 174, 0,
- 0, 75, 0, 69, 0, 0, 186, 187, 0, 0,
- 0, 170, 0, 81, 0, 165, 176, 178, 177, 0,
- 0, 0, 60, 0, 163, 71
-};
+#define YYTABLE_NINF -130
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 14, 15, 16, 17, 18, 19, 20, 176, 177,
- 91, 331, 332, 333, 241, 321, 322, 246, 395, 439,
- 499, 460, 461, 462, 463, 464, 392, 435, 21, 22,
- 174, 315, 23, 24, 159, 160, 25, 53, 26, 43,
- 44, 139, 41, 92, 93, 94, 143, 95, 296, 291,
- 212, 213, 285, 286, 214, 298, 367, 420, 451, 478,
- 479, 480, 300, 301, 371, 425, 426, 488, 521, 452,
- 453, 484, 505, 121, 122, 182, 183, 184, 185, 186,
- 97, 98, 99, 100, 101, 102, 103, 192, 193, 130,
- 131, 196, 229, 104, 204, 271, 105, 317, 268, 106,
- 148, 153, 165, 107, 383, 28, 29
-};
+#define yytable_value_is_error(Yytable_value) \
+ 0
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -234
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int16 yypact[] =
{
168, -234, -234, -58, 181, -19, 40, -37, 59, -234,
@@ -1237,7 +972,68 @@ static const yytype_int16 yypact[] =
411, 377, -234, 505, -234, -234
};
-/* YYPGOTO[NTERM-NUM]. */
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint16 yydefact[] =
+{
+ 0, 6, 289, 0, 0, 0, 0, 0, 0, 18,
+ 114, 0, 0, 7, 0, 0, 15, 8, 10, 11,
+ 13, 14, 9, 17, 12, 16, 0, 107, 0, 287,
+ 0, 281, 282, 0, 0, 0, 0, 0, 0, 115,
+ 116, 0, 0, 109, 110, 0, 147, 1, 3, 2,
+ 0, 107, 0, 105, 5, 4, 288, 0, 0, 0,
+ 0, 188, 25, 0, 247, 244, 0, 273, 117, 40,
+ 29, 0, 0, 30, 31, 34, 36, 0, 37, 39,
+ 0, 41, 243, 35, 38, 0, 32, 33, 0, 0,
+ 0, 0, 0, 118, 119, 223, 123, 209, 211, 213,
+ 216, 219, 220, 221, 215, 214, 0, 259, 0, 0,
+ 0, 0, 0, 106, 0, 0, 0, 94, 0, 0,
+ 0, 101, 189, 0, 0, 91, 245, 246, 0, 0,
+ 239, 236, 0, 43, 0, 248, 0, 0, 44, 0,
+ 0, 250, 0, 188, 0, 274, 275, 0, 0, 122,
+ 277, 278, 276, 0, 0, 0, 212, 0, 0, 188,
+ 103, 0, 111, 0, 112, 0, 279, 0, 108, 0,
+ 0, 0, 0, 0, 93, 66, 27, 0, 0, 0,
+ 0, 0, 190, 192, 194, 196, 0, 214, 0, 0,
+ 0, 0, 239, 233, 0, 237, 0, 0, 253, 254,
+ 255, 252, 256, 251, 0, 249, 0, 0, 125, 222,
+ 0, 0, 149, 138, 124, 143, 126, 151, 120, 121,
+ 208, 210, 165, 217, 260, 0, 0, 224, 241, 0,
+ 0, 100, 0, 148, 0, 92, 19, 0, 0, 0,
+ 0, 20, 21, 22, 0, 0, 0, 64, 0, 42,
+ 56, 195, 203, 0, 0, 0, 0, 0, 263, 265,
+ 266, 267, 268, 264, 269, 271, 0, 0, 0, 0,
+ 257, 0, 0, 0, 0, 234, 0, 240, 232, 45,
+ 0, 0, 46, 129, 0, 139, 145, 135, 130, 131,
+ 133, 0, 0, 142, 0, 0, 141, 0, 153, 0,
+ 0, 167, 225, 0, 226, 0, 102, 104, 280, 0,
+ 0, 0, 0, 0, 0, 0, 261, 0, 259, 0,
+ 63, 65, 68, 28, 0, 0, 0, 47, 0, 0,
+ 49, 55, 57, 26, 202, 191, 193, 270, 272, 0,
+ 0, 0, 0, 204, 201, 0, 200, 90, 0, 0,
+ 238, 0, 231, 0, 0, 144, 146, 136, 132, 134,
+ 0, 150, 0, 0, 140, 0, 0, 155, 0, 218,
+ 0, 169, 227, 242, 0, 0, 0, 0, 96, 285,
+ 286, 284, 283, 97, 95, 0, 67, 0, 83, 84,
+ 85, 86, 87, 0, 0, 70, 48, 0, 51, 50,
+ 0, 54, 0, 0, 206, 0, 0, 199, 258, 0,
+ 235, 228, 0, 229, 0, 127, 128, 152, 154, 0,
+ 157, 166, 0, 172, 171, 164, 0, 61, 0, 0,
+ 58, 0, 0, 262, 0, 24, 62, 0, 0, 23,
+ 0, 0, 0, 0, 197, 205, 0, 0, 0, 0,
+ 0, 159, 168, 179, 182, 0, 0, 59, 98, 99,
+ 0, 74, 76, 77, 78, 0, 0, 0, 52, 0,
+ 198, 207, 89, 230, 137, 156, 158, 0, 113, 160,
+ 161, 0, 183, 184, 185, 0, 0, 0, 0, 0,
+ 88, 0, 82, 80, 0, 79, 0, 72, 73, 0,
+ 53, 0, 162, 180, 0, 181, 173, 175, 174, 0,
+ 0, 75, 0, 69, 0, 0, 186, 187, 0, 0,
+ 0, 170, 0, 81, 0, 165, 176, 178, 177, 0,
+ 0, 0, 60, 0, 163, 71
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-234, -234, -234, -234, -234, -234, -234, -234, -94, -234,
@@ -1253,14 +1049,29 @@ static const yytype_int16 yypgoto[] =
-234, -234, -120, -4, 120, -234, -234
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -130
-static const yytype_int16 yytable[] =
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
{
- 33, 187, 45, 270, 189, 215, 96, 42, 46, 187,
- 255, 27, 190, 164, 320, 255, 255, 255, 157, 303,
+ -1, 14, 15, 16, 17, 18, 19, 20, 176, 177,
+ 91, 331, 332, 333, 241, 321, 322, 246, 395, 439,
+ 499, 460, 461, 462, 463, 464, 392, 435, 21, 22,
+ 174, 315, 23, 24, 159, 160, 25, 53, 26, 43,
+ 44, 139, 41, 92, 93, 94, 143, 95, 296, 291,
+ 212, 213, 285, 286, 214, 298, 367, 420, 451, 478,
+ 479, 480, 300, 301, 371, 425, 426, 488, 521, 452,
+ 453, 484, 505, 121, 122, 182, 183, 184, 185, 186,
+ 97, 98, 99, 100, 101, 102, 103, 192, 193, 130,
+ 131, 196, 229, 104, 204, 271, 105, 317, 268, 106,
+ 148, 153, 165, 107, 383, 28, 29
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_int16 yytable[] =
+{
+ 33, 187, 45, 270, 189, 215, 96, 42, 46, 187,
+ 255, 27, 190, 164, 320, 255, 255, 255, 157, 303,
31, 283, 32, 294, 324, 31, 57, 32, 492, 485,
59, 60, 61, 62, 63, 293, 129, 51, 31, 31,
32, 32, 237, 150, 151, 211, 145, 146, 518, 345,
@@ -1396,12 +1207,6 @@ static const yytype_int16 yytable[] =
88, 0, 0, 0, 0, 0, 89
};
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-234)))
-
-#define yytable_value_is_error(Yytable_value) \
- YYID (0)
-
static const yytype_int16 yycheck[] =
{
4, 120, 12, 188, 124, 142, 41, 11, 12, 128,
@@ -1541,8 +1346,8 @@ static const yytype_int16 yycheck[] =
130, -1, -1, -1, -1, -1, 136
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 1, 3, 30, 46, 47, 54, 59, 80, 105,
@@ -1601,30 +1406,84 @@ static const yytype_uint8 yystos[] =
142, 207, 142, 100, 142, 7
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 145, 146, 146, 146, 146, 146, 146, 147, 147,
+ 147, 147, 147, 147, 147, 147, 147, 147, 148, 149,
+ 149, 149, 149, 150, 151, 152, 153, 154, 154, 155,
+ 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
+ 155, 155, 155, 155, 155, 155, 155, 156, 156, 156,
+ 156, 156, 156, 156, 157, 157, 158, 158, 159, 159,
+ 159, 159, 160, 160, 161, 161, 162, 162, 163, 163,
+ 164, 164, 165, 165, 166, 166, 167, 167, 167, 168,
+ 168, 169, 170, 171, 171, 171, 171, 172, 172, 173,
+ 173, 173, 173, 174, 175, 175, 176, 176, 176, 176,
+ 177, 178, 179, 179, 180, 181, 181, 182, 182, 183,
+ 184, 184, 185, 186, 187, 187, 187, 188, 188, 189,
+ 189, 190, 190, 190, 191, 192, 193, 193, 193, 194,
+ 194, 194, 194, 194, 194, 194, 194, 195, 195, 196,
+ 196, 196, 196, 196, 196, 197, 197, 198, 198, 199,
+ 199, 200, 200, 201, 201, 202, 202, 203, 203, 204,
+ 204, 205, 205, 206, 207, 208, 208, 209, 209, 210,
+ 210, 211, 211, 212, 212, 212, 213, 213, 213, 214,
+ 214, 215, 216, 216, 216, 217, 217, 217, 218, 218,
+ 219, 220, 220, 221, 221, 222, 222, 223, 223, 223,
+ 223, 223, 223, 223, 223, 223, 223, 223, 224, 224,
+ 225, 225, 226, 226, 227, 227, 227, 227, 227, 227,
+ 227, 227, 227, 227, 228, 228, 228, 228, 229, 230,
+ 230, 231, 231, 232, 232, 233, 234, 234, 235, 236,
+ 236, 237, 237, 238, 238, 238, 238, 238, 238, 238,
+ 238, 239, 239, 239, 239, 239, 239, 240, 240, 241,
+ 241, 242, 242, 243, 243, 243, 243, 243, 243, 243,
+ 243, 243, 243, 244, 245, 245, 246, 246, 246, 247,
+ 247, 248, 248, 249, 249, 249, 249, 250, 251, 251
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 2, 2, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 6,
+ 6, 6, 6, 9, 9, 3, 3, 1, 3, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 2, 4, 4, 1, 2, 1,
+ 2, 2, 4, 5, 2, 1, 0, 1, 4, 5,
+ 10, 4, 3, 1, 0, 1, 0, 3, 0, 5,
+ 0, 8, 1, 1, 1, 3, 1, 1, 1, 2,
+ 2, 4, 2, 1, 1, 1, 1, 0, 3, 10,
+ 7, 4, 5, 5, 0, 4, 2, 2, 4, 4,
+ 5, 4, 3, 1, 3, 2, 3, 0, 3, 2,
+ 1, 3, 3, 10, 0, 1, 1, 1, 1, 1,
+ 3, 3, 2, 1, 2, 3, 0, 3, 3, 0,
+ 1, 1, 2, 1, 2, 1, 2, 6, 1, 2,
+ 3, 2, 2, 1, 3, 1, 2, 1, 4, 1,
+ 3, 0, 3, 0, 2, 0, 3, 0, 2, 0,
+ 1, 1, 2, 6, 3, 0, 3, 0, 3, 0,
+ 5, 1, 1, 2, 2, 2, 2, 2, 2, 1,
+ 3, 3, 0, 1, 1, 0, 2, 2, 0, 1,
+ 2, 3, 1, 3, 1, 2, 1, 5, 6, 4,
+ 3, 3, 3, 2, 3, 5, 4, 6, 3, 1,
+ 3, 1, 2, 1, 1, 1, 1, 3, 5, 1,
+ 1, 1, 3, 1, 3, 4, 4, 5, 6, 6,
+ 8, 5, 4, 1, 2, 4, 1, 2, 4, 0,
+ 2, 1, 3, 1, 1, 2, 2, 1, 2, 3,
+ 2, 1, 1, 1, 1, 1, 1, 1, 3, 1,
+ 3, 1, 3, 1, 1, 1, 1, 1, 1, 1,
+ 2, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 3, 1, 1, 1, 1, 1, 1, 2, 2, 0
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
#define YYRECOVERING() (!!yyerrstatus)
@@ -1641,13 +1500,13 @@ do \
else \
{ \
yyerror (&yylloc, yyscanner, parsedStatement, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
+ YYERROR; \
+ } \
+while (0)
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
@@ -1657,7 +1516,7 @@ while (YYID (0))
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
- if (YYID (N)) \
+ if (N) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
@@ -1671,12 +1530,27 @@ while (YYID (0))
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
- while (YYID (0))
+ while (0)
#endif
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */
@@ -1686,36 +1560,28 @@ while (YYID (0))
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
-__attribute__((__unused__))
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+YY_ATTRIBUTE_UNUSED
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
-#else
-static unsigned
-yy_location_print_ (yyo, yylocp)
- FILE *yyo;
- YYLTYPE const * const yylocp;
-#endif
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
- res += fprintf (yyo, "%d", yylocp->first_line);
+ res += YYFPRINTF (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
- res += fprintf (yyo, ".%d", yylocp->first_column);
+ res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
- res += fprintf (yyo, "-%d", yylocp->last_line);
+ res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
- res += fprintf (yyo, ".%d", end_col);
+ res += YYFPRINTF (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
- res += fprintf (yyo, "-%d", end_col);
+ res += YYFPRINTF (yyo, "-%d", end_col);
}
return res;
}
@@ -1729,77 +1595,37 @@ yy_location_print_ (yyo, yylocp)
#endif
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, &yylloc, yyscanner)
-#endif
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, Location, yyscanner, parsedStatement); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
-/* Enable debugging if requested. */
-#if YYDEBUG
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, Location, yyscanner, parsedStatement); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, yyscanner, parsedStatement)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- YYLTYPE const * const yylocationp;
- yyscan_t yyscanner;
- quickstep::ParseStatement **parsedStatement;
-#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
- if (!yyvaluep)
- return;
YYUSE (yylocationp);
YYUSE (yyscanner);
YYUSE (parsedStatement);
+ if (!yyvaluep)
+ return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -1807,25 +1633,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, yyscanner, parse
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, yyscanner, parsedStatement)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- YYLTYPE const * const yylocationp;
- yyscan_t yyscanner;
- quickstep::ParseStatement **parsedStatement;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
@@ -1838,16 +1650,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, yyscanner, parsedState
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -1858,52 +1662,42 @@ yy_stack_print (yybottom, yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-#else
-static void
-yy_reduce_print (yyvsp, yylsp, yyrule, yyscanner, parsedStatement)
- YYSTYPE *yyvsp;
- YYLTYPE *yylsp;
- int yyrule;
- yyscan_t yyscanner;
- quickstep::ParseStatement **parsedStatement;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , &(yylsp[(yyi + 1) - (yynrhs)]) , yyscanner, parsedStatement);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , &(yylsp[(yyi + 1) - (yynrhs)]) , yyscanner, parsedStatement);
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, yylsp, Rule, yyscanner, parsedStatement); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, yylsp, Rule, yyscanner, parsedStatement); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1917,7 +1711,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1940,15 +1734,8 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1964,16 +1751,8 @@ yystrlen (yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -2003,27 +1782,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -2046,11 +1825,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULL;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -2058,10 +1837,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -2111,7 +1886,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
@@ -2178,1175 +1953,1057 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, yylocationp, yyscanner, parsedStatement)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- YYLTYPE *yylocationp;
- yyscan_t yyscanner;
- quickstep::ParseStatement **parsedStatement;
-#endif
{
YYUSE (yyvaluep);
YYUSE (yylocationp);
YYUSE (yyscanner);
YYUSE (parsedStatement);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
switch (yytype)
{
- case 3: /* TOKEN_COMMAND */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+ case 3: /* TOKEN_COMMAND */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).string_value_) != nullptr) {
delete ((*yyvaluep).string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2218 "SqlParser_gen.cpp"
+}
+#line 1978 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 4: /* TOKEN_NAME */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 4: /* TOKEN_NAME */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).string_value_) != nullptr) {
delete ((*yyvaluep).string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2229 "SqlParser_gen.cpp"
+}
+#line 1988 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 5: /* TOKEN_STRING_SINGLE_QUOTED */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 5: /* TOKEN_STRING_SINGLE_QUOTED */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).string_value_) != nullptr) {
delete ((*yyvaluep).string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2240 "SqlParser_gen.cpp"
+}
+#line 1998 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 6: /* TOKEN_STRING_DOUBLE_QUOTED */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 6: /* TOKEN_STRING_DOUBLE_QUOTED */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).string_value_) != nullptr) {
delete ((*yyvaluep).string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2251 "SqlParser_gen.cpp"
+}
+#line 2008 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 7: /* TOKEN_UNSIGNED_NUMVAL */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 7: /* TOKEN_UNSIGNED_NUMVAL */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).numeric_literal_value_) != nullptr) {
delete ((*yyvaluep).numeric_literal_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2262 "SqlParser_gen.cpp"
+}
+#line 2018 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 147: /* sql_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 147: /* sql_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).statement_) != nullptr) {
delete ((*yyvaluep).statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2273 "SqlParser_gen.cpp"
+}
+#line 2028 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 148: /* quit_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 148: /* quit_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).quit_statement_) != nullptr) {
delete ((*yyvaluep).quit_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2284 "SqlParser_gen.cpp"
+}
+#line 2038 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 149: /* alter_table_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 149: /* alter_table_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).statement_) != nullptr) {
delete ((*yyvaluep).statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2295 "SqlParser_gen.cpp"
+}
+#line 2048 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 150: /* create_table_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 150: /* create_table_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).create_table_statement_) != nullptr) {
delete ((*yyvaluep).create_table_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2306 "SqlParser_gen.cpp"
+}
+#line 2058 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 151: /* create_index_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 151: /* create_index_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).statement_) != nullptr) {
delete ((*yyvaluep).statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2317 "SqlParser_gen.cpp"
+}
+#line 2068 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 152: /* drop_table_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 152: /* drop_table_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).drop_table_statement_) != nullptr) {
delete ((*yyvaluep).drop_table_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2328 "SqlParser_gen.cpp"
+}
+#line 2078 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 153: /* column_def */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 153: /* column_def */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).attribute_definition_) != nullptr) {
delete ((*yyvaluep).attribute_definition_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2339 "SqlParser_gen.cpp"
+}
+#line 2088 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 154: /* column_def_commalist */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 154: /* column_def_commalist */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).attribute_definition_list_) != nullptr) {
delete ((*yyvaluep).attribute_definition_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2350 "SqlParser_gen.cpp"
+}
+#line 2098 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 155: /* data_type */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 155: /* data_type */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).data_type_) != nullptr) {
delete ((*yyvaluep).data_type_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2361 "SqlParser_gen.cpp"
+}
+#line 2108 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 156: /* column_constraint_def */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 156: /* column_constraint_def */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).column_constraint_) != nullptr) {
delete ((*yyvaluep).column_constraint_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2372 "SqlParser_gen.cpp"
+}
+#line 2118 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 157: /* column_constraint_def_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 157: /* column_constraint_def_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).column_constraint_list_) != nullptr) {
delete ((*yyvaluep).column_constraint_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2383 "SqlParser_gen.cpp"
+}
+#line 2128 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 158: /* opt_column_constraint_def_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 158: /* opt_column_constraint_def_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).column_constraint_list_) != nullptr) {
delete ((*yyvaluep).column_constraint_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2394 "SqlParser_gen.cpp"
+}
+#line 2138 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 162: /* opt_column_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 162: /* opt_column_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).attribute_list_) != nullptr) {
delete ((*yyvaluep).attribute_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2405 "SqlParser_gen.cpp"
+}
+#line 2148 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 163: /* opt_block_properties */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 163: /* opt_block_properties */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).block_properties_) != nullptr) {
delete ((*yyvaluep).block_properties_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2416 "SqlParser_gen.cpp"
+}
+#line 2158 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 164: /* opt_partition_clause */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 164: /* opt_partition_clause */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).partition_clause_) != nullptr) {
delete ((*yyvaluep).partition_clause_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2427 "SqlParser_gen.cpp"
+}
+#line 2168 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 165: /* partition_type */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 165: /* partition_type */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).string_value_) != nullptr) {
delete ((*yyvaluep).string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2438 "SqlParser_gen.cpp"
+}
+#line 2178 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 166: /* key_value_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 166: /* key_value_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).key_value_list_) != nullptr) {
delete ((*yyvaluep).key_value_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2449 "SqlParser_gen.cpp"
+}
+#line 2188 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 167: /* key_value */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 167: /* key_value */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).key_value_) != nullptr) {
delete ((*yyvaluep).key_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2460 "SqlParser_gen.cpp"
+}
+#line 2198 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 168: /* key_string_value */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 168: /* key_string_value */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).key_string_value_) != nullptr) {
delete ((*yyvaluep).key_string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2471 "SqlParser_gen.cpp"
+}
+#line 2208 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 169: /* key_string_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 169: /* key_string_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).key_string_list_) != nullptr) {
delete ((*yyvaluep).key_string_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2482 "SqlParser_gen.cpp"
+}
+#line 2218 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 170: /* key_integer_value */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 170: /* key_integer_value */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).key_integer_value_) != nullptr) {
delete ((*yyvaluep).key_integer_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2493 "SqlParser_gen.cpp"
+}
+#line 2228 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 171: /* index_type */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 171: /* index_type */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).string_value_) != nullptr) {
delete ((*yyvaluep).string_value_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2504 "SqlParser_gen.cpp"
+}
+#line 2238 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 172: /* opt_index_properties */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 172: /* opt_index_properties */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).key_value_list_) != nullptr) {
delete ((*yyvaluep).key_value_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2515 "SqlParser_gen.cpp"
+}
+#line 2248 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 173: /* insert_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 173: /* insert_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).insert_statement_) != nullptr) {
delete ((*yyvaluep).insert_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2526 "SqlParser_gen.cpp"
+}
+#line 2258 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 174: /* copy_from_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 174: /* copy_from_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).copy_from_statement_) != nullptr) {
delete ((*yyvaluep).copy_from_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2537 "SqlParser_gen.cpp"
+}
+#line 2268 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 175: /* opt_copy_from_params */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 175: /* opt_copy_from_params */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).copy_from_params_) != nullptr) {
delete ((*yyvaluep).copy_from_params_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2548 "SqlParser_gen.cpp"
+}
+#line 2278 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 176: /* copy_from_params */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 176: /* copy_from_params */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).copy_from_params_) != nullptr) {
delete ((*yyvaluep).copy_from_params_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2559 "SqlParser_gen.cpp"
+}
+#line 2288 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 177: /* update_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 177: /* update_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).update_statement_) != nullptr) {
delete ((*yyvaluep).update_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2570 "SqlParser_gen.cpp"
+}
+#line 2298 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 178: /* delete_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 178: /* delete_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).delete_statement_) != nullptr) {
delete ((*yyvaluep).delete_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2581 "SqlParser_gen.cpp"
+}
+#line 2308 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 179: /* assignment_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 179: /* assignment_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).assignment_list_) != nullptr) {
delete ((*yyvaluep).assignment_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2592 "SqlParser_gen.cpp"
+}
+#line 2318 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 180: /* assignment_item */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 180: /* assignment_item */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).assignment_) != nullptr) {
delete ((*yyvaluep).assignment_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2603 "SqlParser_gen.cpp"
+}
+#line 2328 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 181: /* select_statement */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 181: /* select_statement */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).select_statement_) != nullptr) {
delete ((*yyvaluep).select_statement_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2614 "SqlParser_gen.cpp"
+}
+#line 2338 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 182: /* opt_priority_clause */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 182: /* opt_priority_clause */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).opt_priority_clause_) != nullptr) {
delete ((*yyvaluep).opt_priority_clause_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2625 "SqlParser_gen.cpp"
+}
+#line 2348 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 183: /* with_clause */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 183: /* with_clause */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).with_list_) != nullptr) {
delete ((*yyvaluep).with_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2636 "SqlParser_gen.cpp"
+}
+#line 2358 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 184: /* with_list */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 184: /* with_list */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).with_list_) != nullptr) {
delete ((*yyvaluep).with_list_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2647 "SqlParser_gen.cpp"
+}
+#line 2368 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 185: /* with_list_element */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 185: /* with_list_element */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).with_list_element_) != nullptr) {
delete ((*yyvaluep).with_list_element_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2658 "SqlParser_gen.cpp"
+}
+#line 2378 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 186: /* select_query */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 186: /* select_query */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257 */
+ {
if (((*yyvaluep).select_query_) != nullptr) {
delete ((*yyvaluep).select_query_);
}
-};
-/* Line 1398 of yacc.c */
-#line 2669 "SqlParser_gen.cpp"
+}
+#line 2388 "SqlParser_gen.cpp" /* yacc.c:1257 */
break;
- case 188: /* selection */
-/* Line 1398 of yacc.c */
-#line 620 "../SqlParser.ypp"
- {
+
+ case 188: /* selection */
+#line 620 "../SqlParser.ypp" /* yacc.c:1257
<TRUNCATED>
[5/7] incubator-quickstep git commit: Enable \analyze command to be
applied to specific tables
Posted by hb...@apache.org.
Enable \analyze command to be applied to specific tables
Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/4126c4f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/4126c4f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/4126c4f2
Branch: refs/heads/partitioned-aggregate-new
Commit: 4126c4f2b9677800995c258df3795526b1e49aa8
Parents: 0820e3d
Author: Jianqiao <ji...@cs.wisc.edu>
Authored: Tue Oct 4 00:12:41 2016 -0500
Committer: Jianqiao <ji...@cs.wisc.edu>
Committed: Tue Oct 4 00:22:23 2016 -0500
----------------------------------------------------------------------
cli/CommandExecutor.cpp | 99 ++++++++++++++++++++++++++++++++------------
1 file changed, 73 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4126c4f2/cli/CommandExecutor.cpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
index 78fbe6f..fea4b74 100644
--- a/cli/CommandExecutor.cpp
+++ b/cli/CommandExecutor.cpp
@@ -197,9 +197,9 @@ void executeDescribeTable(
}
/**
- * @brief A helper function that executes a SQL query to obtain a scalar result.
+ * @brief A helper function that executes a SQL query to obtain a row of results.
*/
-inline TypedValue executeQueryForSingleResult(
+inline std::vector<TypedValue> executeQueryForSingleRow(
const tmb::client_id main_thread_client_id,
const tmb::client_id foreman_client_id,
const std::string &query_string,
@@ -232,22 +232,29 @@ inline TypedValue executeQueryForSingleResult(
const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation();
DCHECK(query_result_relation != nullptr);
- TypedValue value;
+ std::vector<TypedValue> values;
{
std::vector<block_id> blocks = query_result_relation->getBlocksSnapshot();
DCHECK_EQ(1u, blocks.size());
+
BlockReference block = storage_manager->getBlock(blocks[0], *query_result_relation);
const TupleStorageSubBlock &tuple_store = block->getTupleStorageSubBlock();
DCHECK_EQ(1, tuple_store.numTuples());
- DCHECK_EQ(1u, tuple_store.getRelation().size());
+ const std::size_t num_columns = tuple_store.getRelation().size();
if (tuple_store.isPacked()) {
- value = tuple_store.getAttributeValueTyped(0, 0);
+ for (std::size_t i = 0; i < num_columns; ++i) {
+ values.emplace_back(tuple_store.getAttributeValueTyped(0, i));
+ values[i].ensureNotReference();
+ }
} else {
std::unique_ptr<TupleIdSequence> existence_map(tuple_store.getExistenceMap());
- value = tuple_store.getAttributeValueTyped(*existence_map->begin(), 0);
+ for (std::size_t i = 0; i < num_columns; ++i) {
+ values.emplace_back(
+ tuple_store.getAttributeValueTyped(*existence_map->begin(), i));
+ values[i].ensureNotReference();
+ }
}
- value.ensureNotReference();
}
// Drop the result relation.
@@ -255,10 +262,34 @@ inline TypedValue executeQueryForSingleResult(
query_processor->getDefaultDatabase(),
query_processor->getStorageManager());
- return value;
+ return values;
+}
+
+/**
+ * @brief A helper function that executes a SQL query to obtain a scalar result.
+ */
+inline TypedValue executeQueryForSingleResult(
+ const tmb::client_id main_thread_client_id,
+ const tmb::client_id foreman_client_id,
+ const std::string &query_string,
+ tmb::MessageBus *bus,
+ StorageManager *storage_manager,
+ QueryProcessor *query_processor,
+ SqlParserWrapper *parser_wrapper) {
+ std::vector<TypedValue> results =
+ executeQueryForSingleRow(main_thread_client_id,
+ foreman_client_id,
+ query_string,
+ bus,
+ storage_manager,
+ query_processor,
+ parser_wrapper);
+ DCHECK_EQ(1u, results.size());
+ return results[0];
}
-void executeAnalyze(const tmb::client_id main_thread_client_id,
+void executeAnalyze(const PtrVector<ParseString> *arguments,
+ const tmb::client_id main_thread_client_id,
const tmb::client_id foreman_client_id,
MessageBus *bus,
QueryProcessor *query_processor,
@@ -267,8 +298,19 @@ void executeAnalyze(const tmb::client_id main_thread_client_id,
StorageManager *storage_manager = query_processor->getStorageManager();
std::unique_ptr<SqlParserWrapper> parser_wrapper(new SqlParserWrapper());
- std::vector<std::reference_wrapper<const CatalogRelation>> relations(
- database.begin(), database.end());
+ std::vector<std::reference_wrapper<const CatalogRelation>> relations;
+ if (arguments->size() == 0) {
+ relations.insert(relations.begin(), database.begin(), database.end());
+ } else {
+ for (const auto &rel_name : *arguments) {
+ const CatalogRelation *rel = database.getRelationByName(rel_name.value());
+ if (rel == nullptr) {
+ THROW_SQL_ERROR_AT(&rel_name) << "Table does not exist";
+ } else {
+ relations.emplace_back(*rel);
+ }
+ }
+ }
// Analyze each relation in the database.
for (const CatalogRelation &relation : relations) {
@@ -286,19 +328,21 @@ void executeAnalyze(const tmb::client_id main_thread_client_id,
query_string.append(relation.getName());
query_string.append(";");
- TypedValue num_distinct_values =
- executeQueryForSingleResult(main_thread_client_id,
- foreman_client_id,
- query_string,
- bus,
- storage_manager,
- query_processor,
- parser_wrapper.get());
-
- DCHECK(num_distinct_values.getTypeID() == TypeID::kLong);
- mutable_relation->getStatisticsMutable()->setNumDistinctValues(
- attribute.getID(),
- num_distinct_values.getLiteral<std::int64_t>());
+ std::vector<TypedValue> results =
+ executeQueryForSingleRow(main_thread_client_id,
+ foreman_client_id,
+ query_string,
+ bus,
+ storage_manager,
+ query_processor,
+ parser_wrapper.get());
+
+ auto *stat = mutable_relation->getStatisticsMutable();
+ const attribute_id attr_id = attribute.getID();
+
+ DCHECK(results[0].getTypeID() == TypeID::kLong);
+ stat->setNumDistinctValues(attr_id,
+ results[0].getLiteral<std::int64_t>());
}
// Get the number of tuples for the relation.
@@ -348,8 +392,11 @@ void executeCommand(const ParseStatement &statement,
executeDescribeTable(arguments, catalog_database, out);
}
} else if (command_str == C::kAnalyzeCommand) {
- executeAnalyze(
- main_thread_client_id, foreman_client_id, bus, query_processor, out);
+ executeAnalyze(arguments,
+ main_thread_client_id,
+ foreman_client_id,
+ bus,
+ query_processor, out);
} else {
THROW_SQL_ERROR_AT(command.command()) << "Invalid Command";
}
[4/7] incubator-quickstep git commit: Checking in preprocessed files
for datetime change.
Posted by hb...@apache.org.
Checking in preprocessed files for datetime 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/0820e3d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/0820e3d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/0820e3d9
Branch: refs/heads/partitioned-aggregate-new
Commit: 0820e3d92001b4f15caff0a5291beb134bd16a6c
Parents: 6b377d5
Author: Harshad Deshmukh <hb...@apache.org>
Authored: Sun Oct 2 07:59:55 2016 -0500
Committer: Harshad Deshmukh <hb...@apache.org>
Committed: Sun Oct 2 07:59:55 2016 -0500
----------------------------------------------------------------------
parser/preprocessed/SqlParser_gen.cpp | 4602 +++++++++++++---------------
parser/preprocessed/SqlParser_gen.hpp | 322 +-
2 files changed, 2261 insertions(+), 2663 deletions(-)
----------------------------------------------------------------------
[2/7] incubator-quickstep git commit: Checking in preprocessed files
for datetime change.
Posted by hb...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0820e3d9/parser/preprocessed/SqlParser_gen.hpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlParser_gen.hpp b/parser/preprocessed/SqlParser_gen.hpp
index 0f66d1d..fe963be 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.7. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2013 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 <http://www.gnu.org/licenses/>. */
@@ -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
-/* Enabling traces. */
+/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
@@ -40,152 +40,151 @@
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,
- 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_PRIORITY = 354,
- TOKEN_QUIT = 355,
- TOKEN_RANGE = 356,
- TOKEN_REAL = 357,
- TOKEN_REFERENCES = 358,
- TOKEN_RIGHT = 359,
- TOKEN_ROW = 360,
- TOKEN_ROW_DELIMITER = 361,
- TOKEN_ROWS = 362,
- TOKEN_SECOND = 363,
- TOKEN_SELECT = 364,
- TOKEN_SET = 365,
- TOKEN_SMA = 366,
- TOKEN_SMALLINT = 367,
- TOKEN_SUBSTRING = 368,
- TOKEN_TABLE = 369,
- TOKEN_THEN = 370,
- TOKEN_TIME = 371,
- TOKEN_TIMESTAMP = 372,
- TOKEN_TRUE = 373,
- TOKEN_TUPLESAMPLE = 374,
- TOKEN_UNBOUNDED = 375,
- TOKEN_UNIQUE = 376,
- TOKEN_UPDATE = 377,
- TOKEN_USING = 378,
- TOKEN_VALUES = 379,
- TOKEN_VARCHAR = 380,
- TOKEN_WHEN = 381,
- TOKEN_WHERE = 382,
- TOKEN_WINDOW = 383,
- TOKEN_WITH = 384,
- TOKEN_YEAR = 385,
- TOKEN_YEARMONTH = 386,
- TOKEN_EOF = 387,
- TOKEN_LEX_ERROR = 388
- };
+ 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_PRIORITY = 354,
+ TOKEN_QUIT = 355,
+ TOKEN_RANGE = 356,
+ TOKEN_REAL = 357,
+ TOKEN_REFERENCES = 358,
+ TOKEN_RIGHT = 359,
+ TOKEN_ROW = 360,
+ TOKEN_ROW_DELIMITER = 361,
+ TOKEN_ROWS = 362,
+ TOKEN_SECOND = 363,
+ TOKEN_SELECT = 364,
+ TOKEN_SET = 365,
+ TOKEN_SMA = 366,
+ TOKEN_SMALLINT = 367,
+ TOKEN_SUBSTRING = 368,
+ TOKEN_TABLE = 369,
+ TOKEN_THEN = 370,
+ TOKEN_TIME = 371,
+ TOKEN_TIMESTAMP = 372,
+ TOKEN_TRUE = 373,
+ TOKEN_TUPLESAMPLE = 374,
+ TOKEN_UNBOUNDED = 375,
+ TOKEN_UNIQUE = 376,
+ TOKEN_UPDATE = 377,
+ TOKEN_USING = 378,
+ TOKEN_VALUES = 379,
+ TOKEN_VARCHAR = 380,
+ TOKEN_WHEN = 381,
+ TOKEN_WHERE = 382,
+ TOKEN_WINDOW = 383,
+ TOKEN_WITH = 384,
+ TOKEN_YEAR = 385,
+ TOKEN_YEARMONTH = 386,
+ TOKEN_EOF = 387,
+ TOKEN_LEX_ERROR = 388
+ };
#endif
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
{
-/* Line 2058 of yacc.c */
-#line 120 "../SqlParser.ypp"
+#line 120 "../SqlParser.ypp" /* yacc.c:1909 */
quickstep::ParseString *string_value_;
@@ -285,41 +284,28 @@ typedef union YYSTYPE
quickstep::ParsePriority *opt_priority_clause_;
-
-/* Line 2058 of yacc.c */
-#line 291 "SqlParser_gen.hpp"
-} YYSTYPE;
+#line 288 "SqlParser_gen.hpp" /* yacc.c:1909 */
+};
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+/* Location type. */
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE
+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
+};
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int quickstep_yyparse (void *YYPARSE_PARAM);
-#else
-int quickstep_yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
+
int quickstep_yyparse (yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement);
-#else
-int quickstep_yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
#endif /* !YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED */
[6/7] incubator-quickstep git commit: Improve
StarSchemaSimpleCostModel to provide closer estimation of number of groups
for hash aggregation.
Posted by hb...@apache.org.
Improve StarSchemaSimpleCostModel to provide closer estimation of number of groups for hash 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/ad1f8c40
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/ad1f8c40
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/ad1f8c40
Branch: refs/heads/partitioned-aggregate-new
Commit: ad1f8c406954778d332f02b680e08e0118727436
Parents: 4126c4f
Author: Jianqiao Zhu <ji...@cs.wisc.edu>
Authored: Mon Oct 3 23:58:30 2016 -0500
Committer: Jianqiao Zhu <ji...@cs.wisc.edu>
Committed: Tue Oct 4 17:06:04 2016 -0500
----------------------------------------------------------------------
query_optimizer/CMakeLists.txt | 2 +-
query_optimizer/ExecutionGenerator.cpp | 8 +-
query_optimizer/ExecutionGenerator.hpp | 1 -
query_optimizer/cost_model/CMakeLists.txt | 3 +
query_optimizer/cost_model/CostModel.hpp | 11 +
.../cost_model/StarSchemaSimpleCostModel.cpp | 243 ++++++++++++++-----
.../cost_model/StarSchemaSimpleCostModel.hpp | 70 ++++--
query_optimizer/expressions/ExpressionUtil.hpp | 19 ++
.../StarSchemaHashJoinOrderOptimization.hpp | 2 +-
9 files changed, 280 insertions(+), 79 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
index 32f7885..988ffd8 100644
--- a/query_optimizer/CMakeLists.txt
+++ b/query_optimizer/CMakeLists.txt
@@ -78,7 +78,7 @@ target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
quickstep_queryoptimizer_QueryHandle
quickstep_queryoptimizer_QueryPlan
quickstep_queryoptimizer_costmodel_CostModel
- quickstep_queryoptimizer_costmodel_SimpleCostModel
+ quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
quickstep_queryoptimizer_expressions_AggregateFunction
quickstep_queryoptimizer_expressions_Alias
quickstep_queryoptimizer_expressions_AttributeReference
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index 968314e..9347c9c 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -58,7 +58,7 @@
#include "query_optimizer/OptimizerContext.hpp"
#include "query_optimizer/QueryHandle.hpp"
#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/cost_model/SimpleCostModel.hpp"
+#include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp"
#include "query_optimizer/expressions/AggregateFunction.hpp"
#include "query_optimizer/expressions/Alias.hpp"
#include "query_optimizer/expressions/AttributeReference.hpp"
@@ -167,7 +167,7 @@ void ExecutionGenerator::generatePlan(const P::PhysicalPtr &physical_plan) {
<< "The physical plan must be rooted by a TopLevelPlan";
cost_model_.reset(
- new cost::SimpleCostModel(top_level_physical_plan_->shared_subplans()));
+ new cost::StarSchemaSimpleCostModel(top_level_physical_plan_->shared_subplans()));
const CatalogRelation *result_relation = nullptr;
@@ -1411,7 +1411,9 @@ void ExecutionGenerator::convertAggregate(
aggr_state_proto->mutable_predicate()->CopyFrom(predicate->getProto());
}
- aggr_state_proto->set_estimated_num_entries(cost_model_->estimateCardinality(physical_plan));
+ const std::size_t estimated_num_groups =
+ cost_model_->estimateNumGroupsForAggregate(physical_plan);
+ aggr_state_proto->set_estimated_num_entries(std::max(16uL, estimated_num_groups));
const QueryPlan::DAGNodeIndex aggregation_operator_index =
execution_plan_->addRelationalOperator(
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/ExecutionGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.hpp b/query_optimizer/ExecutionGenerator.hpp
index 6017aa5..2aaf5ab 100644
--- a/query_optimizer/ExecutionGenerator.hpp
+++ b/query_optimizer/ExecutionGenerator.hpp
@@ -37,7 +37,6 @@
#include "query_optimizer/QueryHandle.hpp"
#include "query_optimizer/QueryPlan.hpp"
#include "query_optimizer/cost_model/CostModel.hpp"
-#include "query_optimizer/cost_model/SimpleCostModel.hpp"
#include "query_optimizer/expressions/ExprId.hpp"
#include "query_optimizer/expressions/NamedExpression.hpp"
#include "query_optimizer/expressions/Predicate.hpp"
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/cost_model/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/CMakeLists.txt b/query_optimizer/cost_model/CMakeLists.txt
index abbc3da..ba99de3 100644
--- a/query_optimizer/cost_model/CMakeLists.txt
+++ b/query_optimizer/cost_model/CMakeLists.txt
@@ -24,6 +24,7 @@ add_library(quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
# Link dependencies:
target_link_libraries(quickstep_queryoptimizer_costmodel_CostModel
+ quickstep_queryoptimizer_physical_Aggregate
quickstep_queryoptimizer_physical_Physical
quickstep_utility_Macros)
target_link_libraries(quickstep_queryoptimizer_costmodel_SimpleCostModel
@@ -50,6 +51,7 @@ target_link_libraries(quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostMod
quickstep_queryoptimizer_expressions_ComparisonExpression
quickstep_queryoptimizer_expressions_ExprId
quickstep_queryoptimizer_expressions_ExpressionType
+ quickstep_queryoptimizer_expressions_ExpressionUtil
quickstep_queryoptimizer_expressions_LogicalAnd
quickstep_queryoptimizer_expressions_LogicalOr
quickstep_queryoptimizer_expressions_PatternMatcher
@@ -57,6 +59,7 @@ target_link_libraries(quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostMod
quickstep_queryoptimizer_physical_Aggregate
quickstep_queryoptimizer_physical_HashJoin
quickstep_queryoptimizer_physical_NestedLoopsJoin
+ quickstep_queryoptimizer_physical_PatternMatcher
quickstep_queryoptimizer_physical_Physical
quickstep_queryoptimizer_physical_PhysicalType
quickstep_queryoptimizer_physical_Selection
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/cost_model/CostModel.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/CostModel.hpp b/query_optimizer/cost_model/CostModel.hpp
index ca49733..20bc208 100644
--- a/query_optimizer/cost_model/CostModel.hpp
+++ b/query_optimizer/cost_model/CostModel.hpp
@@ -22,6 +22,7 @@
#include <cstddef>
+#include "query_optimizer/physical/Aggregate.hpp"
#include "query_optimizer/physical/Physical.hpp"
#include "utility/Macros.hpp"
@@ -53,6 +54,16 @@ class CostModel {
virtual std::size_t estimateCardinality(
const physical::PhysicalPtr &physical_plan) = 0;
+ /**
+ * @brief Estimate the number of groups of an aggregation.
+ *
+ * @param aggregate The physical plan of the aggregation.
+ * @return The estimated number of groups.
+ */
+ virtual std::size_t estimateNumGroupsForAggregate(const physical::AggregatePtr &aggregate) {
+ return estimateCardinality(aggregate);
+ }
+
protected:
/**
* @brief Constructor.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
index 911a765..8d254fa 100644
--- a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
+++ b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
@@ -29,6 +29,7 @@
#include "query_optimizer/expressions/ComparisonExpression.hpp"
#include "query_optimizer/expressions/ExprId.hpp"
#include "query_optimizer/expressions/ExpressionType.hpp"
+#include "query_optimizer/expressions/ExpressionUtil.hpp"
#include "query_optimizer/expressions/LogicalAnd.hpp"
#include "query_optimizer/expressions/LogicalOr.hpp"
#include "query_optimizer/expressions/Predicate.hpp"
@@ -36,6 +37,7 @@
#include "query_optimizer/physical/Aggregate.hpp"
#include "query_optimizer/physical/NestedLoopsJoin.hpp"
#include "query_optimizer/physical/HashJoin.hpp"
+#include "query_optimizer/physical/PatternMatcher.hpp"
#include "query_optimizer/physical/Physical.hpp"
#include "query_optimizer/physical/PhysicalType.hpp"
#include "query_optimizer/physical/Selection.hpp"
@@ -85,8 +87,8 @@ std::size_t StarSchemaSimpleCostModel::estimateCardinality(
shared_subplans_[shared_subplan_reference->subplan_id()]);
}
case P::PhysicalType::kSort:
- return estimateCardinality(
- std::static_pointer_cast<const P::Sort>(physical_plan)->input());
+ return estimateCardinalityForSort(
+ std::static_pointer_cast<const P::Sort>(physical_plan));
case P::PhysicalType::kWindowAggregate:
return estimateCardinalityForWindowAggregate(
std::static_pointer_cast<const P::WindowAggregate>(physical_plan));
@@ -111,9 +113,17 @@ std::size_t StarSchemaSimpleCostModel::estimateCardinalityForTableReference(
std::size_t StarSchemaSimpleCostModel::estimateCardinalityForSelection(
const P::SelectionPtr &physical_plan) {
- double selectivity = estimateSelectivityForSelection(physical_plan);
- return std::max(static_cast<std::size_t>(estimateCardinality(physical_plan->input()) * selectivity),
- static_cast<std::size_t>(1));
+ double selectivity =
+ estimateSelectivityForPredicate(physical_plan->filter_predicate(), physical_plan);
+ return static_cast<std::size_t>(
+ estimateCardinality(physical_plan->input()) * selectivity);
+}
+
+std::size_t StarSchemaSimpleCostModel::estimateCardinalityForSort(
+ const physical::SortPtr &physical_plan) {
+ std::size_t cardinality = estimateCardinality(
+ std::static_pointer_cast<const P::Sort>(physical_plan)->input());
+ return std::min(cardinality, static_cast<std::size_t>(physical_plan->limit()));
}
std::size_t StarSchemaSimpleCostModel::estimateCardinalityForTableGenerator(
@@ -127,8 +137,8 @@ std::size_t StarSchemaSimpleCostModel::estimateCardinalityForHashJoin(
std::size_t right_cardinality = estimateCardinality(physical_plan->right());
double left_selectivity = estimateSelectivity(physical_plan->left());
double right_selectivity = estimateSelectivity(physical_plan->right());
- return std::max(static_cast<std::size_t>(left_cardinality * right_selectivity) + 1,
- static_cast<std::size_t>(right_cardinality * left_selectivity) + 1);
+ return std::max(static_cast<std::size_t>(left_cardinality * right_selectivity + 0.5),
+ static_cast<std::size_t>(right_cardinality * left_selectivity + 0.5));
}
std::size_t StarSchemaSimpleCostModel::estimateCardinalityForNestedLoopsJoin(
@@ -139,11 +149,10 @@ std::size_t StarSchemaSimpleCostModel::estimateCardinalityForNestedLoopsJoin(
std::size_t StarSchemaSimpleCostModel::estimateCardinalityForAggregate(
const P::AggregatePtr &physical_plan) {
- if (physical_plan->grouping_expressions().empty()) {
- return 1;
- }
- return std::max(static_cast<std::size_t>(1),
- estimateCardinality(physical_plan->input()) / 10);
+ double filter_selectivity =
+ estimateSelectivityForPredicate(physical_plan->filter_predicate(), physical_plan);
+ return static_cast<std::size_t>(
+ estimateNumGroupsForAggregate(physical_plan) * filter_selectivity);
}
std::size_t StarSchemaSimpleCostModel::estimateCardinalityForWindowAggregate(
@@ -151,24 +160,115 @@ std::size_t StarSchemaSimpleCostModel::estimateCardinalityForWindowAggregate(
return estimateCardinality(physical_plan->input());
}
+
+std::size_t StarSchemaSimpleCostModel::estimateNumGroupsForAggregate(
+ const physical::AggregatePtr &aggregate) {
+ if (aggregate->grouping_expressions().empty()) {
+ return 1uL;
+ }
+
+ std::size_t estimated_child_cardinality = estimateCardinality(aggregate->input());
+ std::size_t estimated_num_groups = 1;
+ std::size_t max_attr_num_distinct_values = 0;
+ for (const auto &expr : aggregate->grouping_expressions()) {
+ E::AttributeReferencePtr attr;
+ if (E::SomeAttributeReference::MatchesWithConditionalCast(expr, &attr)) {
+ std::size_t attr_num_distinct_values =
+ estimateNumDistinctValues(attr->id(), aggregate->input());
+ estimated_num_groups *= std::max(1uL, attr_num_distinct_values);
+ max_attr_num_distinct_values =
+ std::max(max_attr_num_distinct_values, attr_num_distinct_values);
+ } else {
+ // TODO(jianqiao): implement estimateNumDistinctValues() for expressions.
+ estimated_num_groups *= 64uL;
+ }
+ }
+ estimated_num_groups = std::max(
+ std::min(estimated_num_groups, estimated_child_cardinality / 10),
+ max_attr_num_distinct_values);
+ return estimated_num_groups;
+}
+
+
+std::size_t StarSchemaSimpleCostModel::estimateNumDistinctValues(
+ const expressions::ExprId attribute_id,
+ const physical::PhysicalPtr &physical_plan) {
+ DCHECK(E::ContainsExprId(physical_plan->getOutputAttributes(), attribute_id));
+
+ P::TableReferencePtr table_reference;
+ if (P::SomeTableReference::MatchesWithConditionalCast(physical_plan, &table_reference)) {
+ return getNumDistinctValues(attribute_id, table_reference);
+ }
+
+ double filter_selectivity = estimateSelectivityForFilterPredicate(physical_plan);
+ switch (physical_plan->getPhysicalType()) {
+ case P::PhysicalType::kSelection: // Fall through
+ case P::PhysicalType::kAggregate: {
+ const P::PhysicalPtr &child = physical_plan->children()[0];
+ if (E::ContainsExprId(child->getOutputAttributes(), attribute_id)) {
+ std::size_t child_num_distinct_values =
+ estimateNumDistinctValues(attribute_id, child);
+ return static_cast<std::size_t>(
+ child_num_distinct_values * filter_selectivity + 0.5);
+ }
+ break;
+ }
+ case P::PhysicalType::kHashJoin: {
+ const P::HashJoinPtr &hash_join =
+ std::static_pointer_cast<const P::HashJoin>(physical_plan);
+ if (E::ContainsExprId(hash_join->left()->getOutputAttributes(), attribute_id)) {
+ std::size_t left_child_num_distinct_values =
+ estimateNumDistinctValues(attribute_id, hash_join->left());
+ double right_child_selectivity =
+ estimateSelectivity(hash_join->right());
+ return static_cast<std::size_t>(
+ left_child_num_distinct_values * right_child_selectivity * filter_selectivity + 0.5);
+ }
+ if (E::ContainsExprId(hash_join->right()->getOutputAttributes(), attribute_id)) {
+ std::size_t right_child_num_distinct_values =
+ estimateNumDistinctValues(attribute_id, hash_join->right());
+ double left_child_selectivity =
+ estimateSelectivity(hash_join->left());
+ return static_cast<std::size_t>(
+ right_child_num_distinct_values * left_child_selectivity * filter_selectivity + 0.5);
+ }
+ }
+ default:
+ break;
+ }
+
+ return 16uL;
+}
+
double StarSchemaSimpleCostModel::estimateSelectivity(
const physical::PhysicalPtr &physical_plan) {
switch (physical_plan->getPhysicalType()) {
case P::PhysicalType::kSelection: {
- return estimateSelectivityForSelection(
- std::static_pointer_cast<const P::Selection>(physical_plan));
+ const P::SelectionPtr &selection =
+ std::static_pointer_cast<const P::Selection>(physical_plan);
+ double filter_selectivity =
+ estimateSelectivityForPredicate(selection->filter_predicate(), selection);
+ double child_selectivity = estimateSelectivity(selection->input());
+ return filter_selectivity * child_selectivity;
}
case P::PhysicalType::kHashJoin: {
const P::HashJoinPtr &hash_join =
std::static_pointer_cast<const P::HashJoin>(physical_plan);
- return std::min(estimateSelectivity(hash_join->left()),
- estimateSelectivity(hash_join->right()));
+ double filter_selectivity =
+ estimateSelectivityForPredicate(hash_join->residual_predicate(), hash_join);
+ double child_selectivity =
+ estimateSelectivity(hash_join->left()) * estimateSelectivity(hash_join->right());
+ return filter_selectivity * child_selectivity;
}
case P::PhysicalType::kNestedLoopsJoin: {
const P::NestedLoopsJoinPtr &nested_loop_join =
std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan);
- return std::min(estimateSelectivity(nested_loop_join->left()),
- estimateSelectivity(nested_loop_join->right()));
+ double filter_selectivity =
+ estimateSelectivityForPredicate(nested_loop_join->join_predicate(), nested_loop_join);
+ double child_selectivity = std::min(
+ estimateSelectivity(nested_loop_join->left()),
+ estimateSelectivity(nested_loop_join->right()));
+ return filter_selectivity * child_selectivity;
}
case P::PhysicalType::kSharedSubplanReference: {
const P::SharedSubplanReferencePtr shared_subplan_reference =
@@ -177,36 +277,51 @@ double StarSchemaSimpleCostModel::estimateSelectivity(
shared_subplans_[shared_subplan_reference->subplan_id()]);
}
default:
- return 1.0;
+ break;
}
+
+ if (physical_plan->getNumChildren() == 1) {
+ return estimateSelectivity(physical_plan->children()[0]);
+ }
+
+ return 1.0;
}
-double StarSchemaSimpleCostModel::estimateSelectivityForSelection(
- const physical::SelectionPtr &physical_plan) {
- const E::PredicatePtr &filter_predicate = physical_plan->filter_predicate();
-
- // If the subplan is a table reference, gather the number of distinct values
- // statistics for each column (attribute).
- std::unordered_map<E::ExprId, std::size_t> num_distinct_values_map;
- if (physical_plan->input()->getPhysicalType() == P::PhysicalType::kTableReference) {
- const P::TableReferencePtr &table_reference =
- std::static_pointer_cast<const P::TableReference>(physical_plan->input());
- const CatalogRelation &relation = *table_reference->relation();
- const std::vector<E::AttributeReferencePtr> &attributes = table_reference->attribute_list();
- for (std::size_t i = 0; i < attributes.size(); ++i) {
- std::size_t num_distinct_values = relation.getStatistics().getNumDistinctValues(i);
- if (num_distinct_values > 0) {
- num_distinct_values_map[attributes[i]->id()] = num_distinct_values;
- }
- }
+double StarSchemaSimpleCostModel::estimateSelectivityForFilterPredicate(
+ const physical::PhysicalPtr &physical_plan) {
+ E::PredicatePtr filter_predicate = nullptr;
+ switch (physical_plan->getPhysicalType()) {
+ case P::PhysicalType::kSelection:
+ filter_predicate =
+ std::static_pointer_cast<const P::Selection>(physical_plan)->filter_predicate();
+ break;
+ case P::PhysicalType::kAggregate:
+ filter_predicate =
+ std::static_pointer_cast<const P::Aggregate>(physical_plan)->filter_predicate();
+ break;
+ case P::PhysicalType::kHashJoin:
+ filter_predicate =
+ std::static_pointer_cast<const P::HashJoin>(physical_plan)->residual_predicate();
+ break;
+ case P::PhysicalType::kNestedLoopsJoin:
+ filter_predicate =
+ std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan)->join_predicate();
+ break;
+ default:
+ break;
}
- return estimateSelectivityForPredicate(num_distinct_values_map, filter_predicate);
+ if (filter_predicate == nullptr) {
+ return 1.0;
+ } else {
+ return estimateSelectivityForPredicate(filter_predicate, physical_plan);
+ }
}
+
double StarSchemaSimpleCostModel::estimateSelectivityForPredicate(
- const std::unordered_map<expressions::ExprId, std::size_t> &num_distinct_values_map,
- const expressions::PredicatePtr &filter_predicate) {
+ const expressions::PredicatePtr &filter_predicate,
+ const P::PhysicalPtr &physical_plan) {
if (filter_predicate == nullptr) {
return 1.0;
}
@@ -215,10 +330,8 @@ double StarSchemaSimpleCostModel::estimateSelectivityForPredicate(
case E::ExpressionType::kComparisonExpression: {
// Case 1 - Number of distinct values statistics available
// Case 1.1 - Equality comparison: 1.0 / num_distinct_values
- // Case 1.2 - Otherwise: 5.0 / num_distinct_values
- // Case 2 - Number of distinct values statistics not available
- // Case 2.1 - Equality comparison: 0.1
- // Case 2.2 - Otherwise: 0.5
+ // Case 1.2 - Otherwise: 0.1
+ // Case 2 - Otherwise: 0.5
const E::ComparisonExpressionPtr &comparison_expression =
std::static_pointer_cast<const E::ComparisonExpression>(filter_predicate);
E::AttributeReferencePtr attr;
@@ -226,25 +339,26 @@ double StarSchemaSimpleCostModel::estimateSelectivityForPredicate(
E::SomeScalarLiteral::Matches(comparison_expression->right())) ||
(E::SomeAttributeReference::MatchesWithConditionalCast(comparison_expression->right(), &attr) &&
E::SomeScalarLiteral::Matches(comparison_expression->left()))) {
- const auto it = num_distinct_values_map.find(attr->id());
- if (it != num_distinct_values_map.end() && it->second > 0) {
- double unit_selectivity = 1.0 / it->second;
- return comparison_expression->isEqualityComparisonPredicate()
- ? unit_selectivity
- : std::min(0.5, unit_selectivity * 5.0);
+ for (const auto &child : physical_plan->children()) {
+ if (E::ContainsExprId(child->getOutputAttributes(), attr->id())) {
+ const std::size_t child_num_distinct_values = estimateNumDistinctValues(attr->id(), child);
+ if (comparison_expression->isEqualityComparisonPredicate()) {
+ return 1.0 / child_num_distinct_values;
+ } else {
+ return 1.0 / std::max(std::min(child_num_distinct_values / 100.0, 10.0), 2.0);
+ }
+ }
}
+ return 0.1;
}
-
- return comparison_expression->isEqualityComparisonPredicate() ? 0.1 : 0.5;
+ return 0.5;
}
case E::ExpressionType::kLogicalAnd: {
const E::LogicalAndPtr &logical_and =
std::static_pointer_cast<const E::LogicalAnd>(filter_predicate);
double selectivity = 1.0;
for (const auto &predicate : logical_and->operands()) {
- selectivity =
- std::min(selectivity,
- estimateSelectivityForPredicate(num_distinct_values_map, predicate));
+ selectivity = selectivity * estimateSelectivityForPredicate(predicate, physical_plan);
}
return selectivity;
}
@@ -253,7 +367,7 @@ double StarSchemaSimpleCostModel::estimateSelectivityForPredicate(
std::static_pointer_cast<const E::LogicalOr>(filter_predicate);
double selectivity = 0;
for (const auto &predicate : logical_or->operands()) {
- selectivity += estimateSelectivityForPredicate(num_distinct_values_map, predicate);
+ selectivity += estimateSelectivityForPredicate(predicate, physical_plan);
}
return std::min(selectivity, 1.0);
}
@@ -263,6 +377,23 @@ double StarSchemaSimpleCostModel::estimateSelectivityForPredicate(
return 1.0;
}
+std::size_t StarSchemaSimpleCostModel::getNumDistinctValues(
+ const E::ExprId attribute_id,
+ const P::TableReferencePtr &table_reference) {
+ const CatalogRelation &relation = *table_reference->relation();
+ const std::vector<E::AttributeReferencePtr> &attributes = table_reference->attribute_list();
+ for (std::size_t i = 0; i < attributes.size(); ++i) {
+ if (attributes[i]->id() == attribute_id) {
+ std::size_t num_distinct_values = relation.getStatistics().getNumDistinctValues(i);
+ if (num_distinct_values > 0) {
+ return num_distinct_values;
+ }
+ break;
+ }
+ }
+ return estimateCardinalityForTableReference(table_reference);
+}
+
} // namespace cost
} // namespace optimizer
} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp b/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
index 4314b92..6f6aa29 100644
--- a/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
+++ b/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
@@ -21,7 +21,6 @@
#define QUERY_OPTIMIZER_COST_MODEL_STAR_SCHEMA_SIMPLE_COST_MODEL_HPP_
#include <cstddef>
-#include <unordered_map>
#include <vector>
#include "query_optimizer/cost_model/CostModel.hpp"
@@ -32,6 +31,7 @@
#include "query_optimizer/physical/HashJoin.hpp"
#include "query_optimizer/physical/Physical.hpp"
#include "query_optimizer/physical/Selection.hpp"
+#include "query_optimizer/physical/Sort.hpp"
#include "query_optimizer/physical/TableGenerator.hpp"
#include "query_optimizer/physical/TableReference.hpp"
#include "query_optimizer/physical/TopLevelPlan.hpp"
@@ -67,6 +67,25 @@ class StarSchemaSimpleCostModel : public CostModel {
const physical::PhysicalPtr &physical_plan) override;
/**
+ * @brief Estimate the number of groups in an aggregation.
+ *
+ * @param aggregate The physical plan of the aggregation.
+ * @return The estimated number of groups.
+ */
+ std::size_t estimateNumGroupsForAggregate(
+ const physical::AggregatePtr &aggregate) override;
+
+ /**
+ * @brief Estimate the number of distinct values of an attribute in a relation.
+ *
+ * @param attribute_id The expression id of the target attribute.
+ * @param physical_plan The physical plan of the attribute's relation.
+ * @return The estimated number of distinct values for the attribute.
+ */
+ std::size_t estimateNumDistinctValues(const expressions::ExprId attribute_id,
+ const physical::PhysicalPtr &physical_plan);
+
+ /**
* @brief Estimate the "selectivity" of a physical plan under the assumption
* that it acts as a filtered dimension table in a hash join.
*
@@ -75,40 +94,57 @@ class StarSchemaSimpleCostModel : public CostModel {
*/
double estimateSelectivity(const physical::PhysicalPtr &physical_plan);
+ /**
+ * @brief Estimate the filter predicate's selectivity if it is present in
+ * the input plan's root node.
+ *
+ * @param physical_plan The input physical plan.
+ * @return The estimated selectivity of the filter predicate if physical_plan
+ * has such a filter predicate; 1.0 otherwise.
+ */
+ double estimateSelectivityForFilterPredicate(
+ const physical::PhysicalPtr &physical_plan);
+
private:
- std::size_t estimateCardinalityForTopLevelPlan(
- const physical::TopLevelPlanPtr &physical_plan);
+ std::size_t estimateCardinalityForAggregate(
+ const physical::AggregatePtr &physical_plan);
- std::size_t estimateCardinalityForTableReference(
- const physical::TableReferencePtr &physical_plan);
+ std::size_t estimateCardinalityForHashJoin(
+ const physical::HashJoinPtr &physical_plan);
+
+ std::size_t estimateCardinalityForNestedLoopsJoin(
+ const physical::NestedLoopsJoinPtr &physical_plan);
std::size_t estimateCardinalityForSelection(
const physical::SelectionPtr &physical_plan);
+ std::size_t estimateCardinalityForSort(
+ const physical::SortPtr &physical_plan);
+
std::size_t estimateCardinalityForTableGenerator(
const physical::TableGeneratorPtr &physical_plan);
- std::size_t estimateCardinalityForHashJoin(
- const physical::HashJoinPtr &physical_plan);
-
- std::size_t estimateCardinalityForNestedLoopsJoin(
- const physical::NestedLoopsJoinPtr &physical_plan);
+ std::size_t estimateCardinalityForTableReference(
+ const physical::TableReferencePtr &physical_plan);
- std::size_t estimateCardinalityForAggregate(
- const physical::AggregatePtr &physical_plan);
+ std::size_t estimateCardinalityForTopLevelPlan(
+ const physical::TopLevelPlanPtr &physical_plan);
std::size_t estimateCardinalityForWindowAggregate(
const physical::WindowAggregatePtr &physical_plan);
- double estimateSelectivityForSelection(
- const physical::SelectionPtr &physical_plan);
-
double estimateSelectivityForPredicate(
- const std::unordered_map<expressions::ExprId, std::size_t> &num_distinct_values_map,
- const expressions::PredicatePtr &filter_predicate);
+ const expressions::PredicatePtr &filter_predicate,
+ const physical::PhysicalPtr &physical_plan);
const std::vector<physical::PhysicalPtr> &shared_subplans_;
+ // Get the number of distinct values of an attribute in the table reference.
+ // If the stat is not avaiable, simply returns the table's cardinality.
+ std::size_t getNumDistinctValues(const expressions::ExprId attribute_id,
+ const physical::TableReferencePtr &table_reference);
+
+
DISALLOW_COPY_AND_ASSIGN(StarSchemaSimpleCostModel);
};
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/expressions/ExpressionUtil.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.hpp b/query_optimizer/expressions/ExpressionUtil.hpp
index e9a4067..422d5ab 100644
--- a/query_optimizer/expressions/ExpressionUtil.hpp
+++ b/query_optimizer/expressions/ExpressionUtil.hpp
@@ -95,6 +95,25 @@ bool ContainsExpression(
}
/**
+ * @brief Checks whether expr_id equals any expression's id in \p expressions.
+ *
+ * @param expressions A list of expressions to be checked with.
+ * @param expr_id The ExprId that is to be checked if it is in \p expressions.
+ * @return True if \p expr_id is contained by \p expressions.
+ */
+template <class NamedExpressionType>
+bool ContainsExprId(
+ const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions,
+ const ExprId expr_id) {
+ for (const std::shared_ptr<const NamedExpressionType> &expression : expressions) {
+ if (expression->id() == expr_id) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
* @brief Checks whether \p left is a subset of \p right.
*
* @param left The left operand of the subset operator (i.e. the one that may be
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/ad1f8c40/query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp b/query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp
index 4d6765c..c1a7bae 100644
--- a/query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp
+++ b/query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp
@@ -103,7 +103,7 @@ class StarSchemaHashJoinOrderOptimization : public Rule<physical::Physical> {
if (lhs->estimated_selectivity < rhs->estimated_selectivity) {
return !swapped;
- } else if (lhs->estimated_cardinality < 1000u &&
+ } else if (lhs->estimated_cardinality < 100u &&
rhs->estimated_cardinality > 10000u &&
lhs->estimated_selectivity < rhs->estimated_selectivity * 1.5) {
return !swapped;