code: func CoerceArithmetic(sc *variable.StatementContext, a Datum) (d Datum, err error) {
  	switch a.Kind() {
  	case KindString, KindBytes:
  		// MySQL will convert string to float for arithmetic operation
  		f, err := StrToFloat(sc, a.GetString())
  		if err != nil {
  			return d, errors.Trace(err)
  		}
  		d.SetFloat64(f)
  		return d, errors.Trace(err)
  	case KindMysqlTime:
  		// if time has no precision, return int64
  		t := a.GetMysqlTime()
  		de := t.ToNumber()
  		if t.Fsp == 0 {
  			iVal, _ := de.ToInt()
  			d.SetInt64(iVal)
  			return d, nil
  		}
  		d.SetMysqlDecimal(de)
  		return d, nil
  	case KindMysqlDuration:
  		// if duration has no precision, return int64
  		du := a.GetMysqlDuration()
  		de := du.ToNumber()
  		if du.Fsp == 0 {
  			iVal, _ := de.ToInt()
  			d.SetInt64(iVal)
  			return d, nil
  		}
  		d.SetMysqlDecimal(de)
  		return d, nil
  	case KindMysqlHex:
  		d.SetFloat64(a.GetMysqlHex().ToNumber())
  		return d, nil
  	case KindMysqlBit:
  		d.SetFloat64(a.GetMysqlBit().ToNumber())
  		return d, nil
  	case KindMysqlEnum:
  		d.SetFloat64(a.GetMysqlEnum().ToNumber())
  		return d, nil
  	case KindMysqlSet:
  		d.SetFloat64(a.GetMysqlSet().ToNumber())
  		return d, nil
  	default:
  		return a, nil
  	}
  }
docs: // CoerceArithmetic converts datum to appropriate datum for arithmetic computing.