提交 603c59e5 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore: descending indexes with "nulls first" did not work as expected (null was ordered last).

上级 44f5b6c2
......@@ -18,7 +18,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Large result sets now always create temporary tables instead of temporary files.
<ul><li>MVStore: descending indexes with "nulls first" did not work as expected
(null was ordered last).
</li><li>Large result sets now always create temporary tables instead of temporary files.
</li><li>When using the PageStore, opening a database failed in some cases with a NullPointerException
if temporary tables were used (explicitly, or implicitly when using large result sets).
</li><li>If a database file in the PageStore file format exists, this file and this mode
......
......@@ -762,6 +762,10 @@ public class TransactionStore {
* Commit the transaction. Afterwards, this transaction is closed.
*/
public void commit() {
if (status == STATUS_CLOSED) {
// TODO analyze why this happens
return;
}
checkNotClosed();
store.commit(this, logId);
}
......
......@@ -115,7 +115,8 @@ public class ValueDataType implements DataType {
if (a == b) {
return 0;
}
boolean aNull = a == null, bNull = b == null;
boolean aNull = a == null || a == ValueNull.INSTANCE;
boolean bNull = b == null || b == ValueNull.INSTANCE;
if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType);
}
......
......@@ -17,11 +17,9 @@ import org.h2.expression.Expression;
import org.h2.index.Cursor;
import org.h2.index.Index;
import org.h2.index.IndexType;
import org.h2.index.PageBtreeIndex;
import org.h2.schema.Schema;
import org.h2.table.Column;
import org.h2.table.IndexColumn;
import org.h2.table.RegularTable;
import org.h2.table.Table;
import org.h2.value.Value;
import org.h2.value.ValueNull;
......@@ -114,16 +112,9 @@ public class ResultTempTable implements ResultExternal {
table, Constants.PREFIX_INDEX);
int indexId = session.getDatabase().allocateObjectId();
IndexType indexType = IndexType.createNonUnique(true);
if (session.getDatabase().getMvStore() != null) {
index = table.addIndex(session, indexName, indexId, indexCols,
indexType, true, null);
index.setTemporary(true);
} else {
index = new PageBtreeIndex((RegularTable) table, indexId,
indexName, indexCols, indexType, true, session);
index.setTemporary(true);
table.getIndexes().add(index);
}
index = table.addIndex(session, indexName, indexId, indexCols,
indexType, true, null);
index.setTemporary(true);
}
@Override
......@@ -301,10 +292,10 @@ public class ResultTempTable implements ResultExternal {
createIndex();
}
Cursor cursor = index.find(session, row, row);
Database db = session.getDatabase();
while (cursor.next()) {
SearchRow found = cursor.getSearchRow();
boolean ok = true;
Database db = session.getDatabase();
for (int i = 0; i < row.getColumnCount(); i++) {
if (!db.areEqual(row.getValue(i), found.getValue(i))) {
ok = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论