ericphanson commented on code in PR #493:
URL: https://github.com/apache/arrow-julia/pull/493#discussion_r1415731981
##########
bench.jl:
##########
@@ -0,0 +1,16 @@
+using Arrow, ArrowTypes, Random, BenchmarkTools
Review Comment:
do we want to check this in at top-level? could have a `benchmark` folder
##########
bench.jl:
##########
@@ -0,0 +1,16 @@
+using Arrow, ArrowTypes, Random, BenchmarkTools
Review Comment:
if we're keeping this, we need to add the license block to the top to pass
the CI audit check
##########
src/ArrowTypes/src/ArrowTypes.jl:
##########
@@ -170,11 +170,15 @@ overload is necessary.
A few `ArrowKind`s have/allow slightly more custom overloads for their
`fromarrow` methods:
* `ListKind{true}`: for `String` types, they may overload
`fromarrow(::Type{T}, ptr::Ptr{UInt8}, len::Int) = ...` to avoid
materializing a `String`
- * `StructKind`: must overload `fromarrow(::Type{T}, x...)` where individual
fields are passed as separate
+ * `StructKind`:
+ * May overload `fromarrow(::Type{T}, x...)` where individual fields are
passed as separate
positional arguments; so if my custom type `Interval` has two fields
`first` and `last`, then I'd overload like
`ArrowTypes.fromarrow(::Type{Interval}, first, last) = ...`. Note the
default implementation is
`ArrowTypes.fromarrow(::Type{T}, x...) = T(x...)`, so if your type
already accepts all arguments in a constructor
no additional `fromarrow` method should be necessary (default struct
constructors have this behavior).
+ * Alternatively, may overload `fromarrowstruct(::Type{T}, ::Val{fnames},
x...)`, where `fnames` is a tuple of the
+ field names corresponding to the values in `x`. This approach is useful
when you need to implement deserialization
+ in a manner that is agnostic to the field order used by the serializer.
Review Comment:
```suggestion
* Alternatively, may overload `fromarrowstruct(::Type{T},
::Val{fnames}, x...)`, where `fnames` is a tuple of the
field names corresponding to the values in `x`. This approach is useful
when you need to implement deserialization
in a manner that is agnostic to the field order used by the serializer.
When implemented, `fromarrowstruct` takes precedence over `fromarrow` in
`StructKind` deserialization.
```
--
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]