This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a25ac5bfe0a [fix](fe) Return async materialized view schemas in the
legacy metadata API (#70784)
a25ac5bfe0a is described below
commit a25ac5bfe0a85b85fc8eafc9d250ebb13b5deec9
Author: HSn <[email protected]>
AuthorDate: Sat Nov 21 12:13:23 2026 +0800
[fix](fe) Return async materialized view schemas in the legacy metadata API
(#70784)
### Background
The legacy FE metadata endpoint serves the column list used when
browsing a table or view. An asynchronous materialized view has its own
base index, which holds the view's columns in schema order.
### What problem does this PR solve?
Issue Number: close #70778
Related PR: None
PR Type: Bugfix
Problem Summary:
Opening the column list for an async materialized view can return HTTP
200 with error code 500 and a `getSchema()` null pointer, even when SQL
`DESC` returns the columns. The endpoint now looks up the view's actual
base index. The regression test requests the legacy route and checks the
view's own column aliases in order.
### Details
- **Frequency:** Reproduced on every request to a projection view and an
aggregate view on Doris 4.1.5, with and without `with_mv=1`.
- **Root cause:** The handler used the base index ID only for tables of
type `OLAP`. Async views have type `MATERIALIZED_VIEW`, so it passed
`tableId - 1` to `IndexInfoProcDir`, which expects a real index ID for
both types.
- **Why existing tests missed it:** `test_http_legacy_meta_auth`
exercises the legacy route with an ordinary table.
`TableSchemaActionTest` exercises a different controller.
- **Fix:** Use the same `isManagedTable()` predicate as the index lookup
when choosing the base index ID.
- **Other paths and branches:** The change is confined to the base
schema lookup. Source inspection found the same condition on master and
branches 2.1, 3.0, 3.1, 4.0, 4.1 and 4.2. Runtime tests used 4.1.5.
### Testing
- Compared two local Doris 4.1.5 instances. In the candidate, only the
FE controller was recompiled from the release source with this change.
Tested an ordinary table, a projection view and an aggregate view, each
with and without `with_mv=1`. Before the fix, both table requests
succeeded and all four view requests returned error code 500. With the
fix, all six returned code 0 and the same ordered field names as SQL
`DESC`.
- Ran the new projection-view Groovy suite source against both instances
using a lightweight local DSL adapter. The assertion on the response
code failed on the original image. All four assertions passed on the
candidate, including the base flag and the ordered aliases `mv_key`,
`mv_value`. The aggregate view was tested manually. The ordinary table
in the matrix had no synchronous rollup.
- Ran `mvn checkstyle:check -pl fe-core` on the master-based working
tree. Checkstyle reported zero violations.
### Release note
The legacy FE schema API now returns the column list for asynchronous
materialized views.
### Check List (For Author)
- Behavior changed: No
- Does this need documentation: No
- Pre-submission status: Partially verified: the official regression
runner stopped at its JDK 17 prerequisite, and the master FE build
requires the missing project-provided protoc.
### AI Disclosure
- Tool: OpenAI Codex
- Generated: The one-line FE fix, the regression test, and this
description.
- Human review: Patch and test review not stated.
---
.../apache/doris/httpv2/rest/MetaInfoAction.java | 2 +-
.../http_rest_api/get/test_async_mv_schema.groovy | 49 ++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java
index cd2beb2757e..bb72f29bdeb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java
@@ -244,7 +244,7 @@ public class MetaInfoAction extends RestBaseController {
tbl.readLock();
try {
long baseId = -1;
- if (tbl.getType() == Table.TableType.OLAP) {
+ if (tbl.isManagedTable()) {
baseId = ((OlapTable) tbl).getBaseIndexId();
} else {
baseId += tbl.getId();
diff --git
a/regression-test/suites/http_rest_api/get/test_async_mv_schema.groovy
b/regression-test/suites/http_rest_api/get/test_async_mv_schema.groovy
new file mode 100644
index 00000000000..3dcfac00110
--- /dev/null
+++ b/regression-test/suites/http_rest_api/get/test_async_mv_schema.groovy
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_async_mv_schema") {
+ sql "DROP MATERIALIZED VIEW IF EXISTS test_async_mv_schema"
+ sql "DROP TABLE IF EXISTS test_async_mv_schema_base"
+ sql """
+ CREATE TABLE test_async_mv_schema_base (k INT, v INT)
+ DUPLICATE KEY(k) DISTRIBUTED BY HASH(k) BUCKETS 1
+ PROPERTIES ("replication_num" = "1")
+ """
+ sql """
+ CREATE MATERIALIZED VIEW test_async_mv_schema
+ BUILD DEFERRED REFRESH COMPLETE ON MANUAL
+ DISTRIBUTED BY RANDOM BUCKETS 1
+ PROPERTIES ("replication_num" = "1")
+ AS SELECT k AS mv_key, v AS mv_value FROM test_async_mv_schema_base
+ """
+
+ def db = context.config.getDbNameByFile(context.file)
+ httpTest {
+ basicAuthorization context.config.jdbcUser, context.config.jdbcPassword
+ endpoint context.config.feHttpAddress
+ uri
"/api/meta/namespaces/default_cluster/databases/${db}/tables/test_async_mv_schema/schema"
+ op "get"
+ check { status, body ->
+ assertEquals(200, status)
+ def result = parseJson(body)
+ assertEquals(0, result.code)
+ def view = result.data.test_async_mv_schema
+ assertEquals(true, view.is_base)
+ assertEquals(["mv_key", "mv_value"], view.schema*.Field)
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]