Skip to content

Failed to drop column on materialized view #4374

@EmmyMiao87

Description

@EmmyMiao87

Describe the bug
Drop column on materialized view by AlterClause.
The alter job is failed with error msg: Create replicas failed.

To Reproduce
Steps to reproduce the behavior:

  1. create table
CREATE TABLE `test_sys_materialized_view_2_test_drop_column_with_mv_tb` (
  `k0` boolean NOT NULL COMMENT "",
  `k1` tinyint(4) NOT NULL COMMENT "",
  `k2` smallint(6) NOT NULL COMMENT "",
  `k3` int(11) NOT NULL COMMENT "",
  `k4` bigint(20) NOT NULL COMMENT "",
  `k5` largeint(40) NOT NULL COMMENT "",
  `k6` decimal(9, 3) NOT NULL COMMENT "",
  `k7` char(5) NOT NULL COMMENT "",
  `k8` date NOT NULL COMMENT "",
  `k9` datetime NOT NULL COMMENT "",
  `k10` varchar(20) NOT NULL COMMENT "",
  `k11` double NOT NULL COMMENT "",
  `k_new_1` int(11) NULL COMMENT "",
  `k_new` float NULL COMMENT "",
  `k12` float NOT NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`k0`, `k1`, `k2`)
COMMENT "OLAP"
PARTITION BY RANGE(`k1`)
(PARTITION p1 VALUES [("-128"), ("-10")),
PARTITION p2 VALUES [("-10"), ("0")),
PARTITION p3 VALUES [("0"), ("10")),
PARTITION p4 VALUES [("10"), ("20")))
DISTRIBUTED BY HASH(`k4`, `k5`) BUCKETS 10
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "DEFAULT"
);
  1. create materialized view
CREATE MATERIALIZED VIEW test_sys_materialized_view_2_test_drop_column_with_mv_index AS SELECT k0, max(k9), min(k11), sum(k12), hll_union(hll_hash(k7)) from test_sys_materialized_view_2_test_drop_column_with_mv_tb group by k0
  1. drop column k12 on mv
ALTER TABLE test_sys_materialized_view_2_test_drop_column_with_mv_tb DROP COLUMN k12 FROM test_sys_materialized_view_2_test_drop_column_with_mv_index
  1. alter job is failed
Create replicas failed. Error: Error replicas:xxxx

Expected behavior
Alter job is successful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/materialized-viewIssues or PRs related to materialized viewkind/fixCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions