result columns should take precedence to account same name aliasing

This commit is contained in:
Yakov Olkhovskiy 2023-08-19 02:01:10 +00:00
parent 7ad8ea78bb
commit 25316a29f3
3 changed files with 18 additions and 2 deletions

View File

@ -1193,12 +1193,12 @@ static InterpolateDescriptionPtr getInterpolateDescription(
}
col_set.clear();
for (const auto & column : source_block)
for (const auto & column : result_block)
{
source_columns.emplace_back(column.name, column.type);
col_set.insert(column.name);
}
for (const auto & column : result_block)
for (const auto & column : source_block)
if (!col_set.contains(column.name))
source_columns.emplace_back(column.name, column.type);
}

View File

@ -0,0 +1,8 @@
2023-05-15 1
2023-05-16 1
2023-05-17 1
2023-05-18 1
2023-05-19 1
2023-05-20 1
2023-05-21 1
2023-05-22 15

View File

@ -0,0 +1,8 @@
DROP TABLE IF EXISTS 02861_interpolate;
CREATE TABLE 02861_interpolate (date Date, id String, f Int16) ENGINE=MergeTree() ORDER BY (date);
INSERT INTO 02861_interpolate VALUES ('2023-05-15', '1', 1), ('2023-05-22', '1', 15);
SELECT date AS d, toNullable(f) AS f FROM 02861_interpolate WHERE id = '1' ORDER BY d ASC WITH FILL STEP toIntervalDay(1) INTERPOLATE (f);
DROP TABLE 02861_interpolate;