mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge branch 'nikvas0/index' into nikvas0/unique_index
This commit is contained in:
commit
0ea031d188
@ -91,7 +91,7 @@ private:
|
|||||||
String prefix;
|
String prefix;
|
||||||
IAST * elem;
|
IAST * elem;
|
||||||
|
|
||||||
String getID(char c) const override { return "ASTColumnsElement for " + elem->getID(c); };
|
String getID(char c) const override { return "ASTColumnsElement for " + elem->getID(c); }
|
||||||
|
|
||||||
ASTPtr clone() const override
|
ASTPtr clone() const override
|
||||||
{
|
{
|
||||||
|
@ -82,39 +82,36 @@ String MergeTreeMinMaxGranule::toString() const
|
|||||||
|
|
||||||
void MergeTreeMinMaxGranule::update(const Block & block, size_t * pos, size_t limit)
|
void MergeTreeMinMaxGranule::update(const Block & block, size_t * pos, size_t limit)
|
||||||
{
|
{
|
||||||
|
/// TODO: remove logs
|
||||||
Poco::Logger * log = &Poco::Logger::get("minmax_idx");
|
Poco::Logger * log = &Poco::Logger::get("minmax_idx");
|
||||||
|
|
||||||
LOG_DEBUG(log, "update Granule " << parallelogram.size()
|
LOG_DEBUG(log, "update Granule " << parallelogram.size()
|
||||||
<< " pos: "<< *pos << " limit: " << limit << " rows: " << block.rows());
|
<< " pos: "<< *pos << " limit: " << limit << " rows: " << block.rows());
|
||||||
|
|
||||||
size_t rows_read = 0;
|
size_t rows_read = std::min(limit, block.rows() - *pos);
|
||||||
|
|
||||||
for (size_t i = 0; i < index.columns.size(); ++i)
|
for (size_t i = 0; i < index.columns.size(); ++i)
|
||||||
{
|
{
|
||||||
LOG_DEBUG(log, "granule column: " << index.columns[i]);
|
LOG_DEBUG(log, "granule column: " << index.columns[i]);
|
||||||
|
|
||||||
auto column = block.getByName(index.columns[i]).column;
|
const auto & column = block.getByName(index.columns[i]).column;
|
||||||
size_t cur;
|
|
||||||
/// TODO: more effective (index + getExtremes??)
|
Field field_min, field_max;
|
||||||
for (cur = 0; cur < limit && cur + *pos < column->size(); ++cur)
|
column->cut(*pos, rows_read)->getExtremes(field_min, field_max);
|
||||||
|
|
||||||
|
if (parallelogram.size() <= i)
|
||||||
{
|
{
|
||||||
Field field;
|
parallelogram.emplace_back(field_min, true, field_max, true);
|
||||||
column->get(cur + *pos, field);
|
|
||||||
LOG_DEBUG(log, "upd:: " << applyVisitor(FieldVisitorToString(), field));
|
|
||||||
if (parallelogram.size() <= i)
|
|
||||||
{
|
|
||||||
LOG_DEBUG(log, "emplaced");
|
|
||||||
parallelogram.emplace_back(field, true, field, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parallelogram[i].left = std::min(parallelogram[i].left, field);
|
|
||||||
parallelogram[i].right = std::max(parallelogram[i].right, field);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parallelogram[i].left = std::min(parallelogram[i].left, field_min);
|
||||||
|
parallelogram[i].right = std::max(parallelogram[i].right, field_max);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG(log, "res:: ["
|
LOG_DEBUG(log, "res:: ["
|
||||||
<< applyVisitor(FieldVisitorToString(), parallelogram[i].left) << ", "
|
<< applyVisitor(FieldVisitorToString(), parallelogram[i].left) << ", "
|
||||||
<< applyVisitor(FieldVisitorToString(), parallelogram[i].right) << "]");
|
<< applyVisitor(FieldVisitorToString(), parallelogram[i].right) << "]");
|
||||||
rows_read = cur;
|
|
||||||
}
|
}
|
||||||
LOG_DEBUG(log, "updated rows_read: " << rows_read);
|
LOG_DEBUG(log, "updated rows_read: " << rows_read);
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ void MergedBlockOutputStream::writeImpl(const Block & block, const IColumn::Perm
|
|||||||
rows_count += rows;
|
rows_count += rows;
|
||||||
|
|
||||||
{
|
{
|
||||||
/// Filling and writing skip indexes like in IMergedBlockOutputStream::writeData
|
/// Filling and writing skip indices like in IMergedBlockOutputStream::writeData
|
||||||
for (size_t i = 0; i < storage.skip_indices.size(); ++i)
|
for (size_t i = 0; i < storage.skip_indices.size(); ++i)
|
||||||
{
|
{
|
||||||
const auto index = storage.skip_indices[i];
|
const auto index = storage.skip_indices[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user