mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Merge pull request #57461 from ClickHouse/fix-ephemeral-matview
Fix: don't exclude ephemeral column when building pushing to view chain
This commit is contained in:
commit
ac7210b9b3
@ -349,7 +349,7 @@ Chain buildPushingToViewsChain(
|
||||
for (const auto & column : header)
|
||||
{
|
||||
/// But skip columns which storage doesn't have.
|
||||
if (inner_table_columns.hasPhysical(column.name))
|
||||
if (inner_table_columns.hasNotAlias(column.name))
|
||||
insert_columns.emplace_back(column.name);
|
||||
}
|
||||
|
||||
|
@ -668,6 +668,12 @@ bool ColumnsDescription::hasPhysical(const String & column_name) const
|
||||
it->default_desc.kind != ColumnDefaultKind::Alias && it->default_desc.kind != ColumnDefaultKind::Ephemeral;
|
||||
}
|
||||
|
||||
bool ColumnsDescription::hasNotAlias(const String & column_name) const
|
||||
{
|
||||
auto it = columns.get<1>().find(column_name);
|
||||
return it != columns.get<1>().end() && it->default_desc.kind != ColumnDefaultKind::Alias;
|
||||
}
|
||||
|
||||
bool ColumnsDescription::hasAlias(const String & column_name) const
|
||||
{
|
||||
auto it = columns.get<1>().find(column_name);
|
||||
|
@ -182,6 +182,7 @@ public:
|
||||
Names getNamesOfPhysical() const;
|
||||
|
||||
bool hasPhysical(const String & column_name) const;
|
||||
bool hasNotAlias(const String & column_name) const;
|
||||
bool hasAlias(const String & column_name) const;
|
||||
bool hasColumnOrSubcolumn(GetColumnsOptions::Kind kind, const String & column_name) const;
|
||||
bool hasColumnOrNested(GetColumnsOptions::Kind kind, const String & column_name) const;
|
||||
|
2
tests/queries/0_stateless/02933_ephemeral_mv.reference
Normal file
2
tests/queries/0_stateless/02933_ephemeral_mv.reference
Normal file
@ -0,0 +1,2 @@
|
||||
3 3
|
||||
42 42
|
30
tests/queries/0_stateless/02933_ephemeral_mv.sql
Normal file
30
tests/queries/0_stateless/02933_ephemeral_mv.sql
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
CREATE TABLE raw
|
||||
(
|
||||
name String,
|
||||
num String
|
||||
) ENGINE = MergeTree
|
||||
ORDER BY (name);
|
||||
|
||||
CREATE TABLE parsed_eph
|
||||
(
|
||||
name String,
|
||||
num_ephemeral UInt32 EPHEMERAL,
|
||||
num UInt32 MATERIALIZED num_ephemeral,
|
||||
) ENGINE = MergeTree
|
||||
ORDER BY (name);
|
||||
|
||||
CREATE MATERIALIZED VIEW parse_mv_eph
|
||||
TO parsed_eph
|
||||
AS
|
||||
SELECT
|
||||
name,
|
||||
toUInt32(num) as num_ephemeral
|
||||
FROM raw;
|
||||
|
||||
INSERT INTO raw VALUES ('3', '3'), ('42', '42');
|
||||
SELECT name, num FROM parsed_eph;
|
||||
|
||||
DROP VIEW parse_mv_eph;
|
||||
DROP TABLE parsed_eph;
|
||||
DROP TABLE raw;
|
Loading…
Reference in New Issue
Block a user