Skip to content

Failed to query constant which is in inline view #4716

@EmmyMiao87

Description

@EmmyMiao87

Describe the bug

Situation: Select a constant column from inline view which includes at least one regular column.
Query failed!

MySQL [test]> select a from (select 'c1' a , k1 from test) a;
ERROR 1064 (HY000): errCode = 2, detailMessage = failed to build storage scanner, no materialized slot!

To Reproduce
Steps to reproduce the behavior:

  1. create table
CREATE TABLE `test` (
  `k1` int(11) NULL COMMENT "",
  `k2` bigint(20) NULL COMMENT "",
  `k3` decimal(9, 0) NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`k1`, `k2`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`k1`) BUCKETS 10
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "DEFAULT"
);
  1. insert values
insert into test values(2,2,2);
  1. query
MySQL [test]> select a from (select 'c1' a , k1 from test) a;
ERROR 1064 (HY000): errCode = 2, detailMessage = failed to build storage scanner, no materialized slot!

Expected behavior

+------+
| a    |
+------+
| c1   |
+------+

If there are two lines in table, the result will be:

+------+
| a    |
+------+
| c1   |
| c1   |
+------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/plannerIssues or PRs related to the query plannerkind/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