Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #45686 to 22.8: Fix key description when encountering duplicate primary keys #45727

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/Storages/MergeTree/KeyCondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,12 +878,9 @@ KeyCondition::KeyCondition(
, single_point(single_point_)
, strict(strict_)
{
for (size_t i = 0, size = key_column_names.size(); i < size; ++i)
{
const auto & name = key_column_names[i];
for (const auto & name : key_column_names)
if (!key_columns.contains(name))
key_columns[name] = i;
}
key_columns[name] = key_columns.size();

/** Evaluation of expressions that depend only on constants.
* For the index to be used, if it is written, for example `WHERE Date = toDate(now())`.
Expand Down Expand Up @@ -955,12 +952,9 @@ KeyCondition::KeyCondition(
, single_point(single_point_)
, strict(strict_)
{
for (size_t i = 0, size = key_column_names.size(); i < size; ++i)
{
const auto & name = key_column_names[i];
for (const auto & name : key_column_names)
if (!key_columns.contains(name))
key_columns[name] = i;
}
key_columns[name] = key_columns.size();

for (const auto & [name, _] : syntax_analyzer_result->array_join_result_to_source)
array_joined_columns.insert(name);
Expand Down