From 8661b5ec214261b4f6237d9887eb6e1aba37292a Mon Sep 17 00:00:00 2001 From: Pxl Date: Fri, 15 Dec 2023 11:09:45 +0800 Subject: [PATCH] [Bug](function) fix npe on select http_stream directly (#28423) fix npe on select http_stream directly --- .../doris/tablefunction/ExternalFileTableValuedFunction.java | 2 +- regression-test/suites/query_p0/system/test_query_sys.groovy | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/ExternalFileTableValuedFunction.java b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/ExternalFileTableValuedFunction.java index 3569c4f447..72a0f061c0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/ExternalFileTableValuedFunction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/ExternalFileTableValuedFunction.java @@ -385,7 +385,7 @@ public abstract class ExternalFileTableValuedFunction extends TableValuedFunctio long backendId = ctx.getBackendId(); if (getTFileType() == TFileType.FILE_STREAM) { Backend be = Env.getCurrentSystemInfo().getIdToBackend().get(backendId); - if (be.isAlive()) { + if (be == null || be.isAlive()) { return be; } } diff --git a/regression-test/suites/query_p0/system/test_query_sys.groovy b/regression-test/suites/query_p0/system/test_query_sys.groovy index 0be52a301d..b17500a0cc 100644 --- a/regression-test/suites/query_p0/system/test_query_sys.groovy +++ b/regression-test/suites/query_p0/system/test_query_sys.groovy @@ -46,4 +46,9 @@ suite("test_query_sys", "query,p0") { // INFORMATION_SCHEMA sql "SELECT table_name FROM INFORMATION_SCHEMA.TABLES where table_schema=\"test_query_db\" and TABLE_TYPE = \"BASE TABLE\" order by table_name" sql "SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = \"${tableName}\" AND table_schema =\"test_query_db\" AND column_name LIKE \"k%\"" + + test { + sql "select * from http_stream('format'='csv');" + exception "No Alive backends" + } }