Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-10600: [Go] Implement Decimal256 #13792

Merged
merged 13 commits into from
Aug 5, 2022
3 changes: 1 addition & 2 deletions dev/archery/archery/integration/datagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,7 @@ def _temp_path():

generate_decimal128_case(),

generate_decimal256_case()
.skip_category('Go') # TODO(ARROW-7948): Decimal + Go
generate_decimal256_case()
.skip_category('JS'),

generate_datetime_case(),
Expand Down
2 changes: 1 addition & 1 deletion docs/source/status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Data Types
+-------------------+-------+-------+-------+------------+-------+-------+-------+
| Decimal128 | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ |
+-------------------+-------+-------+-------+------------+-------+-------+-------+
| Decimal256 | ✓ | ✓ | | | ✓ | | ✓ |
| Decimal256 | ✓ | ✓ | | | ✓ | | ✓ |
+-------------------+-------+-------+-------+------------+-------+-------+-------+
| Date32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
+-------------------+-------+-------+-------+------------+-------+-------+-------+
Expand Down
2 changes: 1 addition & 1 deletion go/arrow/array/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func init() {
arrow.INTERVAL_MONTHS: func(data arrow.ArrayData) arrow.Array { return NewMonthIntervalData(data) },
arrow.INTERVAL_DAY_TIME: func(data arrow.ArrayData) arrow.Array { return NewDayTimeIntervalData(data) },
arrow.DECIMAL128: func(data arrow.ArrayData) arrow.Array { return NewDecimal128Data(data) },
arrow.DECIMAL256: unsupportedArrayType,
arrow.DECIMAL256: func(data arrow.ArrayData) arrow.Array { return NewDecimal256Data(data) },
arrow.LIST: func(data arrow.ArrayData) arrow.Array { return NewListData(data) },
arrow.STRUCT: func(data arrow.ArrayData) arrow.Array { return NewStructData(data) },
arrow.SPARSE_UNION: unsupportedArrayType,
Expand Down
2 changes: 1 addition & 1 deletion go/arrow/array/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func TestMakeFromData(t *testing.T) {
{name: "month_interval", d: arrow.FixedWidthTypes.MonthInterval},
{name: "day_time_interval", d: arrow.FixedWidthTypes.DayTimeInterval},
{name: "decimal128", d: &testDataType{arrow.DECIMAL128}},
{name: "decimal256", d: &testDataType{arrow.DECIMAL256}},
{name: "month_day_nano_interval", d: arrow.FixedWidthTypes.MonthDayNanoInterval},

{name: "list", d: &testDataType{arrow.LIST}, child: []arrow.ArrayData{
Expand Down Expand Up @@ -122,7 +123,6 @@ func TestMakeFromData(t *testing.T) {
// unsupported types
{name: "sparse union", d: &testDataType{arrow.SPARSE_UNION}, expPanic: true, expError: "unsupported data type: SPARSE_UNION"},
{name: "dense union", d: &testDataType{arrow.DENSE_UNION}, expPanic: true, expError: "unsupported data type: DENSE_UNION"},
{name: "decimal256", d: &testDataType{arrow.DECIMAL256}, expPanic: true, expError: "unsupported data type: DECIMAL256"},

// invalid types
{name: "invalid(-1)", d: &testDataType{arrow.Type(-1)}, expPanic: true, expError: "invalid data type: Type(-1)"},
Expand Down
3 changes: 3 additions & 0 deletions go/arrow/array/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ func NewBuilder(mem memory.Allocator, dtype arrow.DataType) Builder {
return NewDecimal128Builder(mem, typ)
}
case arrow.DECIMAL256:
if typ, ok := dtype.(*arrow.Decimal256Type); ok {
return NewDecimal256Builder(mem, typ)
}
case arrow.LIST:
typ := dtype.(*arrow.ListType)
return NewListBuilder(mem, typ.Elem())
Expand Down
6 changes: 6 additions & 0 deletions go/arrow/array/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ func Equal(left, right arrow.Array) bool {
case *Decimal128:
r := right.(*Decimal128)
return arrayEqualDecimal128(l, r)
case *Decimal256:
r := right.(*Decimal256)
return arrayEqualDecimal256(l, r)
case *Date32:
r := right.(*Date32)
return arrayEqualDate32(l, r)
Expand Down Expand Up @@ -520,6 +523,9 @@ func arrayApproxEqual(left, right arrow.Array, opt equalOption) bool {
case *Decimal128:
r := right.(*Decimal128)
return arrayEqualDecimal128(l, r)
case *Decimal256:
r := right.(*Decimal256)
return arrayEqualDecimal256(l, r)
case *Date32:
r := right.(*Date32)
return arrayEqualDate32(l, r)
Expand Down
Loading