Skip to content

[Bug] Mv rewrite bug may cause SQL failure #7361

Description

@tinkerrrr

Search before asking

  • I had searched in the issues and found no similar issues.

Version

trunk version

What's Wrong?

Hers is a table UserTable and it's mv:

+-----------+---------------+------------------------------------------+--------+------+-------+---------+-------+---------+
| IndexName | IndexKeysType | Field                                    | Type   | Null | Key   | Default | Extra | Visible |
+-----------+---------------+------------------------------------------+--------+------+-------+---------+-------+---------+
| UserTable | DUP_KEYS      | k1                                       | INT    | Yes  | true  | NULL    |       | true    |
|           |               | k2                                       | INT    | Yes  | true  | NULL    |       | true    |
|           |               |                                          |        |      |       |         |       |         |
| test_mv   | AGG_KEYS      | k1                                       | INT    | Yes  | true  | NULL    |       | true    |
|           |               | CASE WHEN `k2` IS NULL THEN 0 ELSE 1 END | BIGINT | No   | false |         | SUM   | true    |
+-----------+---------------+------------------------------------------+--------+------+-------+---------+-------+---------+

Fail to execute SQL :

mysql>  select k1, count(k2) / count(1) from UserTable group by k1;
ERROR 1105 (HY000): errCode = 2, detailMessage = Failed to select materialize view

What You Expected?

Fix this bug

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalearea/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