blob: 838bfdd75d165ee1ad8abdf990d36210dbaf7e1f [file] [log] [blame]
/**
* 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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_DISTINCT_HPP_
#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_DISTINCT_HPP_
#include <cstddef>
#include <memory>
#include <vector>
#include "catalog/CatalogTypedefs.hpp"
#include "expressions/aggregation/AggregationConcreteHandle.hpp"
#include "storage/HashTableBase.hpp"
#include "types/TypedValue.hpp"
#include "utility/Macros.hpp"
#include "glog/logging.h"
namespace quickstep {
class AggregationState;
class ColumnVector;
class StorageManager;
class Type;
class ValueAccessor;
/** \addtogroup Expressions
* @{
*/
class AggregationHandleDistinct : public AggregationConcreteHandle {
public:
/**
* @brief Constructor.
**/
AggregationHandleDistinct() {}
AggregationState* createInitialState() const override {
LOG(FATAL)
<< "AggregationHandleDistinct does not support createInitialState().";
}
AggregationState* accumulateNullary(
const std::size_t num_tuples) const override {
LOG(FATAL)
<< "AggregationHandleDistinct does not support accumulateNullary().";
}
AggregationState* accumulateColumnVectors(
const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
const override {
LOG(FATAL) << "AggregationHandleDistinct does not support "
"accumulateColumnVectors().";
}
#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
AggregationState* accumulateValueAccessor(
ValueAccessor *accessor,
const std::vector<attribute_id> &accessor_ids) const override {
LOG(FATAL) << "AggregationHandleDistinct does not support "
"accumulateValueAccessor().";
}
#endif
void mergeStates(const AggregationState &source,
AggregationState *destination) const override {
LOG(FATAL) << "AggregationHandleDistinct does not support mergeStates().";
}
TypedValue finalize(const AggregationState &state) const override {
LOG(FATAL) << "AggregationHandleDistinct does not support finalize().";
}
AggregationState* aggregateOnDistinctifyHashTableForSingle(
const AggregationStateHashTableBase &distinctify_hash_table)
const override {
LOG(FATAL) << "AggregationHandleDistinct does not support "
<< "aggregateOnDistinctifyHashTableForSingle().";
}
void aggregateOnDistinctifyHashTableForGroupBy(
const AggregationStateHashTableBase &distinctify_hash_table,
AggregationStateHashTableBase *groupby_hash_table,
std::size_t index) const override {
LOG(FATAL) << "AggregationHandleDistinct does not support "
<< "aggregateOnDistinctifyHashTableForGroupBy().";
}
AggregationStateHashTableBase* createGroupByHashTable(
const HashTableImplType hash_table_impl,
const std::vector<const Type *> &group_by_types,
const std::size_t estimated_num_groups,
StorageManager *storage_manager) const override;
void aggregateValueAccessorIntoHashTable(
ValueAccessor *accessor,
const std::vector<attribute_id> &argument_ids,
const std::vector<attribute_id> &group_by_key_ids,
AggregationStateHashTableBase *hash_table) const override;
ColumnVector* finalizeHashTable(
const AggregationStateHashTableBase &hash_table,
std::vector<std::vector<TypedValue>> *group_by_keys,
int index) const override;
private:
DISALLOW_COPY_AND_ASSIGN(AggregationHandleDistinct);
};
/** @} */
} // namespace quickstep
#endif // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_DISTINCT_HPP_