提交 d41c7df9 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix ConditionInSelect for optimizeInSelect = false

上级 58d82af2
...@@ -99,9 +99,7 @@ public class ConditionInSelect extends Condition { ...@@ -99,9 +99,7 @@ public class ConditionInSelect extends Condition {
// row, and if l is not null // row, and if l is not null
if (all) { if (all) {
while (rows.next()) { while (rows.next()) {
Value[] currentRow = rows.currentRow(); Value cmp = compare(l, rows);
Value r = query.getColumnCount() == 1 ? currentRow[0] : ValueRow.get(currentRow);
Value cmp = Comparison.compare(database, l, r, compareType);
if (cmp == ValueNull.INSTANCE) { if (cmp == ValueNull.INSTANCE) {
return ValueNull.INSTANCE; return ValueNull.INSTANCE;
} else if (cmp == ValueBoolean.FALSE) { } else if (cmp == ValueBoolean.FALSE) {
...@@ -112,9 +110,7 @@ public class ConditionInSelect extends Condition { ...@@ -112,9 +110,7 @@ public class ConditionInSelect extends Condition {
} else { } else {
boolean hasNull = false; boolean hasNull = false;
while (rows.next()) { while (rows.next()) {
Value[] currentRow = rows.currentRow(); Value cmp = compare(l, rows);
Value r = query.getColumnCount() == 1 ? currentRow[0] : ValueRow.get(currentRow);
Value cmp = Comparison.compare(database, l, r, compareType);
if (cmp == ValueNull.INSTANCE) { if (cmp == ValueNull.INSTANCE) {
hasNull = true; hasNull = true;
} else if (cmp == ValueBoolean.TRUE) { } else if (cmp == ValueBoolean.TRUE) {
...@@ -128,6 +124,12 @@ public class ConditionInSelect extends Condition { ...@@ -128,6 +124,12 @@ public class ConditionInSelect extends Condition {
} }
} }
private Value compare(Value l, ResultInterface rows) {
Value[] currentRow = rows.currentRow();
Value r = l.getType() != Value.ROW && query.getColumnCount() == 1 ? currentRow[0] : ValueRow.get(currentRow);
return Comparison.compare(database, l, r, compareType);
}
@Override @Override
public void mapColumns(ColumnResolver resolver, int level, int state) { public void mapColumns(ColumnResolver resolver, int level, int state) {
left.mapColumns(resolver, level, state); left.mapColumns(resolver, level, state);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论