Fix not to use feature

This commit is contained in:
Igor Markelov 2024-05-11 19:57:11 +00:00
parent 8d08ca4fc6
commit 7d6cc8c174
2 changed files with 31 additions and 1 deletions

View File

@ -51,10 +51,17 @@ void getBestCompressionPermutationImpl(
::sort(order.begin(), order.end(), comparator);
std::cerr << "MYLOG estimate_unique_count = ";
for (auto i : estimate_unique_count) {
std::cerr << i << ", ";
}
std::cerr << std::endl;
std::vector<EqualRange> equal_ranges{range};
for (size_t i : order)
{
const size_t column_id = not_already_sorted_columns[i];
std::cerr << "MYLOG column_id = " << column_id << std::endl;
const auto column = block.getByPosition(column_id).column;
column->updatePermutationForCompression(permutation, equal_ranges);
}
@ -121,8 +128,13 @@ EqualRanges getEqualRanges(const Block & block, const SortDescription & descript
}
void getBestCompressionPermutation(const Block & block, const SortDescription & description, IColumn::Permutation & permutation)
{
{
const auto equal_ranges = getEqualRanges(block, description, permutation);
std::cerr << "MYLOG: equal_ranges = ";
for (auto [l, r] : equal_ranges) {
std::cerr << "(l = " << l << ", r = " << r << "), ";
}
std::cerr << std::endl;
const auto not_already_sorted_columns = getNotAlreadySortedColumnsIndex(block, description);
for (const auto & range : equal_ranges)
{

View File

@ -450,6 +450,8 @@ MergeTreeDataWriter::TemporaryPart MergeTreeDataWriter::writeTempPartImpl(
int64_t block_number,
bool need_tmp_prefix)
{
LOG_DEBUG(
log, "writeTempPartImpl");
TemporaryPart temp_part;
Block & block = block_with_partition.block;
@ -534,9 +536,17 @@ MergeTreeDataWriter::TemporaryPart MergeTreeDataWriter::writeTempPartImpl(
if (data.getSettings()->allow_experimental_improve_compression_raws_order)
{
LOG_DEBUG(
log, "allow_experimental_improve_compression_raws_order=true");
getBestCompressionPermutation(block, sort_description, perm);
perm_ptr = &perm;
}
else
{
LOG_DEBUG(
log, "allow_experimental_improve_compression_raws_order=false");
}
Names partition_key_columns = metadata_snapshot->getPartitionKey().column_names;
if (context->getSettingsRef().optimize_on_insert)
@ -767,9 +777,17 @@ MergeTreeDataWriter::TemporaryPart MergeTreeDataWriter::writeProjectionPartImpl(
if (data.getSettings()->allow_experimental_improve_compression_raws_order)
{
LOG_DEBUG(
log, "allow_experimental_improve_compression_raws_order=true");
getBestCompressionPermutation(block, sort_description, perm);
perm_ptr = &perm;
}
else
{
LOG_DEBUG(
log, "allow_experimental_improve_compression_raws_order=false");
}
if (projection.type == ProjectionDescription::Type::Aggregate && merge_is_needed)
{