Skip to content

Commit 6b473cb

Browse files
candiduslynxkou
authored andcommitted
GH-40719: [Go] Make arrow.Null non-null for arrow.TypeEqual to work properly with new(arrow.NullType) (#40802)
### Rationale for this change Currently creating a record with a `null` type via `new(arrow.NullType)` in the schema will fail the schema validation. ### What changes are included in this PR? Made `arrow.Null` a non-null value instead of just a declaration. ### Are these changes tested? Yes, see cd4253a24e6d828128fbb7854da3c37951d74885 ### Are there any user-facing changes? `arrow.Null` became non-null, but the type is the same. * GitHub Issue: #40719 Authored-by: Alex Shcherbakov <candiduslynx@users.noreply.github.com> Signed-off-by: Matt Topol <zotthewizard@gmail.com>
1 parent 24dbe8d commit 6b473cb

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

arrow/compare_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func TestTypeEqual(t *testing.T) {
4242
{
4343
Null, Null, true, false,
4444
},
45+
{
46+
Null, new(NullType), true, false,
47+
},
4548
{
4649
&BinaryType{}, &StringType{}, false, false,
4750
},

arrow/datatype_null.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,5 @@ func (*NullType) Layout() DataTypeLayout {
2727
return DataTypeLayout{Buffers: []BufferSpec{SpecAlwaysNull()}}
2828
}
2929

30-
var (
31-
Null *NullType
32-
_ DataType = Null
33-
)
30+
// Null gives us both the compile-time assertion of DataType interface as well as serving a good element for use in schemas.
31+
var Null DataType = new(NullType)

0 commit comments

Comments
 (0)