HSn0918 opened a new issue, #70778:
URL: https://github.com/apache/doris/issues/70778

   ## Version
   
   Apache Doris `doris-4.1.5-release-917b20be838` on both FE and BE. Reproduced 
with one FE and one BE in `apache/doris:all-in-one-4.1.5` on Linux ARM64.
   
   ## What's Wrong?
   
   We first saw this on a production cluster with three BEs while investigating 
slow PCA queries and repeated full refreshes of two async materialized views. 
Data imports were running during the investigation, and a refresh had hit a 
BE's spill limit. When we opened the views in the web UI to inspect their 
columns, the field list repeatedly failed to load.
   
   On November 20, 2026, the production FE logged 19 occurrences of the same 
exception between 09:39:15 and 10:42:00. Each stack trace included 
`MetaInfoAction.getTableSchema`. Over SQL, `DESC` returned 80 columns for one 
view and 17 for the other, and `SELECT ... LIMIT 1` succeeded on both. Each 
view's actual base index ID was one greater than its table ID.
   
   We then reproduced the field-list failure on a local 4.1.5 cluster with one 
row, after both test views had finished refreshing. The FE schema endpoint 
returned HTTP 200 with `"code":500`, `"msg":"Internal Error"`, and the 
following error in `data`.
   
   ```text
   Cannot invoke "org.apache.doris.catalog.MaterializedIndexMeta.getSchema()" 
because the return value of "java.util.Map.get(Object)" is null
   ```
   
   ## What You Expected?
   
   The endpoint should return the view's base schema. For the example below, 
its field names should match the two columns returned by `DESC mv_detail`.
   
   ## How to Reproduce?
   
   On a cluster with one FE and one BE, run:
   
   ```sql
   CREATE DATABASE schema_repro;
   USE schema_repro;
   
   CREATE TABLE base_rows (k INT, v INT)
   DUPLICATE KEY(k)
   DISTRIBUTED BY HASH(k) BUCKETS 1
   PROPERTIES ("replication_num" = "1");
   
   INSERT INTO base_rows VALUES (1, 7);
   
   CREATE MATERIALIZED VIEW mv_detail
   BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
   DISTRIBUTED BY RANDOM BUCKETS 1
   PROPERTIES ("replication_num" = "1")
   AS SELECT k, v FROM base_rows;
   ```
   
   Wait for `RefreshState` to become `SUCCESS`, then describe and query the 
view:
   
   ```sql
   SELECT Name, State, RefreshState FROM mv_infos('database'='schema_repro');
   DESC mv_detail;
   SELECT k, v FROM mv_detail;
   ```
   
   From inside the local all-in-one container, call the same FE endpoint for 
both objects:
   
   ```sh
   
tables=http://127.0.0.1:8030/api/meta/namespaces/default_cluster/databases/schema_repro/tables
   curl -sS -i -u root: "$tables/base_rows/schema"
   curl -sS -i -u root: "$tables/mv_detail/schema"
   ```
   
   ## Anything Else?
   
   The base table returned `code: 0` and fields `k, v` on three consecutive 
requests. The projection view above and a second async view defined with 
`SELECT k, SUM(v) AS total FROM base_rows GROUP BY k` each returned the same 
error on all three requests. Both views reported `NORMAL / SUCCESS`, and both 
returned one row with values `(1, 7)` over SQL.
   
   In `MetaInfoAction.getTableSchema`, the FE reads `getBaseIndexId()` only for 
objects of type `OLAP`. An async materialized view has type 
`MATERIALIZED_VIEW`, so the handler builds its `index_schema` proc path with 
`tableId - 1`. In the local run, `mv_detail` had table ID `1795143523871`. The 
computed index ID was `1795143523870`, while `SHOW PROC` listed its only index 
as `1795143523872`.
   
   Relevant FE stack frames:
   
   ```text
   at org.apache.doris.catalog.OlapTable.getSchemaByIndexId(OlapTable.java:1143)
   at org.apache.doris.catalog.OlapTable.getSchemaByIndexId(OlapTable.java:1139)
   at 
org.apache.doris.common.proc.IndexInfoProcDir.lookup(IndexInfoProcDir.java:127)
   at org.apache.doris.common.proc.ProcService.open(ProcService.java:143)
   at 
org.apache.doris.httpv2.rest.MetaInfoAction.generateSchema(MetaInfoAction.java:289)
   at 
org.apache.doris.httpv2.rest.MetaInfoAction.generateResult(MetaInfoAction.java:285)
   at 
org.apache.doris.httpv2.rest.MetaInfoAction.getTableSchema(MetaInfoAction.java:260)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to