mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Try fix tests.
This commit is contained in:
parent
bd814d83de
commit
f7e0e87c7d
@ -450,7 +450,7 @@ BlockIO InterpreterSelectQuery::execute()
|
||||
{
|
||||
res.pipeline.addSimpleTransform([&](const Block & header)
|
||||
{
|
||||
return std::make_shared<ConvertingTransform>(header, result_header, ConvertingTransform::MatchColumnsMode::Position);
|
||||
return std::make_shared<ConvertingTransform>(header, result_header, ConvertingTransform::MatchColumnsMode::Name);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,11 @@ ConvertingTransform::ConvertingTransform(
|
||||
break;
|
||||
|
||||
case MatchColumnsMode::Name:
|
||||
if (source.has(res_elem.name))
|
||||
/// It may seem strange, but sometimes block may have columns with the same name.
|
||||
/// For this specific case, try to get column from the same position if it has correct name first.
|
||||
if (result_col_num < source.columns() && source.getByPosition(result_col_num).name == res_elem.name)
|
||||
conversion[result_col_num] = result_col_num;
|
||||
else if (source.has(res_elem.name))
|
||||
conversion[result_col_num] = source.getPositionByName(res_elem.name);
|
||||
else
|
||||
throw Exception("Cannot find column " + backQuoteIfNeed(res_elem.name) + " in source stream",
|
||||
|
Loading…
Reference in New Issue
Block a user