提交 99c7bb02 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Move containsDistinct() from ResultInterface to LocalResult

上级 68f46168
......@@ -2811,8 +2811,6 @@ public class Parser {
} else {
if (isSelect()) {
Query query = parseSelect();
// TODO lazy result causes timeout in TestFuzzOptimizations
query.setNeverLazy(true);
r = new ConditionInSelect(database, r, query, false,
Comparison.EQUAL);
} else {
......
......@@ -11,6 +11,7 @@ import org.h2.engine.Database;
import org.h2.engine.Session;
import org.h2.index.IndexCondition;
import org.h2.message.DbException;
import org.h2.result.LocalResult;
import org.h2.result.ResultInterface;
import org.h2.table.ColumnResolver;
import org.h2.table.TableFilter;
......@@ -43,8 +44,10 @@ public class ConditionInSelect extends Condition {
@Override
public Value getValue(Session session) {
query.setSession(session);
// We need a LocalResult
query.setNeverLazy(true);
query.setDistinctIfPossible();
ResultInterface rows = query.query(0);
LocalResult rows = (LocalResult) query.query(0);
Value l = left.getValue(session);
if (!rows.hasNext()) {
return ValueBoolean.get(all);
......
......@@ -185,11 +185,4 @@ public abstract class LazyResult implements ResultInterface {
return null;
}
@Override
public boolean containsDistinct(Value[] values) {
// We have to make sure that we do not allow lazy
// evaluation when this call is needed:
// WHERE x IN (SELECT ...).
throw DbException.throwInternalError();
}
}
......@@ -41,6 +41,14 @@ public interface LocalResult extends ResultInterface, ResultTarget {
*/
public void setDistinct(int[] distinctIndexes);
/**
* Check if this result set contains the given row.
*
* @param values the row
* @return true if the row exists
*/
boolean containsDistinct(Value[] values);
/**
* Remove the row from the result set if it exists.
*
......
......@@ -202,11 +202,4 @@ public interface ResultInterface extends AutoCloseable {
*/
ResultInterface createShallowCopy(SessionInterface targetSession);
/**
* Check if this result set contains the given row.
*
* @param values the row
* @return true if the row exists
*/
boolean containsDistinct(Value[] values);
}
......@@ -281,9 +281,4 @@ public class ResultRemote implements ResultInterface {
return result == null;
}
@Override
public boolean containsDistinct(Value[] values) {
// We should never do this on remote result.
throw DbException.throwInternalError();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论