Skip to content

Commit

Permalink
[Enhance](multi-catalog) parse hive view ddl first to avoid NPE. (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
dutyu authored Dec 8, 2023
1 parent 61d556c commit 16230b5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.IdGenerator;
import org.apache.doris.common.Pair;
import org.apache.doris.common.UserException;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.planner.AggregationNode;
import org.apache.doris.planner.AnalyticEvalNode;
Expand Down Expand Up @@ -852,6 +853,13 @@ public TableRef resolveTableRef(TableRef tableRef) throws AnalysisException {
View hmsView = new View(table.getId(), table.getName(), table.getFullSchema());
hmsView.setInlineViewDefWithSqlMode(((HMSExternalTable) table).getViewText(),
ConnectContext.get().getSessionVariable().getSqlMode());
// for user experience consideration, parse hive view ddl first to avoid NPE
// if legacy parser can not parse hive view ddl properly
try {
hmsView.init();
} catch (UserException e) {
throw new AnalysisException(e.getMessage(), e);
}
InlineViewRef inlineViewRef = new InlineViewRef(hmsView, tableRef);
if (StringUtils.isNotEmpty(tableName.getCtl())) {
inlineViewRef.setExternalCtl(tableName.getCtl());
Expand Down

0 comments on commit 16230b5

Please sign in to comment.