Skip to content

es外表cte查询报错 #3828

Closed as not planned
Closed as not planned

Description

@BlackYooi

直接查询

SELECT yjsj FROM es_.default_db.theme_jzxxb LIMIT 10;
可以正常得到结果 比如:2024-11-04 18:46:40

执行cte查询报错

WITH node_xxx AS (
SELECT
yjsj
FROM es_.default_db.theme_jzxxb
)
SELECT * FROM node_xxx LIMIT 10;

错误日志:

org.jkiss.dbeaver.model.sql.DBSQLException: SQL 错误 [1105] [HY000]: errCode = 2, detailMessage = Input slot(s) not in child's output: yjsj#18 in plan: LogicalProject[63] ( distinct=false, projects=[yjsj#18 AS yjsj#9] )
child output is: [address#19, content#20, fssj#21, groupName#22, mtype#23, rawContent#24, tzzhm#25, tzzlx#26, yjsj#27]
plan tree:
LogicalProject[63] ( distinct=false, projects=[yjsj#18 AS yjsj#9] )
+--LogicalEsScan ( qualified=es_.default_db.theme_jzxxb, output=[address#19, content#20, fssj#21, groupName#22, mtype#23, rawContent#24, tzzhm#25, tzzlx#26, yjsj#27] )
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:130)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:657)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$2(SQLQueryJob.java:550)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:189)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:569)
at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:1043)
at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:4326)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:128)
at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:189)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:126)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:5112)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:119)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLException: errCode = 2, detailMessage = Input slot(s) not in child's output: yjsj#18 in plan: LogicalProject[63] ( distinct=false, projects=[yjsj#18 AS yjsj#9] )
child output is: [address#19, content#20, fssj#21, groupName#22, mtype#23, rawContent#24, tzzhm#25, tzzlx#26, yjsj#27]
plan tree:
LogicalProject[63] ( distinct=false, projects=[yjsj#18 AS yjsj#9] )
+--LogicalEsScan ( qualified=es_.default_db.theme_jzxxb, output=[address#19, content#20, fssj#21, groupName#22, mtype#23, rawContent#24, tzzhm#25, tzzlx#26, yjsj#27] )
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:767)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:652)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:344)
at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:128)
... 12 more

Activity

  1. zclllyybb commented on May 28, 2026

    @zclllyybb

    Breakwater-GitHub-Analysis-Slot: slot_e48c70cda997

    Initial analysis:

    This looks like a Doris FE/Nereids planner consistency bug, not a DBeaver issue and not an Elasticsearch data-read failure. The important part of the error is:

    Input slot(s) not in child's output: yjsj#18
    child output is: [..., yjsj#27]
    LogicalProject projects=[yjsj#18 AS `yjsj`#9]
    +--LogicalEsScan output=[..., yjsj#27]
    

    So the column name exists in the ES scan output, but the LogicalProject above the scan is still holding an older ExprId. That means the query fails during FE plan validation before it reaches BE/ES execution.

    The pattern is consistent with CTE inline/deep-copy remapping of a catalog relation: the CTE body projects one ES column, then the copied scan has regenerated output slots, but the upper project is not aligned with the copied child output. In the current upstream master, this exact LogicalEsScan path has already been removed/refactored by the ES catalog plugin-driven migration, so the report needs the exact Doris version/branch to confirm whether it is on an older ES scan path. On branch-4.0, there is also a very recent related fix, Preserve operative slots when deep copying logical relations (#63315, backported as #63708), which fixes incorrect remapping when the operative column is not in the first output position. In this case yjsj is the last column in the reported scan output, so that fix is highly relevant.

    Suggested next steps:

    1. Please provide the exact Doris version/build hash and branch. This is required because upstream master no longer uses the LogicalEsScan class shown in the error.
    2. If the environment is branch-4.0 or a build before the fix above, please retest with a build containing #63708 or cherry-pick that fix.
    3. Please also test the direct query on the same column, not only fssj:
      SELECT yjsj FROM es_.default_db.theme_jzxxb LIMIT 10;
    4. If the issue still reproduces after the fix, please attach a minimal redacted ES catalog/table definition, the ES mapping for this index, the full Doris FE version output, relevant session variables for the planner, and the FE log around the failing query.

    This issue is currently filed in apache/doris-website, but the symptom is a Doris planner/runtime issue. It should probably be transferred or recreated in apache/doris once the version information is available.

  2. morningman commented on Nov 12, 2026

    @morningman
    Contributor

    This report is now tracked in the Apache Doris engine repository: apache/doris#70529

    The engine issue preserves the original request/reproduction details and the information still needed for diagnosis. Closing this website issue so further implementation or investigation can continue there. This is a tracking move, not a claim that the feature or failure is already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions