From 4179c8f2452ad82698079bd1885a16ead46c60a1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 16 Jul 2025 23:54:11 +0800 Subject: [PATCH] :art: Improve rel/rollup sort https://ld246.com/article/1752679409595 --- kernel/av/sort.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/av/sort.go b/kernel/av/sort.go index 56ca2eaa2..1dac261fc 100644 --- a/kernel/av/sort.go +++ b/kernel/av/sort.go @@ -397,7 +397,7 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int { } case KeyTypeRelation: if nil != value.Relation && nil != other.Relation { - if 1 < len(value.Relation.Contents) && 1 < len(other.Relation.Contents) && KeyTypeNumber == value.Relation.Contents[0].Type && KeyTypeNumber == other.Relation.Contents[0].Type { + if 0 < len(value.Relation.Contents) && 0 < len(other.Relation.Contents) && KeyTypeNumber == value.Relation.Contents[0].Type && KeyTypeNumber == other.Relation.Contents[0].Type { v1, ok1 := util.Convert2Float(value.Relation.Contents[0].String(false)) v2, ok2 := util.Convert2Float(other.Relation.Contents[0].String(false)) if ok1 && ok2 { @@ -435,7 +435,7 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int { } case KeyTypeRollup: if nil != value.Rollup && nil != other.Rollup { - if 1 < len(value.Rollup.Contents) && 1 < len(other.Rollup.Contents) && KeyTypeNumber == value.Rollup.Contents[0].Type && KeyTypeNumber == other.Rollup.Contents[0].Type { + if 0 < len(value.Rollup.Contents) && 0 < len(other.Rollup.Contents) && KeyTypeNumber == value.Rollup.Contents[0].Type && KeyTypeNumber == other.Rollup.Contents[0].Type { v1, ok1 := util.Convert2Float(value.Rollup.Contents[0].String(false)) v2, ok2 := util.Convert2Float(other.Rollup.Contents[0].String(false)) if ok1 && ok2 {