提交 58f3e2c4 authored 作者: Thomas Mueller's avatar Thomas Mueller

Merge pull request #164 from svladykin/compareValues

Null sorting fixed in indexes.
......@@ -241,12 +241,13 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
}
for (int i = 0, len = indexColumns.length; i < len; i++) {
int index = columnIds[i];
Value v = compare.getValue(index);
if (v == null) {
Value v1 = rowData.getValue(index);
Value v2 = compare.getValue(index);
if (v1 == null || v2 == null) {
// can't compare further
return 0;
}
int c = compareValues(rowData.getValue(index), v, indexColumns[i].sortType);
int c = compareValues(v1, v2, indexColumns[i].sortType);
if (c != 0) {
return c;
}
......@@ -311,10 +312,6 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
if (a == b) {
return 0;
}
boolean aNull = a == null, bNull = b == null;
if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType);
}
int comp = table.compareTypeSafe(a, b);
if ((sortType & SortOrder.DESCENDING) != 0) {
comp = -comp;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论