mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed "generateRandom" function for Date type #9973
This commit is contained in:
parent
20dcc4decd
commit
3215257a90
@ -205,7 +205,10 @@ ColumnPtr fillColumnWithRandomData(
|
|||||||
{
|
{
|
||||||
auto column = ColumnUInt16::create();
|
auto column = ColumnUInt16::create();
|
||||||
column->getData().resize(limit);
|
column->getData().resize(limit);
|
||||||
fillBufferWithRandomData(reinterpret_cast<char *>(column->getData().data()), limit * sizeof(UInt16), rng);
|
|
||||||
|
for (size_t i = 0; i < limit; ++i)
|
||||||
|
column->getData()[i] = rng() % (DATE_LUT_MAX_DAY_NUM + 1); /// Slow
|
||||||
|
|
||||||
return column;
|
return column;
|
||||||
}
|
}
|
||||||
case TypeIndex::UInt32: [[fallthrough]];
|
case TypeIndex::UInt32: [[fallthrough]];
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
100 4456446406473339606
|
@ -0,0 +1,5 @@
|
|||||||
|
DROP TABLE IF EXISTS mass_table_117;
|
||||||
|
CREATE TABLE mass_table_117 (`dt` Date, `site_id` Int32, `site_key` String) ENGINE = MergeTree(dt, (site_id, site_key, dt), 8192);
|
||||||
|
INSERT INTO mass_table_117 SELECT * FROM generateRandom('`dt` Date,`site_id` Int32,`site_key` String', 1, 10, 2) LIMIT 100;
|
||||||
|
SELECT count(), sum(cityHash64(*)) FROM mass_table_117;
|
||||||
|
DROP TABLE mass_table_117;
|
Loading…
Reference in New Issue
Block a user