code: func (d *Datum) ToFloat64(sc *stmtctx.StatementContext) (float64, error) {
  	switch d.Kind() {
  	case KindInt64:
  		return float64(d.GetInt64()), nil
  	case KindUint64:
  		return float64(d.GetUint64()), nil
  	case KindFloat32:
  		return float64(d.GetFloat32()), nil
  	case KindFloat64:
  		return d.GetFloat64(), nil
  	case KindString:
  		return StrToFloat(sc, d.GetString())
  	case KindBytes:
  		return StrToFloat(sc, string(d.GetBytes()))
  	case KindMysqlTime:
  		f, err := d.GetMysqlTime().ToNumber().ToFloat64()
  		return f, errors.Trace(err)
  	case KindMysqlDuration:
  		f, err := d.GetMysqlDuration().ToNumber().ToFloat64()
  		return f, errors.Trace(err)
  	case KindMysqlDecimal:
  		f, err := d.GetMysqlDecimal().ToFloat64()
  		return f, errors.Trace(err)
  	case KindMysqlEnum:
  		return d.GetMysqlEnum().ToNumber(), nil
  	case KindMysqlSet:
  		return d.GetMysqlSet().ToNumber(), nil
  	case KindBinaryLiteral, KindMysqlBit:
  		val, err := d.GetBinaryLiteral().ToInt(sc)
  		return float64(val), errors.Trace(err)
  	case KindMysqlJSON:
  		f, err := ConvertJSONToFloat(sc, d.GetMysqlJSON())
  		return f, errors.Trace(err)
  	default:
  		return 0, errors.Errorf("cannot convert %v(type %T) to float64", d.GetValue(), d.GetValue())
  	}
  }
docs: // ToFloat64 converts to a float64