[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
This commit is contained in:
Mingyu Chen
2024-04-24 21:44:07 +08:00
committed by yiguolei
parent fbd2c9db2d
commit 103987ebd8
2 changed files with 5 additions and 2 deletions

View File

@ -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) {

View File

@ -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);
}
}