text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>ReloadMode reload_mode) override;
bool exists(const UUID & id) const override;
bool isBackupAllowed() const override { return backup_allowed; }
private:
void parseFromConfig(const Poco::Util::AbstractConfiguration & config);
std::optional<UUID> findImpl(AccessEntityType type, const Stri... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>rofile_element;
profile_element.parent_profile = profile_id;
user->settings.push_back(std::move(profile_element));
}
/// Fill list of allowed hosts.
const auto networks_config = user_config + ".networks";
if (config.has(networks_config))
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>til::AbstractConfiguration & config,
const std::unordered_set<UUID> & allowed_parent_profile_ids) const;
static UUID generateID(AccessEntityType type, const String & name);
static UUID generateID(const IAccessEntity & entity);
static std::unordered_set<UUID> getAllowedIDs(
co... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <Access/AccessControl.h>
#include <Access/ViewDefinerDependencies.h>
#include <Access/User.h>
#include <Interpreters/Context.h>
#include <mutex>
namespace DB
{
std::unique_ptr<ViewDefinerDependencies> ViewDefinerDependencies::global_instance;
std::once_flag ViewDefinerDependencies::instance_f... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <Interpreters/StorageID.h>
#include <memory>
#include <mutex>
#include <string>
#include <unorde<|fim_suffix|>using String = String;
using ViewSet = std::unordered_set<StorageID, StorageID::DatabaseAndTableNameHash, StorageID::DatabaseAndTableNameEqual>;
/// Get the global... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <mutex>
#include <Access/ZooKeeperReplicator.h>
#include <Access/AccessEntityIO.h>
#include <Access/AccessChangesNotifier.h>
#include <Common/setThreadName.h>
#include <Common/ZooKeeper/KeeperException.h>
#include <Common/escapeForFileName.h>
#include <Common/logger_useful.h>
#include <Common/Th... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ccessEntityType type, const String & name) const;
std::vector<UUID> findAllEntities(AccessEntityType type) const;
AccessEntityPtr readEntity(const UUID & id, bool throw_if_not_exists) const;
/// Check if entity exists in ZooKeeper
bool exists(const UUID & id) const;
/// Get ZooKeeper... | fim | ClickHouse/ClickHouse | c |
#include <iostream>
#include <Poco/ConsoleChannel.h>
#include <Poco/Logger.h>
#include <Poco/AutoPtr.h>
#include <Common/Exception.h>
#include <Access/KerberosInit.h>
#include <Examples/clickhouse_examples.h>
/** The example demonstrates using of kerberosInit function to obtain and cache Kerberos ticket-granting ticke... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>td::string_view full_name, F && f)
{
if (full_name.starts_with(MERGE_TREE_SETTINGS_PREFIX))
{
std::string_view short_name = static_cast<std::string_view>(full_name).substr(MERGE_TREE_SETTINGS_PREFIX.size());
if (MergeTreeSettings::hasBuiltin(short_name)) // Check is required becaus... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>lt", "foo_3"));
}
<|fim_prefix|>#include <gtest/gtest.h>
#include <Access/AccessRights.h>
#include <IO/WriteBufferFromString.h>
using namespace DB;
namespace {
/// Partial copy of ContextAccess::addImplicitAccessRights
AccessFlags addImplicitPrivileges(AccessFlags flags,
const AccessFlags & /*min_f... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ype::SELECT, "te"));
}
TEST(AccessRights, MultipleAccessTypesPartialRevoke)
{
AccessRights root;
root.grant(AccessType::SELECT);
root.grant(AccessType::INSERT);
root.revoke(AccessType::SELECT, "readonly");
root.revoke(AccessType::INSERT, "readwrite");
// SELECT
ASSERT_TRUE(ro... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> + ".sql");
writeEntityToFile(path_a, *user_a);
auto user_b = std::make_shared<User>();
user_b->setName("alice");
UUID id_b = UUIDHelpers::generateV4();
auto path_b = std::filesystem::path(dir) / (toString(id_b) + ".sql");
writeEntityToFile(path_b, *user_b);
/// Make `path_a`... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <gtest/gtest.h>
#include <Access/ReplicatedAccessStorage.h>
#include <Access/AccessChangesNotifier.h>
using namespace DB;
namespace DB
{
namespace ErrorCodes
{
extern const int NO_ZOOKEEPER;
}
}
TEST(ReplicatedAccessStorage, ShutdownWithFailedStartup)
{
auto get_zk = []()
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <Access/AccessControl.h>
#include <Access/UsersConfigAccessStorage.h>
#include <Access/User.h>
#include <Common/Exception.h>
#include <Poco/Util/XMLConfiguration.h>
#include <gtest/gtest.h>
#include <sstream>
using namespace DB;
namespace
{
Poco::AutoPtr<Poco::Util::XMLConfiguration> create... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <memory>
#include <random>
#include <DataTypes/DataTypesNumber.h>
#include <Common/thread_local_rng.h>
#include <IO/ReadBuffer.h>
#include <IO/WriteBuffer.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
namespace DB
{
struct Settin... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <Columns/ColumnTuple.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeTuple.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/Moments.h>
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/SingleValueData.h>
#include <DataTypes/DataTypeFixedString.h>
#include <IO/WriteHelpers.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
}
namespace
{
template <typename Da... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> {
data(place).read(buf, *serialization, result_type, arena);
}
bool allocatesMemoryInArena() const override { return singleValueTypeAllocatesMemoryInArena(result_type->getTypeId()); }
void insertResultInto(AggregateDataPtr __restrict place, IColumn & to, Arena *) const override
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>FunctionSingleValueRespectNulls<true>(name, argument_types, parameters, settings));
}
AggregateFunctionPtr createAggregateFunctionAnyLastRespectNulls(
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings * settings)
{
return AggregateFunctionPtr(cre... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <memory>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionAvg.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/DataTypeTime64.h>
namespace ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ator_ptr)->setAlignment(llvm::Align(alignof(Numerator)));
auto * denominator_type = toNativeType<Denominator>(b);
static constexpr size_t denominator_offset = offsetof(Fraction, denominator);
auto * denominator_ptr = b.CreateConstGEP1_32(b.getInt8Ty(), aggregate_data_ptr, denomina... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|> }
};
FunctionDocumentation::Category category = FunctionDocumentation::Category::AggregateFunction;
FunctionDocumentation::IntroducedIn introduced_in = {20, 1};
FunctionDocumentation documentation = {description, syntax, arguments, parameters, returned_value, examples, introduced_in, cat... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>VALUES (44), (28), (13), (85);
-- Test data:
-- binary decimal
-- 00101100 = 44
-- 00011100 = 28
-- 00001101 = 13
-- 01010101 = 85
SELECT groupBitAnd(num) FROM t;
)",
R"(
-- Result:
-- binary decimal
-- 00000100 = 4
┌─groupBitAnd(num)─┐
│ 4 │
└────────────... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ataPtr __restrict place, ConstAggregateDataPtr rhs, Arena *) const override
{
data(place).merge(data(rhs));
}
void serialize(ConstAggregateDataPtr __restrict place, WriteBuffer & buf, std::optional<size_t> /* version */) const override
{
data(place).serialize(buf);
}
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>rguments",
name);
for (const auto & argument : arguments)
{
if (!WhichDataType(argument).isUInt8())
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "All the arguments of aggregate function {} should be UInt8",
name);
}
return std::mak... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/CrossTab.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <memory>
#include <cmath>
namespace DB
{
namespace
{
struct ContingencyData : CrossTabAggregateData
{
static const char * getName()
{
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> "corr(x, y)";
FunctionDocumentation::Arguments arguments = {
{"x", "First variable.", {"(U)Int*", "Float*"}},
{"y", "Second variable.", {"(U)Int*", "Float*"}}
};
FunctionDocumentation::Parameters parameters = {};
FunctionDocumentation::ReturnedValue returned_value = {"Retu... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/Aggreg<|fim_suffix|>st Array & parameters, const Settings *)
{
assertNoParameters(name, parameters);
if (argument_types.size() > 1)
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Aggregate function {} requires zero or one argument", name);
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> {
/// Return normalized state type: count()
AggregateFunctionProperties properties;
return std::make_shared<DataTypeAggregateFunction>(
AggregateFunctionFactory::instance().get(getName(), NullsAction::EMPTY, {}, {}, properties), DataTypes{}, Array{});
}
void m... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionStatisticsSimple.h>
namespace DB
{
template <typename T1, typename T2> using AggregateFunctionCovar = AggregateFunctionVarianceSimple<StatFuncTwoArg<T1, T2, CovarMoments>>;
void registerAggregateFunc... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/CrossTab.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <memory>
#include <cmath>
namespace DB
{
namespace
{
struct CramersVData : CrossTabAggregateData
{
static const char * getName()
{
r... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>),
{
[](const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
{
assertBinary(name, argument_types);
assertNoParameters(name, parameters);
return std::make_shared<AggregateFunctionCrossTab<CramersVBias... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> place_data->sum += rhs_data->sum;
place_data->last = rhs_data->last;
}
else if (rhs_data->seen && !place_data->seen)
{
// If we're here then the lhs is an empty state and the rhs does have some state, so
// we'll just take that state.
... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <DataTypes/DataTypesNumber.h>
#include <AggregateFunctions/IAggregateFunction.h>
namespace DB
{
namespac... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> if (if_argument_pos >= 0 || row_begin != 0 || row_end != columns[0]->size())
IAggregateFunctionDataHelper::addBatchSinglePlace(row_begin, row_end, place, columns, arena, if_argument_pos);
/// Optimization for case when we add all rows from the column into single place.
/// In ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>s())
data[path].insert(typed_paths_type_names.at(path));
for (const auto & [path, dynamic_column] : column.getDynamicPathsPtrs())
{
/// Add dynamic path only if it has at least one non-null value.
/// getNumberOfDefaultRows for Dynamic column is O(1).
... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <Common/HashTable/HashMap.h>
#include <Common/NaNUtils.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/UniqVariadicHash.h>
#includ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ace, const IColumn ** columns, size_t row_num, Arena *) const override
{
const auto & column = columns[0];
resetBuffersIfNeeded(place);
DataTypePtr type_ptr = argument_types[0];
SerializationInfoPtr info = type_ptr->getSerializationInfo(*column);
Serialization... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <Common/ExponentiallySmoothedCounter.h>
#include <Common/FieldVisitorConvertToNumber.h>
#include <DataTypes/DataTypesNumber.h>
#include <IO/Re... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionNothing.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Combinators/AggregateFunctionCombinatorFactory.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypesNumber.h>
#... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>egate function to other based on NullsAction
/// Registers them both ways:
/// SOURCE + RESPECT NULLS will be transformed to TARGET
/// TARGET + IGNORE NULLS will be transformed to SOURCE
void registerNullsActionTransformation(const String & source_ignores_nulls, const String & target_resp... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <Common/HashTable/HashMap.h>
#include <Common/SymbolIndex.h>
#include <Core/Settings.h>
#include <Columns/ColumnArray.h>
#include <Columns/Col... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> Memory;
INSERT INTO test_data VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
SELECT kurtSamp(x) FROM test_data;
)",
R"(
┌────────kurtSamp(x)─┐
│ 1.4383636363636365 │
└────────────────────┘
)"
}
};
FunctionDocumentation::IntroducedIn introduced_in_samp = {20... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/KeyHolderHelpers.h>
#include <Interpreters/Context.h>
#include <Core/ServerSettings.h>
#include <IO/Operators_pcg_random.h>
#include... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypesNumber.h>
#include <Columns/ColumnArray.h>
#include <Common/FieldVisitorToS... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h>
#include <IO/ReadHelpersArena.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDate32.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <Columns/Col... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>(
Calculates the moving average of input values.
:::note
The function uses rounding towards zero.
It truncates the decimal places insignificant for the resulting data type.
:::
)";
FunctionDocumentation::Syntax syntax = R"(
groupArrayMovingAvg(numbers_for_summing)
groupArrayMovingAvg(window_size)... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <base/sort.h>
#include <algorithm>
#include <type_traits>
#include <utility>
#include <Common/ArenaA... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> if (which.idx == TypeIndex::Int16) return new AggregateFunctionTemplate<Int16, Data<Int16>>(std::forward<TArgs>(args)...);
if (which.idx == TypeIndex::Int32) return new AggregateFunctionTemplate<Int32, Data<Int32>>(std::forward<TArgs>(args)...);
if (which.idx == TypeIndex::Int64) return new Ag... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>n two objects and convert the result to UInt32 array. Return number of result elements.
* The upper 16 bits of each element in the result use base instead of container_id.
*/
inline UInt16 container_and_to_uint32_array( /// NOLINT
const RoaringBitmapWithSmallSet * rhs, const UInt16 &... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionGroupConcat.h>
#include <DataTypes/DataTypeString.h>
#include <Columns/ColumnString.h>
#include <Interpreters/castColumn.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
exte... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>, Arena * arena) const override;
void serialize(ConstAggregateDataPtr place, WriteBuffer & buf, std::optional<size_t> version) const override;
void deserialize(AggregateDataPtr place, ReadBuffer & buf, std::optional<size_t> version, Arena * arena) const override;
void insertResultInto(Aggregat... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>e of Int8, Int16, Int32, UInt8, UInt16, UInt32 in BSI");
if (!(second_which.isNativeInt() || second_which.isNativeUInt() || second_which.isNativeFloat()))
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
"The second argument type must be one of In... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>/* version */) const override
{
this->data(place).vector.write(buf);
}
void deserialize(AggregateDataPtr __restrict place, ReadBuffer & buf, std::optional<size_t> /* version */, Arena *) const override
{
this->data(place).init = true;
this->data(place).vector.read(... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <IO/ReadBuffer.h>
#include <IO/WriteBuffer.h>
#include <Common/PODArray.h>
/// Include this last — see the reason inside
#include <AggregateFunctions/AggregateFunctionGroupNumericIndexedVectorDataBSI.h>
namespace DB
{
#define FOR_NUMERIC_INDEXED_VECTOR_INDEX_TYPES(M) \
M(UInt... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <DataTypes/IDataType.h>
#include <Formats/FormatSettings.h>
#include <IO/ReadBuffer.h>
#include <Common/JSONBuilder.h>
#include <Common/MapWithMemoryTracking.h>
#include <Common/SetWithMemoryTracking.h>
#include <Common/VectorWithMemoryTracking.h>
#include <base/demangle.h>
/// In... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeIPv4andIPv6.h>
#include <IO/WriteHelpers.h>
#include <IO/... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>& other, UInt32 max_bins)
{
lower_bound = std::min(lower_bound, other.lower_bound);
upper_bound = std::max(upper_bound, other.upper_bound);
for (size_t i = 0; i < other.size; ++i)
add(other.points[i].mean, other.points[i].weight, max_bins);
}
void write(Wri... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <unordered_set>
#include <AggregateFunctions/Combinators/AggregateFunctionNull.h>
#include <Columns/ColumnsNumber.h>
#include <Common/assert_cast.h>
#include <D... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/StatCommon.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnTuple.h>
#include <Common/Exception.h>
#include <Common/assert_c... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/StatCommon.h>
#include <Columns/ColumnArray.h>
#include <Columns/ColumnTuple.h>
#include <Columns/ColumnVector.h>
#includ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>te * average_gradient[i]) /
((1 - beta1_powered) * (sqrt(average_squared_gradient[i] / (1 - beta2_powered)) + eps));
}
bias += (learning_rate * average_gradient[weights.size()]) /
((1 - beta1_powered) * (sqrt(average_squared_gradient[weights.size()] / (1 - beta2_powered... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnsCommon.h>
#include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeTuple.h>
#include <DataTypes/DataTypesNumber.h>
#include <Common/typeid_... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/StatCommon.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnTuple.h>
#include <Common/assert_cast.h>
#include... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypesNumber.h>
#include <Columns/ColumnsNumber.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
#include <Common/ArenaAllocator.h>
#includ... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>", {"Float*"}},
{"confidence_level", "Confidence level in order to calculate confidence intervals.", {"Float*"}}
};
FunctionDocumentation::ReturnedValue returned_value = {"Returns a tuple with four elements: calculated z-statistic, calculated p-value, calculated confidence-interval-low, ca... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionNothing.h>
#include <AggregateFunctions/FactoryHelpers.h>
namespace DB
{
struct Settings;
void registerAggregateFunctionNothing(AggregateFunctionFactory & factory);
void registerAggregateFunctionNothing(AggregateF... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ed]] char symbol = 0;
readChar(symbol, buf);
if (symbol != '\0')
throw Exception(ErrorCodes::INCORRECT_DATA, "Incorrect state of aggregate function '{}', it should contain exactly one zero byte, while it is {}",
getName(), static_cast<UInt32>(symbol));
}
... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnTuple.h>
#include <Common/assert_cast.h>
#include <Cor<|fim_suffix|>_low, ci_high] = data.getConfidenceIntervals(confidence_level);
auto & column_ci_low = assert_cast<Colu... | fim | ClickHouse/ClickHouse | c |
<|fim_suffix|>vels[indices[i]]);
}
};
template <typename Value, bool float_return> using FuncQuantile = AggregateFunctionQuantile<Value, QuantileReservoirSampler<Value>, NameQuantile, void, std::conditional_t<float_return, Float64, void>, false, false>;
template <typename Value, bool float_return> using FuncQuant... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/QuantilesCommon.h>
#include <Columns/ColumnArray.h>
#include <Columns/ColumnDecimal.h>
#include <DataTypes/D... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileBFloat16Histogram.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Fi... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileBFloat16Histogram.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
namespace DB
{
struct Settings;... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ggregateFunctionQuantile<FuncQuantilesDD>, {}, properties });
/// 'median' is an alias for 'quantile'
factory.registerAlias("medianDD", NameQuantileDD::name);
}
}
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileDD.h>
#include <Aggregat... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>uantileDeterministic(AggregateFunctionFactory & factory);
void registerAggregateFunctionsQuantileDeterministic(AggregateFunctionFactory & factory)
{
/// For aggregate functions returning array we cannot return NULL on empty set.
AggregateFunctionProperties properties = { .returns_default_when_only... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileExact.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataT<|fim_suffix|>ategory};
factory.registe... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileExact.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
namespace DB
{
st... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> FunctionDocumentation::Parameters parameters = {
{"level", "Optional. Level of quantile. Constant floating-point number from 0 to 1. We recommend using a `level` value in the range of `[0.01, 0.99]`. Default value: 0.5. At `level=0.5` the function calculates median.", {"Float*"}}
};
Func... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileExact.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
nam... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileExact.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
nam... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/Helpers.h>
#include <Core/Field.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Common/HashTable/HashMap.h>
#include <Com... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|> {
if (data.isCompressed())
data.write(buf);
else
{
/// We can't modify rhs, so copy it and compress
Data data_copy(data);
data_copy.compress();
data_copy.write(buf);
}
}
void deserialize(ReadBuffer & buf... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ateTime"}};
FunctionDocumentation::Examples examples = {
{
"Computing interpolated weighted quantile",
R"(
CREATE TABLE t (
n Int32,
val Int32
) ENGINE = Memory;
INSERT INTO t VALUES (0, 3), (1, 2), (2, 1), (5, 4);
SELECT quantileInterpolatedWeighted(n, val) FROM t;
... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/Helpers.h>
#include <Core/Field.h>
#include <Common/HashTable/HashMap.h>
#include <Common/NaNUtils.h>
#include <numeric>
namespace DB
{
struct Settings;
namespace ErrorCod... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>duced_in = {1, 1};
FunctionDocumentation::Category category = FunctionDocumentation::Category::AggregateFunction;
FunctionDocumentation documentation = {description, syntax, arguments, parameters, returned_value, examples, introduced_in, category};
factory.registerFunction(NameQuantileTDigest... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>igestWeighted::name, {createAggregateFunctionQuantile<FuncQuantileTDigestWeighted>, documentation});
FunctionDocumentation::Description description_quantiles = R"(
Computes multiple approximate [quantiles](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence at different levels simultan... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileTiming.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
namespace DB
{
s... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionQuantile.h>
#include <AggregateFunctions/QuantileTiming.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/Helpers.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <Core/Field.h>
na... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/StatCommon.h>
#include <Columns/ColumnVector.h>
#include <Columns/ColumnTuple.h>
#include <Common/assert_cast.h>
#include <Common/PODArr... | fim | ClickHouse/ClickHouse | cpp |
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <Columns/ColumnArray.h>
#include <Common/assert_cast.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeArray.h>
#include <IO/ReadHelpers... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionStatisticsSimple.h>
namespace DB
{
template <typename T> using AggregateFunctionSecondMoment = AggregateFunctionVarianceSimple<StatFuncOneArg<T, 2>>;
void registerAggregateFunctionsStatisticsSecondMo... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypeArray.h>
#include... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <Core/Settings.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeNullable.h>
#include <DataTypes/DataTypesNumber.h>
#include <IO/ReadBufferFromString.h>
#include <IO/ReadHelpers.h>
#i... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>/ Result is a tuple (k, b) for y = k * x + b equation, solved by least squares approximation.
class AggregateFunctionSimpleLinearRegression final : public IAggregateFunctionDataHelper<
AggregateFunctionSimpleLinearRegressionData,
AggregateFunctionSimpleLinearRegression>
{
public:
AggregateFunc... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/SingleValueData.h>
#include <Columns/ColumnNullable.h>
#include <DataTypes/DataTypeNullable.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
extern const int LOG... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ams.size());
if (params.size() == 3)
{
if (params.at(1).getType() != arguments[0]->getDefault().getType() ||
params.at(2).getType() != arguments[0]->getDefault().getType())
{
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
... | fim | ClickHouse/ClickHouse | cpp |
<|fim_suffix|>ters_stddevSampStable = {};
FunctionDocumentation::Arguments arguments_stddevSampStable = {
{"x", "Values for which to find the square root of sample variance.", {"(U)Int*", "Float*", "Decimal*"}}
};
FunctionDocumentation::ReturnedValue returned_value_stddevSampStable = {"Returns the s... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#pragma once
#include <cmath>
#include <base/arithmeticOverflow.h>
#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/Moments.h>
#include <AggregateFunctions/Helpers.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTyp... | fim | ClickHouse/ClickHouse | c |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionTTest.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Moments.h>
namespace ErrorCodes
{
extern const int BAD_ARGUMENTS;
extern const int NUMBER_OF_ARGUMENTS_DOESN... | fim | ClickHouse/ClickHouse | cpp |
<|fim_prefix|>#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/AggregateFunctionOneSampleTTest.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Moments.h>
#include <boost/math/distributions/students_t.hpp>
namespace ErrorCodes
{
extern const int B... | fim | ClickHouse/ClickHouse | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.