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

Proposal: change @scopedenum to make modules to avoid type piracy #267

Merged
merged 6 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/FlatBuffers/FlatBuffers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ macro scopedenum(T, syms...)
push!(defs.args, :(const $(esc(sym)) = $(esc(typename))($i)))
end
end
mod = Symbol(typename, "Module")
_typename_str = string(typename)
mod = Symbol(_typename_str, last(_typename_str) == 's' ? "es" : "s")
syms = Tuple(Base.values(namemap))
blk = quote
module $(esc(mod))
Expand All @@ -135,7 +136,6 @@ macro scopedenum(T, syms...)
if isdefined(Base.Enums, :namemap)
Base.Enums.namemap(::Type{$(esc(typename))}) = $(esc(namemap))
end
Base.getproperty(::Type{$(esc(typename))}, sym::Symbol) = sym in $syms ? getfield($(esc(mod)), sym) : getfield($(esc(typename)), sym)
Base.typemin(x::Type{$(esc(typename))}) = $(esc(typename))($lo)
Base.typemax(x::Type{$(esc(typename))}) = $(esc(typename))($hi)
let insts = (Any[ $(esc(typename))(v) for v in $values ]...,)
Expand All @@ -144,11 +144,15 @@ macro scopedenum(T, syms...)
FlatBuffers.basetype(::$(esc(typename))) = $(basetype)
FlatBuffers.basetype(::Type{$(esc(typename))}) = $(basetype)
$defs
#Base.getproperty(::Type{$(esc(typename))}, sym::Symbol) = sym in $syms ? getfield($(esc(mod)), sym) : getfield($(esc(typename)), sym)
export $(syms...)
end
end
push!(blk.args, :nothing)
blk.head = :toplevel
push!(blk.args, :(using .$mod))
# Return the newly created module, since it's (now) meant to be user visible.
push!(blk.args, esc(mod))
return blk
end

Expand Down
8 changes: 4 additions & 4 deletions src/arraytypes/arraytypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function toarrowvector(x, i=1, de=Dict{Int64, Any}(), ded=DictEncoding[], meta=g
@debug 3 x
A = arrowvector(x, i, 0, 0, de, ded, meta; compression=compression, kw...)
if compression isa LZ4FrameCompressor
A = compress(Meta.CompressionType.LZ4_FRAME, compression, A)
A = compress(Meta.CompressionTypes.LZ4_FRAME, compression, A)
elseif compression isa Vector{LZ4FrameCompressor}
A = compress(Meta.CompressionType.LZ4_FRAME, compression[Threads.threadid()], A)
A = compress(Meta.CompressionTypes.LZ4_FRAME, compression[Threads.threadid()], A)
elseif compression isa ZstdCompressor
A = compress(Meta.CompressionType.ZSTD, compression, A)
A = compress(Meta.CompressionTypes.ZSTD, compression, A)
elseif compression isa Vector{ZstdCompressor}
A = compress(Meta.CompressionType.ZSTD, compression[Threads.threadid()], A)
A = compress(Meta.CompressionTypes.ZSTD, compression[Threads.threadid()], A)
end
@debug 2 "converted top-level column to arrow format: $(typeof(A))"
@debug 3 A
Expand Down
8 changes: 4 additions & 4 deletions src/arraytypes/unions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Union arrays
# need a custom representation of Union types since arrow unions
# are ordered, and possibly indirected via separate typeIds array
# here, T is Meta.UnionMode.Dense or Meta.UnionMode.Sparse,
# here, T is Meta.UnionModes.Dense or Meta.UnionModes.Sparse,
# typeIds is a NTuple{N, Int32}, and U is a Tuple{...} of the
# unioned types
struct UnionT{T, typeIds, U}
Expand Down Expand Up @@ -93,7 +93,7 @@ end

# convenience wrappers for signaling that an array shoudld be written
# as with dense/sparse union arrow buffers
struct DenseUnionVector{T, U} <: AbstractVector{UnionT{Meta.UnionMode.Dense, nothing, U}}
struct DenseUnionVector{T, U} <: AbstractVector{UnionT{Meta.UnionModes.Dense, nothing, U}}
itr::T
end

Expand All @@ -118,7 +118,7 @@ function todense(::Type{UnionT{T, typeIds, U}}, x) where {T, typeIds, U}
return types, offsets, data
end

struct SparseUnionVector{T, U} <: AbstractVector{UnionT{Meta.UnionMode.Sparse, nothing, U}}
struct SparseUnionVector{T, U} <: AbstractVector{UnionT{Meta.UnionModes.Sparse, nothing, U}}
itr::T
end

Expand Down Expand Up @@ -214,7 +214,7 @@ arrowvector(::UnionKind, x::Union{DenseUnion, SparseUnion}, i, nl, fi, de, ded,

function arrowvector(::UnionKind, x, i, nl, fi, de, ded, meta; kw...)
UT = eltype(x)
if unionmode(UT) == Meta.UnionMode.Dense
if unionmode(UT) == Meta.UnionModes.Dense
x = x isa DenseUnionVector ? x.itr : x
typeids, offsets, data = todense(UT, x)
data2 = map(y -> arrowvector(y[2], i, nl + 1, y[1], de, ded, nothing; kw...), enumerate(data))
Expand Down
70 changes: 35 additions & 35 deletions src/eltypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ end

# primitive types
function juliaeltype(f::Meta.Field, fp::Meta.FloatingPoint, convert)
if fp.precision == Meta.Precision.HALF
if fp.precision == Meta.Precisions.HALF
Float16
elseif fp.precision == Meta.Precision.SINGLE
elseif fp.precision == Meta.Precisions.SINGLE
Float32
elseif fp.precision == Meta.Precision.DOUBLE
elseif fp.precision == Meta.Precisions.DOUBLE
Float64
end
end

function arrowtype(b, ::Type{T}) where {T <: AbstractFloat}
Meta.floatingPointStart(b)
Meta.floatingPointAddPrecision(b, T === Float16 ? Meta.Precision.HALF : T === Float32 ? Meta.Precision.SINGLE : Meta.Precision.DOUBLE)
Meta.floatingPointAddPrecision(b, T === Float16 ? Meta.Precisions.HALF : T === Float32 ? Meta.Precisions.SINGLE : Meta.Precisions.DOUBLE)
return Meta.FloatingPoint, Meta.floatingPointEnd(b), nothing
end

Expand Down Expand Up @@ -175,18 +175,18 @@ struct Date{U, T} <: ArrowTimeType
x::T
end

const DATE = Date{Meta.DateUnit.DAY, Int32}
const DATE = Date{Meta.DateUnits.DAY, Int32}
Base.zero(::Type{Date{U, T}}) where {U, T} = Date{U, T}(T(0))
storagetype(::Type{Date{U, T}}) where {U, T} = T
bitwidth(x::Meta.DateUnit) = x == Meta.DateUnit.DAY ? Int32 : Int64
Date{Meta.DateUnit.DAY}(days) = DATE(Int32(days))
Date{Meta.DateUnit.MILLISECOND}(ms) = Date{Meta.DateUnit.MILLISECOND, Int64}(Int64(ms))
bitwidth(x::Meta.DateUnit) = x == Meta.DateUnits.DAY ? Int32 : Int64
Date{Meta.DateUnits.DAY}(days) = DATE(Int32(days))
Date{Meta.DateUnits.MILLISECOND}(ms) = Date{Meta.DateUnits.MILLISECOND, Int64}(Int64(ms))

juliaeltype(f::Meta.Field, x::Meta.Date, convert) = Date{x.unit, bitwidth(x.unit)}
finaljuliatype(::Type{DATE}) = Dates.Date
Base.convert(::Type{Dates.Date}, x::DATE) = Dates.Date(Dates.UTD(Int64(x.x + UNIX_EPOCH_DATE)))
finaljuliatype(::Type{Date{Meta.DateUnit.MILLISECOND, Int64}}) = Dates.DateTime
Base.convert(::Type{Dates.DateTime}, x::Date{Meta.DateUnit.MILLISECOND, Int64}) = Dates.DateTime(Dates.UTM(Int64(x.x + UNIX_EPOCH_DATETIME)))
finaljuliatype(::Type{Date{Meta.DateUnits.MILLISECOND, Int64}}) = Dates.DateTime
Base.convert(::Type{Dates.DateTime}, x::Date{Meta.DateUnits.MILLISECOND, Int64}) = Dates.DateTime(Dates.UTM(Int64(x.x + UNIX_EPOCH_DATETIME)))

function arrowtype(b, ::Type{Date{U, T}}) where {U, T}
Meta.dateStart(b)
Expand All @@ -198,7 +198,7 @@ const UNIX_EPOCH_DATE = Dates.value(Dates.Date(1970))
Base.convert(::Type{DATE}, x::Dates.Date) = DATE(Int32(Dates.value(x) - UNIX_EPOCH_DATE))

const UNIX_EPOCH_DATETIME = Dates.value(Dates.DateTime(1970))
Base.convert(::Type{Date{Meta.DateUnit.MILLISECOND, Int64}}, x::Dates.DateTime) = Date{Meta.DateUnit.MILLISECOND, Int64}(Int64(Dates.value(x) - UNIX_EPOCH_DATETIME))
Base.convert(::Type{Date{Meta.DateUnits.MILLISECOND, Int64}}, x::Dates.DateTime) = Date{Meta.DateUnits.MILLISECOND, Int64}(Int64(Dates.value(x) - UNIX_EPOCH_DATETIME))

ArrowTypes.ArrowType(::Type{Dates.Date}) = DATE
ArrowTypes.toarrow(x::Dates.Date) = convert(DATE, x)
Expand All @@ -213,16 +213,16 @@ struct Time{U, T} <: ArrowTimeType
end

Base.zero(::Type{Time{U, T}}) where {U, T} = Time{U, T}(T(0))
const TIME = Time{Meta.TimeUnit.NANOSECOND, Int64}
const TIME = Time{Meta.TimeUnits.NANOSECOND, Int64}

bitwidth(x::Meta.TimeUnit) = x == Meta.TimeUnit.SECOND || x == Meta.TimeUnit.MILLISECOND ? Int32 : Int64
bitwidth(x::Meta.TimeUnit) = x == Meta.TimeUnits.SECOND || x == Meta.TimeUnits.MILLISECOND ? Int32 : Int64
Time{U}(x) where {U <: Meta.TimeUnit} = Time{U, bitwidth(U)}(bitwidth(U)(x))
storagetype(::Type{Time{U, T}}) where {U, T} = T
juliaeltype(f::Meta.Field, x::Meta.Time, convert) = Time{x.unit, bitwidth(x.unit)}
finaljuliatype(::Type{<:Time}) = Dates.Time
periodtype(U::Meta.TimeUnit) = U === Meta.TimeUnit.SECOND ? Dates.Second :
U === Meta.TimeUnit.MILLISECOND ? Dates.Millisecond :
U === Meta.TimeUnit.MICROSECOND ? Dates.Microsecond : Dates.Nanosecond
periodtype(U::Meta.TimeUnit) = U === Meta.TimeUnits.SECOND ? Dates.Second :
U === Meta.TimeUnits.MILLISECOND ? Dates.Millisecond :
U === Meta.TimeUnits.MICROSECOND ? Dates.Microsecond : Dates.Nanosecond
Base.convert(::Type{Dates.Time}, x::Time{U, T}) where {U, T} = Dates.Time(Dates.Nanosecond(Dates.tons(periodtype(U)(x.x))))

function arrowtype(b, ::Type{Time{U, T}}) where {U, T}
Expand Down Expand Up @@ -252,7 +252,7 @@ function juliaeltype(f::Meta.Field, x::Meta.Timestamp, convert)
return Timestamp{x.unit, x.timezone === nothing ? nothing : Symbol(x.timezone)}
end

const DATETIME = Timestamp{Meta.TimeUnit.MILLISECOND, nothing}
const DATETIME = Timestamp{Meta.TimeUnits.MILLISECOND, nothing}

finaljuliatype(::Type{Timestamp{U, TZ}}) where {U, TZ} = ZonedDateTime
finaljuliatype(::Type{Timestamp{U, nothing}}) where {U} = DateTime
Expand All @@ -261,19 +261,19 @@ finaljuliatype(::Type{Timestamp{U, nothing}}) where {U} = DateTime
@warn "automatically converting Arrow.Timestamp with precision = $U to `$T` which only supports millisecond precision; conversion may be lossy; to avoid converting, pass `Arrow.Table(source; convert=false)" maxlog=1 _id=hash((:warntimestamp, U, T))

function Base.convert(::Type{ZonedDateTime}, x::Timestamp{U, TZ}) where {U, TZ}
(U === Meta.TimeUnit.MICROSECOND || U == Meta.TimeUnit.NANOSECOND) && warntimestamp(U, ZonedDateTime)
(U === Meta.TimeUnits.MICROSECOND || U == Meta.TimeUnits.NANOSECOND) && warntimestamp(U, ZonedDateTime)
return ZonedDateTime(Dates.DateTime(Dates.UTM(Int64(Dates.toms(periodtype(U)(x.x)) + UNIX_EPOCH_DATETIME))), TimeZone(String(TZ)))
end

function Base.convert(::Type{DateTime}, x::Timestamp{U, nothing}) where {U}
(U === Meta.TimeUnit.MICROSECOND || U == Meta.TimeUnit.NANOSECOND) && warntimestamp(U, DateTime)
(U === Meta.TimeUnits.MICROSECOND || U == Meta.TimeUnits.NANOSECOND) && warntimestamp(U, DateTime)
return Dates.DateTime(Dates.UTM(Int64(Dates.toms(periodtype(U)(x.x)) + UNIX_EPOCH_DATETIME)))
end

Base.convert(::Type{Timestamp{Meta.TimeUnit.MILLISECOND, TZ}}, x::ZonedDateTime) where {TZ} =
Timestamp{Meta.TimeUnit.MILLISECOND, TZ}(Int64(Dates.value(DateTime(x)) - UNIX_EPOCH_DATETIME))
Base.convert(::Type{Timestamp{Meta.TimeUnit.MILLISECOND, nothing}}, x::DateTime) =
Timestamp{Meta.TimeUnit.MILLISECOND, nothing}(Int64(Dates.value(x) - UNIX_EPOCH_DATETIME))
Base.convert(::Type{Timestamp{Meta.TimeUnits.MILLISECOND, TZ}}, x::ZonedDateTime) where {TZ} =
Timestamp{Meta.TimeUnits.MILLISECOND, TZ}(Int64(Dates.value(DateTime(x)) - UNIX_EPOCH_DATETIME))
Base.convert(::Type{Timestamp{Meta.TimeUnits.MILLISECOND, nothing}}, x::DateTime) =
Timestamp{Meta.TimeUnits.MILLISECOND, nothing}(Int64(Dates.value(x) - UNIX_EPOCH_DATETIME))

function arrowtype(b, ::Type{Timestamp{U, TZ}}) where {U, TZ}
tz = TZ !== nothing ? FlatBuffers.createstring!(b, String(TZ)) : FlatBuffers.UOffsetT(0)
Expand All @@ -289,11 +289,11 @@ const DATETIME_SYMBOL = Symbol("JuliaLang.DateTime")
ArrowTypes.arrowname(::Type{Dates.DateTime}) = DATETIME_SYMBOL
ArrowTypes.JuliaType(::Val{DATETIME_SYMBOL}, S) = Dates.DateTime
ArrowTypes.fromarrow(::Type{Dates.DateTime}, x::Timestamp) = convert(Dates.DateTime, x)
ArrowTypes.fromarrow(::Type{Dates.DateTime}, x::Date{Meta.DateUnit.MILLISECOND, Int64}) = convert(Dates.DateTime, x)
ArrowTypes.fromarrow(::Type{Dates.DateTime}, x::Date{Meta.DateUnits.MILLISECOND, Int64}) = convert(Dates.DateTime, x)
ArrowTypes.default(::Type{Dates.DateTime}) = Dates.DateTime(1,1,1,1,1,1)

ArrowTypes.ArrowType(::Type{ZonedDateTime}) = Timestamp
ArrowTypes.toarrow(x::ZonedDateTime) = convert(Timestamp{Meta.TimeUnit.MILLISECOND, Symbol(x.timezone)}, x)
ArrowTypes.toarrow(x::ZonedDateTime) = convert(Timestamp{Meta.TimeUnits.MILLISECOND, Symbol(x.timezone)}, x)
const ZONEDDATETIME_SYMBOL = Symbol("JuliaLang.ZonedDateTime")
ArrowTypes.arrowname(::Type{ZonedDateTime}) = ZONEDDATETIME_SYMBOL
ArrowTypes.JuliaType(::Val{ZONEDDATETIME_SYMBOL}, S) = ZonedDateTime
Expand All @@ -310,25 +310,25 @@ scan each element to check each timezone. `Arrow.ToTimestamp` provides a "bypass
first element of the `AbstractVector{ZonedDateTime}`, which in turn allows `Arrow.write` to avoid costly checking/conversion and
can encode the `ZonedDateTime` as `Arrow.Timestamp` directly.
"""
struct ToTimestamp{A, TZ} <: AbstractVector{Timestamp{Meta.TimeUnit.MILLISECOND, TZ}}
struct ToTimestamp{A, TZ} <: AbstractVector{Timestamp{Meta.TimeUnits.MILLISECOND, TZ}}
data::A # AbstractVector{ZonedDateTime}
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(::ToTimestamp{A, TZ}) where {A, TZ} = Timestamp{Meta.TimeUnits.MILLISECOND, TZ}
Base.getindex(x::ToTimestamp{A, TZ}, i::Int) where {A, TZ} = convert(Timestamp{Meta.TimeUnits.MILLISECOND, TZ}, getindex(x.data, i))

struct Interval{U, T} <: ArrowTimeType
x::T
end

Base.zero(::Type{Interval{U, T}}) where {U, T} = Interval{U, T}(T(0))

bitwidth(x::Meta.IntervalUnit) = x == Meta.IntervalUnit.YEAR_MONTH ? Int32 : Int64
Interval{Meta.IntervalUnit.YEAR_MONTH}(x) = Interval{Meta.IntervalUnit.YEAR_MONTH, Int32}(Int32(x))
Interval{Meta.IntervalUnit.DAY_TIME}(x) = Interval{Meta.IntervalUnit.DAY_TIME, Int64}(Int64(x))
bitwidth(x::Meta.IntervalUnit) = x == Meta.IntervalUnits.YEAR_MONTH ? Int32 : Int64
Interval{Meta.IntervalUnits.YEAR_MONTH}(x) = Interval{Meta.IntervalUnits.YEAR_MONTH, Int32}(Int32(x))
Interval{Meta.IntervalUnits.DAY_TIME}(x) = Interval{Meta.IntervalUnits.DAY_TIME, Int64}(Int64(x))

function juliaeltype(f::Meta.Field, x::Meta.Interval, convert)
return Interval{x.unit, bitwidth(x.unit)}
Expand Down Expand Up @@ -359,10 +359,10 @@ function arrowtype(b, ::Type{Duration{U}}) where {U}
return Meta.Duration, Meta.durationEnd(b), nothing
end

arrowperiodtype(P) = Meta.TimeUnit.SECOND
arrowperiodtype(::Type{Dates.Millisecond}) = Meta.TimeUnit.MILLISECOND
arrowperiodtype(::Type{Dates.Microsecond}) = Meta.TimeUnit.MICROSECOND
arrowperiodtype(::Type{Dates.Nanosecond}) = Meta.TimeUnit.NANOSECOND
arrowperiodtype(P) = Meta.TimeUnits.SECOND
arrowperiodtype(::Type{Dates.Millisecond}) = Meta.TimeUnits.MILLISECOND
arrowperiodtype(::Type{Dates.Microsecond}) = Meta.TimeUnits.MICROSECOND
arrowperiodtype(::Type{Dates.Nanosecond}) = Meta.TimeUnits.NANOSECOND

Base.convert(::Type{Duration{U}}, x::Dates.Period) where {U} = Duration{U}(Dates.value(periodtype(U)(x)))

Expand Down
4 changes: 2 additions & 2 deletions src/metadata/File.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Base.getproperty(x::Footer, field::Symbol)
if field === :version
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), MetadataVersion)
return MetadataVersion.V1
return MetadataVersions.V1
elseif field === :schema
o = FlatBuffers.offset(x, 6)
if o != 0
Expand Down Expand Up @@ -87,4 +87,4 @@ function createBlock(b::FlatBuffers.Builder, offset::Int64, metadatalength::Int3
prepend!(b, metadatalength)
prepend!(b, offset)
return FlatBuffers.offset(b)
end
end
6 changes: 3 additions & 3 deletions src/metadata/Message.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ function Base.getproperty(x::BodyCompression, field::Symbol)
if field === :codec
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), CompressionType)
return CompressionType.LZ4_FRAME
return CompressionTypes.LZ4_FRAME
elseif field === :method
o = FlatBuffers.offset(x, 6)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), BodyCompressionMethod)
return BodyCompressionMethod.BUFFER
return BodyCompressionMethods.BUFFER
end
return nothing
end
Expand Down Expand Up @@ -199,4 +199,4 @@ messageAddHeader(b::FlatBuffers.Builder, header::FlatBuffers.UOffsetT) = FlatBuf
messageAddBodyLength(b::FlatBuffers.Builder, bodyLength::Int64) = FlatBuffers.prependslot!(b, 3, bodyLength, 0)
messageAddCustomMetadata(b::FlatBuffers.Builder, meta::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 4, meta, 0)
messageStartCustomMetadataVector(b::FlatBuffers.Builder, numelems) = FlatBuffers.startvector!(b, 4, numelems, 4)
messageEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
messageEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
14 changes: 7 additions & 7 deletions src/metadata/Schema.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function Base.getproperty(x::Union, field::Symbol)
if field === :mode
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), UnionMode)
return UnionMode.Sparse
return UnionModes.Sparse
elseif field === :typeIds
o = FlatBuffers.offset(x, 6)
o != 0 && return FlatBuffers.Array{Int32}(x, o)
Expand Down Expand Up @@ -159,7 +159,7 @@ function Base.getproperty(x::FloatingPoint, field::Symbol)
if field === :precision
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), Precision)
return Precision.HALF
return Precisions.HALF
end
return nothing
end
Expand Down Expand Up @@ -280,7 +280,7 @@ function Base.getproperty(x::Date, field::Symbol)
if field === :unit
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), DateUnit)
return DateUnit.MILLISECOND
return DateUnits.MILLISECOND
end
return nothing
end
Expand All @@ -302,7 +302,7 @@ function Base.getproperty(x::Time, field::Symbol)
if field === :unit
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), TimeUnit)
return TimeUnit.MILLISECOND
return TimeUnits.MILLISECOND
elseif field === :bitWidth
o = FlatBuffers.offset(x, 6)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), Int32)
Expand All @@ -327,7 +327,7 @@ function Base.getproperty(x::Timestamp, field::Symbol)
if field === :unit
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), TimeUnit)
return TimeUnit.SECOND
return TimeUnits.SECOND
elseif field === :timezone
o = FlatBuffers.offset(x, 6)
o != 0 && return String(x, o + FlatBuffers.pos(x))
Expand All @@ -353,7 +353,7 @@ function Base.getproperty(x::Interval, field::Symbol)
if field === :unit
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), IntervalUnit)
return IntervalUnit.YEAR_MONTH
return IntervalUnits.YEAR_MONTH
end
return nothing
end
Expand All @@ -373,7 +373,7 @@ function Base.getproperty(x::Duration, field::Symbol)
if field === :unit
o = FlatBuffers.offset(x, 4)
o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), TimeUnit)
return TimeUnit.MILLISECOND
return TimeUnits.MILLISECOND
end
return nothing
end
Expand Down
Loading