diff options
Diffstat (limited to 'weed/query/engine/arithmetic_functions.go')
| -rw-r--r-- | weed/query/engine/arithmetic_functions.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/weed/query/engine/arithmetic_functions.go b/weed/query/engine/arithmetic_functions.go index fd8ac1684..e2237e31b 100644 --- a/weed/query/engine/arithmetic_functions.go +++ b/weed/query/engine/arithmetic_functions.go @@ -15,11 +15,11 @@ import ( type ArithmeticOperator string const ( - OpAdd ArithmeticOperator = "+" - OpSub ArithmeticOperator = "-" - OpMul ArithmeticOperator = "*" - OpDiv ArithmeticOperator = "/" - OpMod ArithmeticOperator = "%" + OpAdd ArithmeticOperator = "+" + OpSub ArithmeticOperator = "-" + OpMul ArithmeticOperator = "*" + OpDiv ArithmeticOperator = "/" + OpMod ArithmeticOperator = "%" ) // EvaluateArithmeticExpression evaluates basic arithmetic operations between two values @@ -69,7 +69,7 @@ func (e *SQLEngine) EvaluateArithmeticExpression(left, right *schema_pb.Value, o // Convert result back to appropriate schema value type // If both operands were integers and operation doesn't produce decimal, return integer - if e.isIntegerValue(left) && e.isIntegerValue(right) && + if e.isIntegerValue(left) && e.isIntegerValue(right) && (operator == OpAdd || operator == OpSub || operator == OpMul || operator == OpMod) { return &schema_pb.Value{ Kind: &schema_pb.Value_Int64Value{Int64Value: int64(result)}, |
