zeroshade commented on code in PR #1708:
URL: https://github.com/apache/arrow-go/pull/1708#discussion_r4743297622
##########
arrow/scalar/scalar_test.go:
##########
@@ -380,6 +380,17 @@ func TestStringMakeScalar(t *testing.T) {
assertParseScalar(t, arrow.BinaryTypes.String, "three",
scalar.NewStringScalar("three"))
}
+func TestParseLargeStringAndLargeBinary(t *testing.T) {
+ assertParseScalar(t, arrow.BinaryTypes.LargeString, "three",
scalar.NewLargeStringScalar("three"))
+ buf := memory.NewBufferBytes([]byte("three"))
Review Comment:
nit (optional): `NewBufferBytes` doesn't use an allocator, so nothing leaks,
but `defer buf.Release()` would match the other tests in this file.
##########
arrow/scalar/scalar_test.go:
##########
@@ -380,6 +380,17 @@ func TestStringMakeScalar(t *testing.T) {
assertParseScalar(t, arrow.BinaryTypes.String, "three",
scalar.NewStringScalar("three"))
}
+func TestParseLargeStringAndLargeBinary(t *testing.T) {
+ assertParseScalar(t, arrow.BinaryTypes.LargeString, "three",
scalar.NewLargeStringScalar("three"))
+ buf := memory.NewBufferBytes([]byte("three"))
+ assertParseScalar(t, arrow.BinaryTypes.LargeBinary, "three",
scalar.NewLargeBinaryScalar(buf))
+
+ got, err :=
scalar.NewStringScalar("three").CastTo(arrow.BinaryTypes.LargeString)
Review Comment:
nit (optional): this covers the cast to `large_string`. The other new case
and the self-cast from the description could be covered too, e.g.:
```go
got, err =
scalar.NewStringScalar("three").CastTo(arrow.BinaryTypes.LargeBinary)
require.NoError(t, err)
assert.IsType(t, &scalar.LargeBinary{}, got)
got, err =
scalar.NewLargeStringScalar("three").CastTo(arrow.BinaryTypes.LargeString)
require.NoError(t, err)
assertScalarsEqual(t, scalar.NewLargeStringScalar("three"), got)
```
--
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]