提交 8fc2392b authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Properly compare NULLs in BaseIndex.compareValues()

上级 e0880fbd
...@@ -364,6 +364,11 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -364,6 +364,11 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
if (a == b) { if (a == b) {
return 0; return 0;
} }
boolean aNull = a == ValueNull.INSTANCE;
boolean bNull = b == ValueNull.INSTANCE;
if (aNull || bNull) {
return SortOrder.compareNull(aNull, sortType);
}
int comp = table.compareTypeSafe(a, b); int comp = table.compareTypeSafe(a, b);
if ((sortType & SortOrder.DESCENDING) != 0) { if ((sortType & SortOrder.DESCENDING) != 0) {
comp = -comp; comp = -comp;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论