Skip to content

[Bug] [Nereids] "fragment has no children" error when INSERT INTO / CTAS with RECURSIVE CTE #64368

@wangchen2019

Description

@wangchen2019

Search before asking

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

Version

create table tmps.tmp_trace_link_long_magnetic_sort PROPERTIES ( "replication_num" = "2" ) as with recursive t(id, a) as ( select cast(1 as bigint), array(cast(1 as bigint))

union all

select
id + 1,
array_pushback(a, id)
from t
where id < 5
) select * from t;

What's Wrong?

SQL 错误 [1105] [HY000]: fragment has no children

What You Expected?

-- 1. 显式建表(明确指定字段类型)
drop table tmps.tmp_trace_link_long_magnetic_sort;
CREATE TABLE tmps.tmp_trace_link_long_magnetic_sort (
id BIGINT,
a ARRAY
)
PROPERTIES (
"replication_num" = "2"
);

-- 方法 1:直接关闭 Nereids 优化器(推荐)
SET enable_nereids_planner = false;

-- 方法 2:如果方法 1 报错,尝试开启自动回退机制
SET enable_fallback_to_original_planner = true;

-- 2. 插入数据
INSERT INTO tmps.tmp_trace_link_long_magnetic_sort
WITH RECURSIVE t(id, a) AS (
SELECT
CAST(1 AS BIGINT),
array(CAST(1 AS BIGINT))
UNION ALL
SELECT
id + 1,
array_pushback(a, id)
FROM t
WHERE id < 5
)
SELECT * FROM t;

SQL 错误 [1105] [HY000]: fragment has no children

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

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions