mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Fix very strange bug
This commit is contained in:
parent
58b9e73a7a
commit
750b9d9e55
@ -178,6 +178,7 @@ MutationsInterpreter::MutationsInterpreter(
|
||||
std::cerr << "Mutations ast:" << queryToString(mutation_ast) << std::endl;
|
||||
SelectQueryOptions limits = SelectQueryOptions().analyze(!can_execute).ignoreLimits();
|
||||
select_interpreter = std::make_unique<InterpreterSelectQuery>(mutation_ast, context, storage, limits);
|
||||
std::cerr << "HEADER:" << select_interpreter->getSampleBlock().dumpStructure() << std::endl;
|
||||
}
|
||||
|
||||
static NameSet getKeyColumns(const StoragePtr & storage)
|
||||
@ -405,6 +406,7 @@ ASTPtr MutationsInterpreter::prepare(bool dry_run)
|
||||
throw Exception("Unknown mutation command type: " + DB::toString<int>(command.type), ErrorCodes::UNKNOWN_MUTATION_COMMAND);
|
||||
}
|
||||
|
||||
std::cerr << "AFFECTED INDICES COLUMN:" << affected_indices_columns.size() << std::endl;
|
||||
/// We cares about affected indices because we also need to rewrite them
|
||||
/// when one of index columns updated or filtered with delete
|
||||
if (!affected_indices_columns.empty())
|
||||
@ -422,6 +424,7 @@ ASTPtr MutationsInterpreter::prepare(bool dry_run)
|
||||
}
|
||||
|
||||
const ASTPtr select_query = prepareInterpreterSelectQuery(stages_copy, /* dry_run = */ true);
|
||||
std::cerr << "SELECT query for index:" << queryToString(select_query) << std::endl;
|
||||
InterpreterSelectQuery interpreter{select_query, context, storage, SelectQueryOptions().analyze(/* dry_run = */ false).ignoreLimits()};
|
||||
|
||||
auto first_stage_header = interpreter.getSampleBlock();
|
||||
@ -431,8 +434,11 @@ ASTPtr MutationsInterpreter::prepare(bool dry_run)
|
||||
/// Special step to recalculate affected indices.
|
||||
stages.emplace_back(context);
|
||||
for (const auto & column : affected_indices_columns)
|
||||
{
|
||||
std::cerr << "AFFECTED COLUMN:" << column << std::endl;
|
||||
stages.back().column_to_updated.emplace(
|
||||
column, std::make_shared<ASTIdentifier>(column));
|
||||
}
|
||||
}
|
||||
|
||||
is_prepared = true;
|
||||
@ -611,9 +617,14 @@ BlockInputStreamPtr MutationsInterpreter::execute(TableStructureReadLockHolder &
|
||||
throw Exception("Cannot execute mutations interpreter because can_execute flag set to false", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
BlockInputStreamPtr in = select_interpreter->execute().in;
|
||||
std::cerr << "INNNNNNNN HEADER:" << in->getHeader().dumpStructure() << std::endl;
|
||||
auto result_stream = addStreamsForLaterStages(stages, in);
|
||||
std::cerr << "RESULTTTTT HEADER:" << result_stream->getHeader().dumpStructure() << std::endl;
|
||||
if (!updated_header)
|
||||
{
|
||||
std::cerr << "Saving updated header\n";
|
||||
updated_header = std::make_unique<Block>(result_stream->getHeader());
|
||||
}
|
||||
return result_stream;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ MergeTreeBaseSelectProcessor::MergeTreeBaseSelectProcessor(
|
||||
save_marks_in_cache(save_marks_in_cache_),
|
||||
virt_column_names(virt_column_names_)
|
||||
{
|
||||
std::cerr << "Processor header:" << header.dumpStructure() << std::endl;
|
||||
std::cerr << "HEADER IN SELECT PROCESSOR:" << getPort().getHeader().dumpStructure() << std::endl;
|
||||
//std::cerr << "STACK:" << StackTrace().toString() << std::endl;
|
||||
header_without_virtual_columns = getPort().getHeader();
|
||||
|
@ -1061,8 +1061,9 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mutatePartToTempor
|
||||
|
||||
if (!indices_to_recalc.empty())
|
||||
{
|
||||
std::cerr << "Updated header:" << updated_header.dumpStructure() << std::endl;
|
||||
auto indices_recalc_syntax
|
||||
= SyntaxAnalyzer(context, {}).analyze(indices_recalc_expr_list, updated_header.getNamesAndTypesList());
|
||||
= SyntaxAnalyzer(context, {}).analyze(indices_recalc_expr_list, in->getHeader().getNamesAndTypesList());
|
||||
auto indices_recalc_expr = ExpressionAnalyzer(
|
||||
indices_recalc_expr_list,
|
||||
indices_recalc_syntax, context).getActions(false);
|
||||
|
@ -184,6 +184,7 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
|
||||
|
||||
for (const String & name : column_names_to_return)
|
||||
{
|
||||
std::cerr << "Column name to return:" << name << std::endl;
|
||||
if (name == "_part")
|
||||
{
|
||||
part_column_queried = true;
|
||||
@ -644,7 +645,7 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Spreading marks among streams\n";
|
||||
std::cerr << "Spreading marks among streams columns size:" << column_names_to_read.size() << std::endl;
|
||||
res = spreadMarkRangesAmongStreams(
|
||||
std::move(parts_with_ranges),
|
||||
num_streams,
|
||||
|
@ -155,7 +155,7 @@ MarkRanges MergeTreeReadPool::getRestMarks(const MergeTreeDataPart & part, const
|
||||
|
||||
Block MergeTreeReadPool::getHeader() const
|
||||
{
|
||||
//////////////////std::cerr << "COLUMN NAMES IN POOL:" << column_names.front() << std::endl;
|
||||
////std::cerr << "COLUMN NAMES IN POOL:" << column_names.front() << std::endl;
|
||||
return data.getSampleBlockForColumns(column_names);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
size_t max_block_size,
|
||||
unsigned num_streams) override
|
||||
{
|
||||
std::cerr << "StorageFromMergeTreeDataPart: columns names size:" << column_names.size() << std::endl;
|
||||
auto pipes = MergeTreeDataSelectExecutor(part->storage).readFromParts(
|
||||
{part}, column_names, query_info, context, max_block_size, num_streams);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user