You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by qu...@apache.org on 2023/06/02 17:12:35 UTC

[arrow-julia] branch main updated: fix Base.eltype methods and functions that take Type parameters (#404)

This is an automated email from the ASF dual-hosted git repository.

quinnj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git


The following commit(s) were added to refs/heads/main by this push:
     new 784b27b  fix Base.eltype methods and functions that take Type parameters (#404)
784b27b is described below

commit 784b27bc81ea227f5556106d948db42d79b84fcb
Author: Ben Baumgold <49...@users.noreply.github.com>
AuthorDate: Fri Jun 2 13:12:30 2023 -0400

    fix Base.eltype methods and functions that take Type parameters (#404)
---
 src/ArrowTypes/src/ArrowTypes.jl | 2 +-
 src/arraytypes/compressed.jl     | 2 +-
 src/eltypes.jl                   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ArrowTypes/src/ArrowTypes.jl b/src/ArrowTypes/src/ArrowTypes.jl
index 1391029..6e77c1c 100644
--- a/src/ArrowTypes/src/ArrowTypes.jl
+++ b/src/ArrowTypes/src/ArrowTypes.jl
@@ -389,7 +389,7 @@ end
 
 Base.IndexStyle(::Type{<:ToArrow}) = Base.IndexLinear()
 Base.size(x::ToArrow) = (length(x.data),)
-Base.eltype(x::ToArrow{T, A}) where {T, A} = T
+Base.eltype(::Type{TA}) where {T, A, TA<:ToArrow{T, A}} = T
 function _convert(::Type{T}, x) where {T}
     if x isa T
         return x
diff --git a/src/arraytypes/compressed.jl b/src/arraytypes/compressed.jl
index 3511412..cc86a1c 100644
--- a/src/arraytypes/compressed.jl
+++ b/src/arraytypes/compressed.jl
@@ -35,7 +35,7 @@ struct Compressed{Z, A}
 end
 
 Base.length(c::Compressed) = c.len
-Base.eltype(c::Compressed{Z, A}) where {Z, A} = eltype(A)
+Base.eltype(::Type{C}) where {Z, A, C<:Compressed{Z, A}} = eltype(A)
 getmetadata(x::Compressed) = getmetadata(x.data)
 compressiontype(c::Compressed{Z}) where {Z} = Z
 
diff --git a/src/eltypes.jl b/src/eltypes.jl
index ce3c16e..8fae026 100644
--- a/src/eltypes.jl
+++ b/src/eltypes.jl
@@ -328,8 +328,8 @@ end
 ToTimestamp(x::A) where {A <: AbstractVector{ZonedDateTime}} = ToTimestamp{A, Symbol(x[1].timezone)}(x)
 Base.IndexStyle(::Type{<:ToTimestamp}) = Base.IndexLinear()
 Base.size(x::ToTimestamp) = (length(x.data),)
-Base.eltype(::ToTimestamp{A, TZ}) where {A, TZ} = Timestamp{Meta.TimeUnit.MILLISECOND, TZ}
-Base.getindex(x::ToTimestamp{A, TZ}, i::Int) where {A, TZ} = convert(Timestamp{Meta.TimeUnit.MILLISECOND, TZ}, getindex(x.data, i))
+Base.eltype(::Type{ToTimestamp{A, TZ}}) where {A, TZ} = Timestamp{Meta.TimeUnit.MILLISECOND, TZ}
+Base.getindex(x::ToTimestamp{A, TZ}, i::Integer) where {A, TZ} = convert(Timestamp{Meta.TimeUnit.MILLISECOND, TZ}, getindex(x.data, i))
 
 struct Interval{U, T} <: ArrowTimeType
     x::T