zeroshade commented on code in PR #13792:
URL: https://github.com/apache/arrow/pull/13792#discussion_r938032356


##########
go/arrow/scalar/scalar.go:
##########
@@ -311,6 +314,50 @@ func NewDecimal128Scalar(val decimal128.Num, typ 
arrow.DataType) *Decimal128 {
        return &Decimal128{scalar{typ, true}, val}
 }
 
+type Decimal256 struct {
+       scalar
+       Value decimal256.Num
+}
+
+func (s *Decimal256) value() interface{} { return s.Value }
+
+func (s *Decimal256) String() string {
+       if !s.Valid {
+               return "null"
+       }
+       val, err := s.CastTo(arrow.BinaryTypes.String)
+       if err != nil {
+               return "..."
+       }
+       return string(val.(*String).Value.Bytes())
+}
+
+func (s *Decimal256) equals(rhs Scalar) bool {
+       return s.Value == rhs.(*Decimal256).Value
+}
+
+func (s *Decimal256) CastTo(to arrow.DataType) (Scalar, error) {
+       if !s.Valid {
+               return MakeNullScalar(to), nil
+       }
+
+       switch to.ID() {
+       case arrow.DECIMAL256:
+               return NewDecimal256Scalar(s.Value, to), nil

Review Comment:
   fixed this, calling `Rescale` and `FitsInPrecision`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to