improved sql parser.

This commit is contained in:
wenshao
2017-08-18 10:16:53 +08:00
parent 97ed996c05
commit 3b0b090989
28 changed files with 789 additions and 478 deletions
@@ -519,10 +519,19 @@ public class SchemaRepository {
String ident = x.getName();
SQLTableSource tableSource = null;
if (queryBlock.getFrom() instanceof SQLJoinTableSource) {
if (queryBlock.getFrom() instanceof SQLJoinTableSource
|| queryBlock.getFrom() instanceof SQLSubqueryTableSource) {
tableSource = queryBlock.findTableSourceWithColumn(ident);
} else {
tableSource = queryBlock.getFrom();
if (tableSource instanceof SQLExprTableSource) {
SchemaObject table = ((SQLExprTableSource) tableSource).getSchemaObject();
if (table != null) {
if (table.findColumn(ident) == null) {
tableSource = null; // maybe parent
}
}
}
}
if (tableSource != null) {