[Bug](java-udf) fix core dump when javaudf input 0 row block (#30720)
fix core dump when javaudf input 0 row block
This commit is contained in:
@ -192,6 +192,8 @@ public class Analyzer {
|
||||
|
||||
private boolean isReAnalyze = false;
|
||||
|
||||
private boolean isReplay = false;
|
||||
|
||||
public void setIsSubquery() {
|
||||
isSubquery = true;
|
||||
isFirstScopeInSubquery = true;
|
||||
@ -266,6 +268,14 @@ public class Analyzer {
|
||||
return globalState.autoBroadcastJoinThreshold;
|
||||
}
|
||||
|
||||
public void setReplay() {
|
||||
isReplay = true;
|
||||
}
|
||||
|
||||
public boolean isReplay() {
|
||||
return isReplay;
|
||||
}
|
||||
|
||||
private static class InferPredicateState {
|
||||
// map from two table tuple ids to JoinOperator between two tables.
|
||||
// NOTE: first tupleId's position in front of the second tupleId.
|
||||
|
||||
@ -200,6 +200,9 @@ public class CreateMaterializedViewStmt extends DdlStmt {
|
||||
rewriteToBitmapWithCheck();
|
||||
// TODO(ml): The mv name in from clause should pass the analyze without error.
|
||||
selectStmt.forbiddenMVRewrite();
|
||||
if (isReplay) {
|
||||
analyzer.setReplay();
|
||||
}
|
||||
selectStmt.analyze(analyzer);
|
||||
|
||||
ExprRewriter rewriter = analyzer.getExprRewriter();
|
||||
@ -207,6 +210,9 @@ public class CreateMaterializedViewStmt extends DdlStmt {
|
||||
selectStmt.rewriteExprs(rewriter);
|
||||
selectStmt.reset();
|
||||
analyzer = new Analyzer(analyzer.getEnv(), analyzer.getContext());
|
||||
if (isReplay) {
|
||||
analyzer.setReplay();
|
||||
}
|
||||
selectStmt.analyze(analyzer);
|
||||
|
||||
analyzeSelectClause(analyzer);
|
||||
|
||||
@ -2471,8 +2471,8 @@ public class FunctionCallExpr extends Expr {
|
||||
String dbName = fnName.analyzeDb(analyzer);
|
||||
if (!Strings.isNullOrEmpty(dbName)) {
|
||||
// check operation privilege
|
||||
if (!Env.getCurrentEnv().getAccessManager()
|
||||
.checkDbPriv(ConnectContext.get(), dbName, PrivPredicate.SELECT)) {
|
||||
if (!analyzer.isReplay() && !Env.getCurrentEnv().getAccessManager().checkDbPriv(ConnectContext.get(),
|
||||
dbName, PrivPredicate.SELECT)) {
|
||||
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "SELECT");
|
||||
}
|
||||
// TODO(gaoxin): ExternalDatabase not implement udf yet.
|
||||
|
||||
@ -303,6 +303,7 @@ public class MaterializedIndexMeta implements Writable, GsonPostProcessable {
|
||||
CreateMaterializedViewStmt stmt;
|
||||
try {
|
||||
stmt = (CreateMaterializedViewStmt) SqlParserUtils.getStmt(parser, defineStmt.idx);
|
||||
stmt.setIsReplay(true);
|
||||
if (analyzer != null) {
|
||||
try {
|
||||
stmt.analyze(analyzer);
|
||||
@ -312,7 +313,6 @@ public class MaterializedIndexMeta implements Writable, GsonPostProcessable {
|
||||
}
|
||||
}
|
||||
|
||||
stmt.setIsReplay(true);
|
||||
setWhereClause(stmt.getWhereClause());
|
||||
stmt.rewriteToBitmapWithCheck();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user