mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql parser. for issue #1970
This commit is contained in:
@@ -1745,6 +1745,13 @@ class SchemaResolveVisitorFactory {
|
||||
x.setResolvedOwnerObject(parameter);
|
||||
return;
|
||||
}
|
||||
} else if (parentCtx.object instanceof SQLMergeStatement) {
|
||||
SQLMergeStatement mergeStatement = (SQLMergeStatement) parentCtx.object;
|
||||
SQLTableSource into = mergeStatement.getInto();
|
||||
if (into instanceof SQLSubqueryTableSource
|
||||
&& into.aliasHashCode64() == owner_hash) {
|
||||
x.setResolvedOwnerObject(into);
|
||||
}
|
||||
}
|
||||
|
||||
SQLDeclareItem declareItem = parentCtx.findDeclare(owner_hash);
|
||||
@@ -2159,7 +2166,11 @@ class SchemaResolveVisitorFactory {
|
||||
SchemaResolveVisitor.Context ctx = visitor.createContext(x);
|
||||
|
||||
SQLTableSource into = x.getInto();
|
||||
ctx.setTableSource(into);
|
||||
if (into instanceof SQLExprTableSource) {
|
||||
ctx.setTableSource(into);
|
||||
} else {
|
||||
into.accept(visitor);
|
||||
}
|
||||
|
||||
SQLTableSource using = x.getUsing();
|
||||
if (using != null) {
|
||||
|
||||
@@ -2206,10 +2206,14 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
|
||||
|
||||
setMode(x, Mode.Merge);
|
||||
|
||||
String ident = x.getInto().toString();
|
||||
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementMergeCount();
|
||||
SQLTableSource into = x.getInto();
|
||||
if (into instanceof SQLExprTableSource) {
|
||||
String ident = ((SQLExprTableSource) into).getExpr().toString();
|
||||
TableStat stat = getTableStat(ident);
|
||||
stat.incrementMergeCount();
|
||||
} else {
|
||||
into.accept(this);
|
||||
}
|
||||
|
||||
x.getOn().accept(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user