text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionSum.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
}
namespace
{
te... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>st
{
writeBinary(sum, buf);
writeBinary(compensation, buf);
}
void read(ReadBuffer & buf)
{
readBinary(sum, buf);
readBinary(compensation, buf);
}
T get() const
{
return sum;
}
};
enum AggregateFunctionSumType
{
AggregateFunct... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>rameters_sumCount, returned_value_sumCount, examples_sumCount, introduced_in_sumCount, category_sumCount};
factory.registerFunction("sumCount", {createAggregateFunctionSumCount, documentation_sumCount});
}
}
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <Columns/Col... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> AggregateFunctionSumMapFiltered final :
public AggregateFunctionMapBase<
AggregateFunctionSumMapFiltered<overflow, tuple_argument>,
FieldVisitorSum,
overflow,
tuple_argument,
true>
{
private:
using Self = AggregateFunctionSumMapFiltered<overflow, tuple_argu... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/StatCommon.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnTuple.h>
#include <Common/assert_cast.h>
#include <Core/Types.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeTuple.h>... | fim | ClickHouse/ClickHouse | c |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionTheilsU.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <memory>
namespace DB
{
void registerAggregateFunctionTheilsU(AggregateFunctionFactory & factory);
void registerAggregateFunctionTheilsU(AggregateF... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/CrossTab.h>
#include <cmath>
namespace DB
{
struct TheilsUWindowData;
/// add() β O(1) with low constant factor
/// getResult() β O(|count_a| + |count_b| + |count_ab|)
/// Suitable to be used in GROUP BY
struct TheilsUData : CrossTabAggregateData
{
stati... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>p, introduced_in_skewPop, category_skewPop};
factory.registerFunction("skewPop", {createAggregateFunctionStatisticsUnary<AggregateFunctionThirdMoment, StatisticsFunctionKind::skewPop>, documentation_skewPop});
}
}
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <Aggre... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>
{
public:
using AggregateFunctionTopK<DataTypeDateTime::FieldType, is_weighted>::AggregateFunctionTopK;
AggregateFunctionTopKDateTime(UInt64 threshold_, UInt64 reserved_, bool include_counts_, bool is_approx_top_k_, const DataTypes & argument_types_, const Array & params)
: AggregateFunc... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>umentation documentation_uniqExact = {description_uniqExact, syntax_uniqExact, arguments_uniqExact, {}, returned_value_uniqExact, examples_uniqExact, introduced_in_uniqExact, category_uniqExact};
factory.registerFunction("uniqExact", {assign_bool_param, documentation_uniqExact, properties});
#if USE... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>qualKeysRanges() const override { return !is_able_to_parallelize_merge; }
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, ThreadPool & thread_pool, std::atomic<bool> & is_cancelled, Arena *) const override
{
if constexpr (is_able_to_parallelize_merge)
... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionUniqCombined.h>
namespace DB
{
namespace ErrorCodes
{
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
extern const int ARGUMENT_OUT_OF_BOUND;
}
namespace
{
AggregateFunctionPtr createAggregateFunctionUniqCombined(bool use_64_bit_hash,
const ... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <Common/FieldVisitorConvertToNumber.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDate32.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeIPv4andIPv6.h>
#... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/Aggrega<|fim_suffix|>t_hash, const DataTypes & argument_types, const Array & params);
}
<|fim_middle|>teFunctionUniqCombined.h>
namespace DB
{
template AggregateFunctionPtr createAggregateFunctionWithHashType<12>(bool use_64_bi<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionUniqCombined.h>
namespace DB
{
template AggregateFunctionPtr createAggregateFunctio<|fim_suffix|>ams);
}
<|fim_middle|>nWithHashType<13>(bool use_64_bit_hash, const DataTypes & argument_types, const Array & par<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionUniq<|fim_suffix|> use_64_bit_hash, const DataTypes & argument_types, const Array & params);
}
<|fim_middle|>Combined.h>
namespace DB
{
template AggregateFunctionPtr createAggregateFunctionWithHashType<14>(bool<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>bit_hash, const DataTypes & argument_types, const Array & params);
}
<|fim_prefix|>#inc<|fim_middle|>lude <AggregateFunctions/AggregateFunctionUniqCombined.h>
namespace DB
{
template AggregateFunctionPtr createAggregateFunctionWithHashType<15>(bool use_64_<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions<|fim_suffix|>ams);
}
<|fim_middle|>/AggregateFunctionUniqCombined.h>
namespace DB
{
template AggregateFunctionPtr createAggregateFunctionWithHashType<16>(bool use_64_bit_hash, const DataTypes & argument_types, const Array & par<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>e AggregateFunctionPtr createAggregateFunctionWithHashType<17>(bool use_64_bit_hash, const DataTypes & argument_types, const Array & params);
}
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionUniqCombined.h>
name<|fim_middle|>space DB
{
templat<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>(bool use_64_bit_hash, const DataTypes & argument_types, const Array & params);
}
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionUniqCombined.h>
namespace DB
{
t<|fim_middle|>emplate AggregateFunctionPtr createAggregateFunctionWithHashType<18><|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ol use_64_bit_hash, const DataTypes & argument_types, const Array & params);
}
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionUniqCombined.h>
namespace DB
{
t<|fim_middle|>emplate AggregateFunctionPtr createAggregateFunctionWithHashType<19>(bo<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> const DataTypes & argument_types, const Array & params);
}
<|fim_prefix|>#include <AggregateFunc<|fim_middle|>tions/AggregateFunctionUniqCombined.h>
namespace DB
{
template AggregateFunctionPtr createAggregateFunctionWithHashType<20>(bool use_64_bit_hash,<|endoftext|> | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <Common/FieldVisitorConvertToNumber.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDate32.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Common/typeid_cast.h>
#include <Common/assert_cast... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>tionDocumentation::Description corrMatrix_description = R"(
Computes the correlation matrix over N variables.
)";
FunctionDocumentation::Syntax corrMatrix_syntax = "corrMatrix(x1[, x2, ...])";
FunctionDocumentation::Arguments corrMatrix_arguments = {
{"x1[, x2, ...]", "One or more para... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionTTest.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Moments.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
extern co... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <base/range.h>
#include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypesNumber.h>
#includ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>CT argMin(a, b), min(b) FROM test;
)",
R"(
ββargMin(a, b)ββ¬βmin(b)ββ
β a β 0 β
ββββββββββββββββ΄βββββββββ
)"
},
{
"Using Tuple in arguments",
R"(
SELECT argMin(a, (b, a)), min(tuple(b, a)) FROM test;
)",
R"(
ββargMin(a, tuple(b... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/SingleValueData.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int NOT_IMPLEMENTED;
}
namespace
{
tem... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/Combinators/AggregateFunctionArray.h>
#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <Common/typeid_cast.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int TOO_FEW_ARGUMENTS_FOR_FUNCTION;
extern const ... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <Columns/ColumnArray.h>
#include <Common/assert_cast.h>
#include <DataTypes/DataTypeArray.h>
#include <AggregateFunctions/IAggregateFunction.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int SIZES_OF_ARRAYS_DONT_MATCH;
extern... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>egateFunctionCombinatorPtr AggregateFunctionCombinatorFactory::tryFindSuffix(const std::string & name) const
{
/// O(N) is ok for just a few combinators.
for (const auto & suffix_value : dict)
if (endsWith(name, suffix_value.name))
return suffix_value.combinator_ptr;
return... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> Documentation documentation;
bool operator==(const CombinatorPair & rhs) const { return name == rhs.name; }
/// Sort by the length of the combinator name for proper tryFindSuffix()
/// for combiners with common prefix (i.e. "State" and "SimpleState").
bool operator<(const... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <AggregateFunctions/SingleValueData.h>
#include <Common/memory.h>
namespace DB
{
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
}
namespace
{
st... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> arguments;
}
AggregateFunctionPtr transformAggregateFunction(
const AggregateFunctionPtr & nested_function,
const AggregateFunctionProperties &,
const DataTypes & arguments,
const Array & params) const override
{
AggregateFunctionPtr res;
if (a... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/Combinators/AggregateFunctionNull.h>
#include <AggregateFunctions/KeyHolderHelpers.h>
#include <IO/ReadHelpersArena.h>
#include <Common/HashTable/HashMap.h>
#include <Common/HashTable/HashSet.h>
#include <Common/... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <AggregateFunctions/Combinators/AggregateFunctionForEach.h>
#include <Common/typeid_cast.h>
namespace DB
{
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
}
namespace
{
class AggregateFuncti... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ted_func->insertResultInto(nested_state, elems_to, arena);
nested_state += nested_size_of_data;
}
offsets_to.push_back(offsets_to.back() + state.dynamic_array_size);
}
void insertResultInto(AggregateDataPtr __restrict place, IColumn & to, Arena * arena) const override... | fim | ClickHouse/ClickHouse | c |
#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <AggregateFunctions/Combinators/AggregateFunctionIf.h>
#include <AggregateFunctions/Combinators/AggregateFunctionNull.h>
#include <Common/VectorWithMemoryTracking.h>
#include <DataTypes/DataTypeTuple.h>
#include <absl/container/in... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <Columns/ColumnsNumber.h>
#include <Common/assert_cast.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include "config.h"
#if USE_EMBEDDED_COMPILER
# include <llvm/IR/IRBuilder.h>
# include <DataTypes/Native.h>
#endif
namespace DB
{
struct Settings;
namespace ErrorC... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <unordered_map>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnFixedString.h>
#include <Columns/ColumnMap.h>
#include <Columns/Column... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <AggregateFunctions/Combinators/AggregateFunctionMerge.h>
#include <Columns/ColumnAggregateFunction.h>
#include <DataTypes/DataTypeAggregateFunction.h>
namespace DB
{
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_AR... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <DataTypes/DataTypeAggregateFunction.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <Common/typeid_cast.h>
#include <Common/assert_cast.h>
namespace DB
{
struct Settings;
/** Not an aggregate function, but an adapter of aggregate functions,
* Aggregate function... | fim | ClickHouse/ClickHouse | c |
#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <AggregateFunctions/Combinators/AggregateFunctionNull.h>
#include <AggregateFunctions/Combinators/AggregateFunctionSimpleState.h>
#include <AggregateFunctions/Combinators/AggregateFunctionState.h>
#include <AggregateFunctions/Aggre... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnNullable.h>
#include <Columns/ColumnsCommon.h>
#include <DataTypes/DataTypeNullable.h>
#include <DataTypes/DataTypesNumber.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <Common/VectorWithMemoryT... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>CombinatorOrFill>(Kind::OrNull), Documentation{
.description = "Applied as a suffix to an aggregate function name (e.g. `sumOrNull`), it returns NULL instead of the default value when there is nothing to aggregate.",
.syntax = "<aggregate_function>OrNull",
.related = {"OrDefault"}}... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> {
// -OrDefault
return inner_type_;
}
}
template <bool merge>
void insertResultIntoImpl(
AggregateDataPtr __restrict place,
IColumn & to,
Arena * arena) const
{
if (place[size_of_data])
{
if constexpr ... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> return std::make_shared<AggregateFunctionResample<UInt64>>(
nested_function,
begin,
end,
step,
arguments,
params);
}
if (which.isNativeInt() || which.isEnum() || which.isInterval())
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnArray.h>
#include <DataTypes/DataTypeArray.h>
#include <Common/assert_cast.h>
#include <Common/memory.h>
#include <base/arithmeticOverflow.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const ... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/Combinators/AggregateFunctionC<|fim_suffix|>nctionCombinatorSimpleState(AggregateFunctionCombinatorFactory & factory);
void registerAggregateFunctionCombinatorSimpleState(AggregateFunctionCombinatorFactory & factory)
{
factory.registerCombinator(std::make_shared<AggregateF... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>catesMemoryInArena() const override { return nested_func->allocatesMemoryInArena(); }
AggregateFunctionPtr getNestedFunction() const override { return nested_func; }
};
}
<|fim_prefix|>#pragma once
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/IAggregateFunct... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>uments;
}
AggregateFunctionPtr transformAggregateFunction(
const AggregateFunctionPtr & nested_function,
const AggregateFunctionProperties &,
const DataTypes & arguments,
const Array & params) const override
{
return std::make_shared<AggregateFunctionSt... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> return nested_func->allocatesMemoryInArena();
}
AggregateFunctionPtr getNestedFunction() const override { return nested_func; }
};
}
<|fim_prefix|>#pragma once
#include <DataTypes/DataTypeAggregateFunction.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnAggrega... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>the parameters for nested function.
* If arguments are not suitable for combined function, throw an exception.
*/
virtual Array transformParameters(const Array & parameters) const
{
return parameters;
}
/** Create combined aggregate function (ex: sumIf)
* from n... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>nline void CrossTabAggregateData::merge(const CrossTabPhiSquaredWindowData & other)
{
if (other.count == 0)
return;
count += other.count;
for (size_t i = 0; i < other.a_hash_by_index.size(); ++i)
count_a[other.a_hash_by_index[i]] += other.a_marginal_count[i];
for (size_t... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <base/types.h>
/**
* An encoded DDSketch comprises multiple contiguous blocks (sequences of bytes).
* Each block is prefixed with a flag that indicates what the block contains and how the data is encoded in the block.
* A flag is a single byte, which itself contains two parts... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <cmath>
#include <limits>
#include <base/types.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <Common/Exception.h>
namespace DB
{
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
extern const int INCORRECT_DATA;
}
class DDSketchLogarithmicMapping
{
pu... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> int index_delta = 0;
readVarInt(index_delta, buf);
Float64 bin_count = 0;
readFloatBinary(bin_count, buf);
if (!std::isfinite(bin_count) || bin_count < 0)
throw Exception(ErrorCodes::INCORRECT_DATA, "Invalid bin c... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>ower_bound;
if (!std::isfinite(in_lower_bound) || !std::isfinite(in_upper_bound) || in_size <= 0)
continue;
int new_index = new_mapping->key(in_lower_bound);
// Distribute counts to new bins
static constexpr int max_rema... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <Common/Exception.h>
#include <Core/Field.h>
#include <DataTypes/IDataType.h>
namespace DB
{
struct Se<|fim_suffix|>GREGATE_FUNCTION_DOESNT_ALLOW_PARAMETERS, "Aggregate function {} cannot have parameters", name);
}
inline void assertUnary(const std::string & name, const DataTypes... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>ch.idx == TypeIndex::Time64) return new AggregateFunctionTemplate<Time64>(args...);
}
return nullptr;
}
template <template <typename, typename> class AggregateFunctionTemplate, typename Data, typename... TArgs>
static IAggregateFunction * createWithDecimalType(const IDataType & argument_type, TAr... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>)
return;
merge(places[0], places[i], thread_pool, is_cancelled, arena);
}
}
void IAggregateFunction::insertMergeResultInto(AggregateDataPtr __restrict place, IColumn & to, Arena * arena) const
{
if (isState())
throw Exception(
ErrorCodes::NOT_IMPLEMENTED, ... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <AggregateFunctions/IAggregateFunction_fwd.h>
#include <Columns/ColumnSparse.h>
#include <Columns/ColumnsNumber.h>
#include <Core/ColumnNumbers.h>
#include <Core/ColumnsWithTypeAndName.h>
#include <Core/Field.h>
#include <Core/IResolvedFunction.h>
#include <Core/ValuesWithType.h>
#include <Interp... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>on/VectorWithMemoryTracking.h>
namespace DB
{
using AggregateDataPtr = char *;
using AggregateDataPtrs = VectorWithMemoryTracking<AggregateDataPtr>;
using ConstAggregateDataPtr = const char *;
class IAggregateFunction;
using AggregateFunctionPtr = std::shared_ptr<const IAggregateFunction>;
}
<|fim_prefi... | fim | ClickHouse/ClickHouse | c |
#pragma once
#include <Columns/IColumn.h>
#include <Common/HashTable/HashTableKeyHolder.h>
#include <IO/ReadBufferFromString.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int INCORRECT_DATA;
}
template <bool is_plain_column = false>
static auto getKeyHolder(const IColumn & column, size_... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <cfloat>
#include <cmath>
#include <numeric>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <boost/math/distributions/fisher_f.hpp>
#include <boost/math/distributions/normal.hpp>
#include <boost/math/distributions/students_t.hpp>
#include <Common/VectorWithMemoryT... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <base/types.h>
#include <base/sort.h>
#include <Common/HashTable/HashMap.h>
#include <IO/ReadBuffer.<|fim_suffix|>istinct bfloat16 values increases just by 1280).
*
* Then calculate quantile from the histogram.
*
* This sketch is very simple and rough. Its relative precisio... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <base/types.h>
#include <base/sort.h>
#include <AggregateFunctions/DDSketch.h>
#include <IO/ReadBuffer.h>
#include <IO/WriteBuffer.h>
namespace DB
{
/**
* A DDSketch is a fully-mergeable quantile sketch with relative-error guarantees. That is, for any value x,
* the value retu... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <IO/ReadBuffer.h>
#include <IO/VarInt.h>
#include <IO/WriteBuffer.h>
#include <Common/NaNUtils.h>
#include <Common/PODArray.h>
#include <base/extended_types.h>
#include <base/sort.h>
#include <base/types.h>
#define QUANTILE_EXACT_MAX_ARRAY_SIZE 1'000'000'000
namespace DB
{
struct... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <cmath>
#include <Common/Exception.h>
#include <Common/RadixSort.h>
#include <Common/PODArray.h>
#include <Core/AccurateComparison.h>
#include <IO/WriteBuffer.h>
#include <IO/ReadBuffer.h>
#include <IO/VarInt.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern co... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <IO/ReadBuffer.h>
#include <IO/WriteBuffer.h>
#include <Common/HashTable/Hash.h>
#include <Common/PODArray.h>
#include <base/defines.h>
#include <base/sort.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int INCORRECT... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>]");
}
iota(permutation.data(), size, Permutation::value_type(0));
::sort(permutation.begin(), permutation.end(), [this] (size_t a, size_t b) { return levels[a] < levels[b]; });
}
};
}
<|fim_prefix|>#pragma once
#include <vector>
#include <base/sort.h>
#include <Common/Fi... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <limits>
#include <algorithm>
#include <base/types.h>
#include <base/sort.h>
#include <IO/ReadBuffer.h>
#include <IO/ReadBufferFromString.h>
#include <IO/WriteBufferFromString.h>
#include <IO/Operators_pcg_random.h>
#include <Common/PODArray.h>
#include <Common/NaNUtils.h>
#include ... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> skip_degree - 1). We store an element only if (hash & skip_mask) == 0.
/// For example, if skip_degree==0 then skip_mask==0 means we store each element;
/// if skip_degree==1 then skip_mask==0b0001 means we store one per 2 elements in average;
/// if skip_degree==4 then skip_mask==0b1111 mean... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/SingleValueData.h>
#include <Columns/ColumnString.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <Common/Arena.h>
#include <Common/NaNUtils.h>
#include <Common/assert_cast.h>
#include <Common/findExtreme.h>
#if USE_EMBEDDED_COMPILER
# include <DataTyp... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnDecimal.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <base/AlignedUnion.h>
namespace DB
{
class Arena;
class ReadBuffer;
struct Settings;
cl... | fim | ClickHouse/ClickHouse | c |
#pragma once
#include <numeric>
#include <algorithm>
#include <utility>
#include <base/sort.h>
#include <Common/ArenaAllocator.h>
#include <Common/iota.h>
#include <IO/ReadHelpers.h>
#include <Common/VectorWithMemoryTracking.h>
namespace DB
{
struct Settings;
/// Because ranks are adjusted, we have to store each... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include "config.h"
#if USE_DATASKETCHES
#include <boost/noncopyable.hpp>
#include <memory>
#include <theta_sketch.hpp>
#include <theta_union.hpp>
#include <theta_intersection.hpp>
#include <theta_a_not_b.hpp>
#include <Common/Exception.h>
namespace DB
{
namespace ErrorCodes
{
exte... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/TimeSeries/AggregateFunctionLast2Samples.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <DataTypes/IDataType.h>
#include <Core/Settings.h>
namespace DB
{
struct Sett... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <cstddef>
#include <cstring>
#include <memory>
#include <type_traits>
#include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypesDecimal.h>
#include <DataTypes/DataTypeTuple.h>
#include <Columns/ColumnVector.h>
#inclu... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> res = createWithValueType<false, Float32>(name, argument_types);
}
else
{
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
"Illegal type {} of 2nd argument (value) for aggregate function {}", value_type->getName(), name);
}
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ortAndRemoveDuplicates();
for (size_t i = 0; i != data.size; ++i)
{
const auto & element = data.elements[i];
timestamps_to.insert(element.timestamp);
values_to.insert(element.value);
}
offsets_to.push_back(offsets_to.back() + data.size)... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>kets.size(), buf);
for (const auto & bucket : data(place)->buckets)
{
writeBinaryLittleEndian(bucket.first, buf);
FunctionImpl::serializeBucket(bucket.second, buf);
}
}
void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::opti... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>).first, current_timestamp))
{
samples_in_window.pop_front();
}
fillResultValue(
samples_in_window,
values[i],
nulls[i]);
}
}
static constexpr UInt16 FORMAT_VERSION = 1;
};
}
<|fim_prefix... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>&& static_cast<Float64>(samples_in_window.front().second) < removed_value)
accumulated_resets_in_window -= removed_value;
}
fillResultValue(
current_timestamp,
samples_in_window,
accumulated_resets_in_window,
... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesInstantValue.h>
#include <AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesExtrapolated... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>/// If the oldest of last 2 samples is within the window, we can calculate the rate or delta
if (last_2_samples.filled == 2 && !Base::isSampleOutOfWindow(last_2_samples.timestamps[1], current_timestamp))
{
fillResultValue(last_2_samples.timestamps[0], last_2_samples... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>SumInc(Float64 inc, Float64 sum, Float64 c) const
{
Float64 new_sum = sum + inc;
// Using Neumaier improvement, swap if next term larger than sum.
if (std::abs(sum) >= std::abs(inc))
c += (sum - new_sum) + inc;
else
c += (inc - new_sum) + sum;
... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>;
/// Fill all timestamps with zeros to indicate missing values
timestamps.assign(Base::bucket_count, 0);
std::fill(nulls, nulls + Base::bucket_count, 1);
/// Fill the data for existing buckets
for (const auto & bucket : Base::data(place)->buckets)
{
... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/UniqCombinedBiasData.h>
namespace DB
{
struct Settings;
namespace
{
const UniqCombinedBiasData::InterpolatedData raw_estimates
{{
99791.8496
,101386.91930000001
,105450.95623333333
,108128.01393333334
,110851.10286666667
,113620.01383333335
,1164... | fim | ClickHouse/ClickHouse | cpp |
#pragma once
#include <array>
namespace DB
{
struct Settings;
/** Data for HyperLogLogBiasEstimator in the uniqCombined function.
* The development plan is as follows:
* 1. Assemble ClickHouse.
* 2. Run the script src/src/scripts/gen-bias-data.py, which returns one array for getRawEstimates()
* and anoth... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>M_BUCKETS; ++i)
runner.enqueueAndKeepTrack(thread_func, Priority{});
}
catch (...)
{
is_cancelled->store(true);
throw;
}
runner.waitForAllToFinishAndRethrowFirstE... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>egion())
return false;
return true;
};
const DataTypeTuple * single_argument_as_tuple = nullptr;
if (argument_types.size() == 1)
single_argument_as_tuple = typeid_cast<const DataTypeTuple *>(argument_types[0].get());
if (single_argument_as_tuple)
r... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>rt_cast<const ColumnTuple *>(columns[0])->getColumns();
const auto * column = tuple_columns.data();
const auto * columns_end = column + num_args;
{
auto value = column->get()->getDataAt(row_num);
hash = CityHash_v1_0_2::CityHash64(value.data(), value.size(... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <math.h>
#include <base/defines.h>
#include <base/types.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <IO/VarInt.h>
#include <Common/HashTable/HashTableAllocator.h>
#include <Common/HashTable/Hash.h>
/** Approximate calculation of anything, as usual, is c... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <Interpreters/WindowDescription.h>
#include <Common/AlignedBuffer.h>
#include <Common/VectorWithMemoryTracking.h>
namespace DB
{
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
}
class WindowTransform;
// Interface for tru... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <algorithm>
#include <type_traits>
#include <utility>
#include <iostream>
#include <pcg_random.hpp>
#include <Columns/ColumnVector.h>
#include <Common/ArenaAllocator.h>
#include <Common/RadixSort.h>
#include <Columns/ColumnArray.h>
#include <Examples/clickhouse_examples.h>
using namespace DB;... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>d::cout << tdigest.get(0.5) << "\n";
WriteBufferFromOwnString wb;
tdigest.serialize(wb);
QuantileTDigest<float> other;
ReadBufferFromString rb{wb.str()};
other.deserialize(rb);
std::cout << other.get(0.5) << "\n";
return 0;
}
<|fim_prefix|>#include <AggregateFunctions/Quantile... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <base/types.h>
#include <IO/ReadBufferFromMemory.h>
#include <IO/ReadHelpers.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/DataTypeAggregateFunction.h>
#include <Common/Arena.h>
#include <Common/MemoryTracker.h>
#include <Common/CurrentThread.h>
#include <Common/ThreadStatus.h>... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ook like aggregate function name in {}.",
aggregate_function_name_with_params, error_context);
ParserExpressionList params_parser(false);
ASTPtr args_ast = parseQuery(params_parser,
parameters_str.data(), parameters_str.data() + parameters_str.size(),
"para... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> Array & aggregate_function_parameters,
const std::string & error_context,
ContextPtr context);
}
<|fim_prefix|>#pragma once
#include <Interpreters/Context_fwd.h>
#include <Parsers/IAST_fwd.h>
namespace DB
{
struct Array;
Array getAggregateFunctionParametersArray(
const ASTPtr & expressi... | fim | ClickHouse/ClickHouse | c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.