mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-20 03:59:56 +08:00
int range
This commit is contained in:
@@ -147,8 +147,8 @@ func (e *SQLEngine) Substring(value *schema_pb.Value, start *schema_pb.Value, le
|
|||||||
if lengthVal <= 0 {
|
if lengthVal <= 0 {
|
||||||
result = ""
|
result = ""
|
||||||
} else {
|
} else {
|
||||||
if lengthVal > int64(math.MaxInt) {
|
if lengthVal > int64(math.MaxInt) || lengthVal < int64(math.MinInt) {
|
||||||
// If length is too large, take substring from startIdx to end
|
// If length is out-of-bounds for int, take substring from startIdx to end
|
||||||
result = str[startIdx:]
|
result = str[startIdx:]
|
||||||
} else {
|
} else {
|
||||||
endIdx := startIdx + int(lengthVal)
|
endIdx := startIdx + int(lengthVal)
|
||||||
@@ -277,7 +277,7 @@ func (e *SQLEngine) Left(value *schema_pb.Value, length *schema_pb.Value) (*sche
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if lengthVal > int64(math.MaxInt) {
|
if lengthVal > int64(math.MaxInt) || lengthVal < int64(math.MinInt) {
|
||||||
return &schema_pb.Value{
|
return &schema_pb.Value{
|
||||||
Kind: &schema_pb.Value_StringValue{StringValue: str},
|
Kind: &schema_pb.Value_StringValue{StringValue: str},
|
||||||
}, nil
|
}, nil
|
||||||
@@ -316,7 +316,7 @@ func (e *SQLEngine) Right(value *schema_pb.Value, length *schema_pb.Value) (*sch
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if lengthVal > int64(math.MaxInt) {
|
if lengthVal > int64(math.MaxInt) || lengthVal < int64(math.MinInt) {
|
||||||
return &schema_pb.Value{
|
return &schema_pb.Value{
|
||||||
Kind: &schema_pb.Value_StringValue{StringValue: str},
|
Kind: &schema_pb.Value_StringValue{StringValue: str},
|
||||||
}, nil
|
}, nil
|
||||||
|
Reference in New Issue
Block a user