提交 00f3e4de authored 作者: tledkov's avatar tledkov

#1057, #1072 fix: set neverLazy for subquery in joins/nested joins recursively

上级 ce1d452a
...@@ -725,6 +725,7 @@ public class Select extends Query { ...@@ -725,6 +725,7 @@ public class Select extends Query {
@Override @Override
protected ResultInterface queryWithoutCache(int maxRows, ResultTarget target) { protected ResultInterface queryWithoutCache(int maxRows, ResultTarget target) {
disableLazyForJoinSubqueries(topTableFilter.getJoin()); disableLazyForJoinSubqueries(topTableFilter.getJoin());
disableLazyForJoinSubqueries(topTableFilter.getNestedJoin());
int limitRows = maxRows == 0 ? -1 : maxRows; int limitRows = maxRows == 0 ? -1 : maxRows;
if (limitExpr != null) { if (limitExpr != null) {
...@@ -870,14 +871,16 @@ public class Select extends Query { ...@@ -870,14 +871,16 @@ public class Select extends Query {
} }
private void disableLazyForJoinSubqueries(TableFilter f) { private void disableLazyForJoinSubqueries(TableFilter f) {
for (; f != null; f = f.getJoin() != null ? f.getJoin() : f.getNestedJoin()) { if (f == null)
return;
if (f.getTable().getTableType() == TableType.VIEW) { if (f.getTable().getTableType() == TableType.VIEW) {
ViewIndex idx = (ViewIndex) f.getIndex(); ViewIndex idx = (ViewIndex) f.getIndex();
if (idx != null && idx.getQuery() != null) { if (idx != null && idx.getQuery() != null) {
idx.getQuery().setNeverLazy(true); idx.getQuery().setNeverLazy(true);
} }
} }
} disableLazyForJoinSubqueries(f.getJoin());
disableLazyForJoinSubqueries(f.getNestedJoin());
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论