From 103987ebd8432a9995dae0086a366b9da674f6e6 Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Wed, 24 Apr 2024 21:44:07 +0800 Subject: [PATCH] [fix](parse) set origin stmt for select stmt generated from show stmt (#34015) * [fix](parse) set origin stmt for select stmt generated from show stmt * 2 --- .../org/apache/doris/datasource/hive/HMSExternalTable.java | 4 ++-- .../src/main/java/org/apache/doris/qe/StmtExecutor.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java index 38556682ee..e29bafd5dc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java @@ -268,11 +268,11 @@ public class HMSExternalTable extends ExternalTable implements MTMVRelatedTableI private boolean supportedHiveTable() { // we will return false if null, which means that the table type maybe unsupported. if (remoteTable.getSd() == null) { - return false; + throw new NotSupportedException("remote table's storage descriptor is null"); } String inputFileFormat = remoteTable.getSd().getInputFormat(); if (inputFileFormat == null) { - return false; + throw new NotSupportedException("remote table's storage input format is null"); } boolean supportedFileFormat = SUPPORTED_HIVE_FILE_FORMATS.contains(inputFileFormat); if (!supportedFileFormat) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 031062fbd7..be328bb124 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -1110,6 +1110,9 @@ public class StmtExecutor { if (parsedStmt instanceof ShowStmt) { SelectStmt selectStmt = ((ShowStmt) parsedStmt).toSelectStmt(analyzer); if (selectStmt != null) { + // Need to set origin stmt for new "parsedStmt"(which is selectStmt here) + // Otherwise, the log printing may result in NPE + selectStmt.setOrigStmt(parsedStmt.getOrigStmt()); setParsedStmt(selectStmt); } }