zeroshade commented on code in PR #43958: URL: https://github.com/apache/arrow/pull/43958#discussion_r1750533884
########## go/arrow/array/decimal.go: ########## @@ -0,0 +1,484 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package array + +import ( + "bytes" + "fmt" + "reflect" + "strings" + "sync/atomic" + + "github.com/apache/arrow/go/v18/arrow" + "github.com/apache/arrow/go/v18/arrow/bitutil" + "github.com/apache/arrow/go/v18/arrow/decimal" + "github.com/apache/arrow/go/v18/arrow/decimal128" + "github.com/apache/arrow/go/v18/arrow/decimal256" + "github.com/apache/arrow/go/v18/arrow/internal/debug" + "github.com/apache/arrow/go/v18/arrow/memory" + "github.com/apache/arrow/go/v18/internal/json" +) + +type decimalTypes interface { + decimal.Decimal32 | decimal.Decimal64 | decimal.Decimal128 | decimal.Decimal256 +} + +type baseDecimal[T interface { + decimalTypes + decimal.Num[T] +}] struct { Review Comment: I don't think I want to allow relaxing to `T any` for the decimal definition, but to avoid having multiple spots that we'd have to update for adding future impls (such as `Decimal8/16`) I'll create a `DecimalTypes` interface in the decimal package that is exported and then use that everywhere. That way there's only one place that would need to be updated if we add those new implementations. I'm also going to shift the `decTraits` interface and implementations into the `decimal` package in order to simplify some code. -- 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]
