mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed code; added a test
This commit is contained in:
parent
2438a510b0
commit
49e57c555d
@ -153,7 +153,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionVarSampImpl
|
struct AggregateFunctionVarSampImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "varSamp";
|
static constexpr auto name = "varSampStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 m2, UInt64 count)
|
static inline Float64 apply(Float64 m2, UInt64 count)
|
||||||
{
|
{
|
||||||
@ -168,7 +168,7 @@ struct AggregateFunctionVarSampImpl
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionStdDevSampImpl
|
struct AggregateFunctionStdDevSampImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "stddevSamp";
|
static constexpr auto name = "stddevSampStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 m2, UInt64 count)
|
static inline Float64 apply(Float64 m2, UInt64 count)
|
||||||
{
|
{
|
||||||
@ -180,7 +180,7 @@ struct AggregateFunctionStdDevSampImpl
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionVarPopImpl
|
struct AggregateFunctionVarPopImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "varPop";
|
static constexpr auto name = "varPopStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 m2, UInt64 count)
|
static inline Float64 apply(Float64 m2, UInt64 count)
|
||||||
{
|
{
|
||||||
@ -197,7 +197,7 @@ struct AggregateFunctionVarPopImpl
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionStdDevPopImpl
|
struct AggregateFunctionStdDevPopImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "stddevPop";
|
static constexpr auto name = "stddevPopStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 m2, UInt64 count)
|
static inline Float64 apply(Float64 m2, UInt64 count)
|
||||||
{
|
{
|
||||||
@ -405,7 +405,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionCovarSampImpl
|
struct AggregateFunctionCovarSampImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "covarSamp";
|
static constexpr auto name = "covarSampStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 co_moment, UInt64 count)
|
static inline Float64 apply(Float64 co_moment, UInt64 count)
|
||||||
{
|
{
|
||||||
@ -420,7 +420,7 @@ struct AggregateFunctionCovarSampImpl
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionCovarPopImpl
|
struct AggregateFunctionCovarPopImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "covarPop";
|
static constexpr auto name = "covarPopStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 co_moment, UInt64 count)
|
static inline Float64 apply(Float64 co_moment, UInt64 count)
|
||||||
{
|
{
|
||||||
@ -437,7 +437,7 @@ struct AggregateFunctionCovarPopImpl
|
|||||||
*/
|
*/
|
||||||
struct AggregateFunctionCorrImpl
|
struct AggregateFunctionCorrImpl
|
||||||
{
|
{
|
||||||
static constexpr auto name = "corr";
|
static constexpr auto name = "corrStable";
|
||||||
|
|
||||||
static inline Float64 apply(Float64 co_moment, Float64 left_m2, Float64 right_m2, UInt64 count)
|
static inline Float64 apply(Float64 co_moment, Float64 left_m2, Float64 right_m2, UInt64 count)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <Functions/FunctionHelpers.h>
|
#include <Functions/FunctionHelpers.h>
|
||||||
#include <Functions/IFunctionImpl.h>
|
#include <Functions/IFunctionImpl.h>
|
||||||
#include <Common/thread_local_rng.h>
|
#include <Common/thread_local_rng.h>
|
||||||
|
#include <common/unaligned.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
@ -78,7 +79,7 @@ public:
|
|||||||
pos += sizeof(UInt64)) // We have padding in column buffers that we can overwrite.
|
pos += sizeof(UInt64)) // We have padding in column buffers that we can overwrite.
|
||||||
{
|
{
|
||||||
UInt64 rand = thread_local_rng();
|
UInt64 rand = thread_local_rng();
|
||||||
*reinterpret_cast<UInt64 *>(data_to_ptr + pos) = rand;
|
unalignedStore<UInt64>(data_to_ptr + pos, rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
data_to[offset + length] = 0;
|
data_to[offset + length] = 0;
|
||||||
|
1
tests/queries/0_stateless/01276_random_string.reference
Normal file
1
tests/queries/0_stateless/01276_random_string.reference
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
1
tests/queries/0_stateless/01276_random_string.sql
Normal file
1
tests/queries/0_stateless/01276_random_string.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
SELECT DISTINCT c > 30000 FROM (SELECT arrayJoin(arrayMap(x -> reinterpretAsUInt8(substring(randomString(100), x + 1, 1)), range(100))) AS byte, count() AS c FROM numbers(100000) GROUP BY byte ORDER BY byte);
|
Loading…
Reference in New Issue
Block a user