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/05/24 23:29:09 UTC

[arrow-julia] branch jq-enumsx created (now 511f5e4)

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

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


      at 511f5e4  Remove scopedenum for EnumX

This branch includes the following new commits:

     new 511f5e4  Remove scopedenum for EnumX

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[arrow-julia] 01/01: Remove scopedenum for EnumX

Posted by qu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 511f5e4ac7fc3f3d82ec8ba045fd6732e5228eba
Author: Jacob Quinn <qu...@gmail.com>
AuthorDate: Wed May 24 17:28:32 2023 -0600

    Remove scopedenum for EnumX
    
    Successor to https://github.com/apache/arrow-julia/pull/309
---
 Project.toml                    |  24 ++-------
 src/FlatBuffers/FlatBuffers.jl  | 108 +---------------------------------------
 src/arraytypes/arraytypes.jl    |  10 ++--
 src/arraytypes/bool.jl          |   2 +-
 src/arraytypes/compressed.jl    |   6 +--
 src/arraytypes/dictencoding.jl  |   2 +-
 src/arraytypes/fixedsizelist.jl |   2 +-
 src/arraytypes/list.jl          |   2 +-
 src/arraytypes/map.jl           |   2 +-
 src/arraytypes/primitive.jl     |   2 +-
 src/arraytypes/struct.jl        |   2 +-
 src/arraytypes/unions.jl        |  12 ++---
 src/eltypes.jl                  |  74 +++++++++++++--------------
 src/metadata/File.jl            |   6 +--
 src/metadata/Flatbuf.jl         |   1 +
 src/metadata/Message.jl         |  20 ++++----
 src/metadata/Schema.jl          |  64 ++++++++++++------------
 src/table.jl                    |  12 ++---
 src/write.jl                    |   8 +--
 test/arrowjson.jl               |  28 +++++------
 test/runtests.jl                |   6 +--
 test/testtables.jl              |  12 ++---
 22 files changed, 142 insertions(+), 263 deletions(-)

diff --git a/Project.toml b/Project.toml
index 291a599..440d7da 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,20 +1,3 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
 name = "Arrow"
 uuid = "69666777-d1a9-59fb-9406-91d4454c9d45"
 authors = ["quinnj <qu...@gmail.com>"]
@@ -27,6 +10,7 @@ CodecLz4 = "5ba52731-8f18-5e0d-9241-30f10d1ec561"
 CodecZstd = "6b39b394-51ab-5f42-8807-6242bab2b4c2"
 DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
 Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
+EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
 LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
 Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
 PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
@@ -43,6 +27,7 @@ BitIntegers = "0.2, 0.3"
 CodecLz4 = "0.4"
 CodecZstd = "0.7"
 DataAPI = "1"
+EnumX = "1"
 FilePathsBase = "0.9"
 LoggingExtras = "0.4, 1"
 PooledArrays = "0.5, 1.0"
@@ -59,11 +44,10 @@ DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
 FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
 JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
 Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
-StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
 Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
+StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
 TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
 Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
 
 [targets]
-test = ["CategoricalArrays", "DataFrames", "FilePathsBase", "JSON3", "Random", "StructTypes",
-"TOML", "Test", "Sockets"]
+test = ["CategoricalArrays", "DataFrames", "FilePathsBase", "JSON3", "Random", "StructTypes", "TOML", "Test", "Sockets"]
diff --git a/src/FlatBuffers/FlatBuffers.jl b/src/FlatBuffers/FlatBuffers.jl
index cf1d5fd..7445c5f 100644
--- a/src/FlatBuffers/FlatBuffers.jl
+++ b/src/FlatBuffers/FlatBuffers.jl
@@ -24,6 +24,7 @@ const VOffsetT = UInt16
 const VtableMetadataFields = 2
 
 basetype(::Enum) = UInt8
+basetype(::Type{T}) where {T <: Enum{S}} where {S} = S
 
 function readbuffer(t::AbstractVector{UInt8}, pos::Integer, ::Type{Bool})
     @inbounds b = t[pos + 1]
@@ -49,111 +50,4 @@ function Base.show(io::IO, x::TableOrStruct)
     end
 end
 
-abstract type ScopedEnum{T<:Integer} <: Enum{T} end
-
-macro scopedenum(T, syms...)
-    if isempty(syms)
-        throw(ArgumentError("no arguments given for ScopedEnum $T"))
-    end
-    basetype = Int32
-    typename = T
-    if isa(T, Expr) && T.head === :(::) && length(T.args) == 2 && isa(T.args[1], Symbol)
-        typename = T.args[1]
-        basetype = Core.eval(__module__, T.args[2])
-        if !isa(basetype, DataType) || !(basetype <: Integer) || !isbitstype(basetype)
-            throw(ArgumentError("invalid base type for ScopedEnum $typename, $T=::$basetype; base type must be an integer primitive type"))
-        end
-    elseif !isa(T, Symbol)
-        throw(ArgumentError("invalid type expression for ScopedEnum $T"))
-    end
-    values = basetype[]
-    seen = Set{Symbol}()
-    namemap = Dict{basetype,Symbol}()
-    lo = hi = 0
-    i = zero(basetype)
-    hasexpr = false
-
-    if length(syms) == 1 && syms[1] isa Expr && syms[1].head === :block
-        syms = syms[1].args
-    end
-    for s in syms
-        s isa LineNumberNode && continue
-        if isa(s, Symbol)
-            if i == typemin(basetype) && !isempty(values)
-                throw(ArgumentError("overflow in value \"$s\" of ScopedEnum $typename"))
-            end
-        elseif isa(s, Expr) &&
-               (s.head === :(=) || s.head === :kw) &&
-               length(s.args) == 2 && isa(s.args[1], Symbol)
-            i = Core.eval(__module__, s.args[2]) # allow exprs, e.g. uint128"1"
-            if !isa(i, Integer)
-                throw(ArgumentError("invalid value for ScopedEnum $typename, $s; values must be integers"))
-            end
-            i = convert(basetype, i)
-            s = s.args[1]
-            hasexpr = true
-        else
-            throw(ArgumentError(string("invalid argument for ScopedEnum ", typename, ": ", s)))
-        end
-        if !Base.isidentifier(s)
-            throw(ArgumentError("invalid name for ScopedEnum $typename; \"$s\" is not a valid identifier"))
-        end
-        if hasexpr && haskey(namemap, i)
-            throw(ArgumentError("both $s and $(namemap[i]) have value $i in ScopedEnum $typename; values must be unique"))
-        end
-        namemap[i] = s
-        push!(values, i)
-        if s in seen
-            throw(ArgumentError("name \"$s\" in ScopedEnum $typename is not unique"))
-        end
-        push!(seen, s)
-        if length(values) == 1
-            lo = hi = i
-        else
-            lo = min(lo, i)
-            hi = max(hi, i)
-        end
-        i += oneunit(i)
-    end
-    defs = Expr(:block)
-    if isa(typename, Symbol)
-        for (i, sym) in namemap
-            push!(defs.args, :(const $(esc(sym)) = $(esc(typename))($i)))
-        end
-    end
-    _typename_str = string(typename)
-    mod = Symbol(_typename_str, last(_typename_str) == 's' ? "es" : "s")
-    syms = Tuple(Base.values(namemap))
-    blk = quote
-        module $(esc(mod))
-            export $(esc(typename))
-            # enum definition
-            primitive type $(esc(typename)) <: ScopedEnum{$(basetype)} $(sizeof(basetype) * 8) end
-            function $(esc(typename))(x::Integer)
-                $(Base.Enums.membershiptest(:x, values)) || Base.Enums.enum_argument_error($(Expr(:quote, typename)), x)
-                return Core.bitcast($(esc(typename)), convert($(basetype), x))
-            end
-            if isdefined(Base.Enums, :namemap)
-                Base.Enums.namemap(::Type{$(esc(typename))}) = $(esc(namemap))
-            end
-            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 ]...,)
-                Base.instances(::Type{$(esc(typename))}) = insts
-            end
-            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
-
 end # module
diff --git a/src/arraytypes/arraytypes.jl b/src/arraytypes/arraytypes.jl
index f3cee5d..3bbfd0e 100644
--- a/src/arraytypes/arraytypes.jl
+++ b/src/arraytypes/arraytypes.jl
@@ -36,13 +36,13 @@ function toarrowvector(x, i=1, de=Dict{Int64, Any}(), ded=DictEncoding[], meta=g
     @debugv 3 x
     A = arrowvector(x, i, 0, 0, de, ded, meta; compression=compression, kw...)
     if compression isa LZ4FrameCompressor
-        A = compress(Meta.CompressionTypes.LZ4_FRAME, compression, A)
+        A = compress(Meta.CompressionType.LZ4_FRAME, compression, A)
     elseif compression isa Vector{LZ4FrameCompressor}
-        A = compress(Meta.CompressionTypes.LZ4_FRAME, compression[Threads.threadid()], A)
+        A = compress(Meta.CompressionType.LZ4_FRAME, compression[Threads.threadid()], A)
     elseif compression isa ZstdCompressor
-        A = compress(Meta.CompressionTypes.ZSTD, compression, A)
+        A = compress(Meta.CompressionType.ZSTD, compression, A)
     elseif compression isa Vector{ZstdCompressor}
-        A = compress(Meta.CompressionTypes.ZSTD, compression[Threads.threadid()], A)
+        A = compress(Meta.CompressionType.ZSTD, compression[Threads.threadid()], A)
     end
     @debugv 2 "converted top-level column to arrow format: $(typeof(A))"
     @debugv 3 A
@@ -99,7 +99,7 @@ Base.size(v::NullVector) = (length(v.data),)
 Base.getindex(v::NullVector{T}, i::Int) where {T} = ArrowTypes.fromarrow(T, getindex(v.data, i))
 
 arrowvector(::NullKind, x, i, nl, fi, de, ded, meta; kw...) = NullVector{eltype(x)}(MissingVector(length(x)), isnothing(meta) ? nothing : toidict(meta))
-compress(Z::Meta.CompressionType, comp, v::NullVector) =
+compress(Z::Meta.CompressionType.T, comp, v::NullVector) =
     Compressed{Z, NullVector}(v, CompressedBuffer[], length(v), length(v), Compressed[])
 
 function makenodesbuffers!(col::NullVector, fieldnodes, fieldbuffers, bufferoffset, alignment)
diff --git a/src/arraytypes/bool.jl b/src/arraytypes/bool.jl
index 1b1239e..3ef44c8 100644
--- a/src/arraytypes/bool.jl
+++ b/src/arraytypes/bool.jl
@@ -77,7 +77,7 @@ function arrowvector(::BoolKind, x, i, nl, fi, de, ded, meta; kw...)
     return BoolVector{eltype(x)}(bytes, 1, validity, len, meta)
 end
 
-function compress(Z::Meta.CompressionType, comp, p::P) where {P <: BoolVector}
+function compress(Z::Meta.CompressionType.T, comp, p::P) where {P <: BoolVector}
     len = length(p)
     nc = nullcount(p)
     validity = compress(Z, comp, p.validity)
diff --git a/src/arraytypes/compressed.jl b/src/arraytypes/compressed.jl
index bbb6680..3511412 100644
--- a/src/arraytypes/compressed.jl
+++ b/src/arraytypes/compressed.jl
@@ -39,16 +39,16 @@ Base.eltype(c::Compressed{Z, A}) where {Z, A} = eltype(A)
 getmetadata(x::Compressed) = getmetadata(x.data)
 compressiontype(c::Compressed{Z}) where {Z} = Z
 
-function compress(Z::Meta.CompressionType, comp, x::Array)
+function compress(Z::Meta.CompressionType.T, comp, x::Array)
     GC.@preserve x begin
         y = unsafe_wrap(Array, convert(Ptr{UInt8}, pointer(x)), sizeof(x))
         return CompressedBuffer(transcode(comp, y), length(y))
     end
 end
 
-compress(Z::Meta.CompressionType, comp, x) = compress(Z, comp, convert(Array, x))
+compress(Z::Meta.CompressionType.T, comp, x) = compress(Z, comp, convert(Array, x))
 
-compress(Z::Meta.CompressionType, comp, v::ValidityBitmap) =
+compress(Z::Meta.CompressionType.T, comp, v::ValidityBitmap) =
     v.nc == 0 ? CompressedBuffer(UInt8[], 0) : compress(Z, comp, view(v.bytes, v.pos:(v.pos + cld(v.ℓ, 8) - 1)))
 
 function makenodesbuffers!(col::Compressed, fieldnodes, fieldbuffers, bufferoffset, alignment)
diff --git a/src/arraytypes/dictencoding.jl b/src/arraytypes/dictencoding.jl
index 6477489..7b4784f 100644
--- a/src/arraytypes/dictencoding.jl
+++ b/src/arraytypes/dictencoding.jl
@@ -271,7 +271,7 @@ function Base.copy(x::DictEncoded{T, S}) where {T, S}
     return PooledArray(PooledArrays.RefArray(refs), Dict{T, S}(val => i for (i, val) in enumerate(pool)), pool)
 end
 
-function compress(Z::Meta.CompressionType, comp, x::A) where {A <: DictEncoded}
+function compress(Z::Meta.CompressionType.T, comp, x::A) where {A <: DictEncoded}
     len = length(x)
     nc = nullcount(x)
     validity = compress(Z, comp, x.validity)
diff --git a/src/arraytypes/fixedsizelist.jl b/src/arraytypes/fixedsizelist.jl
index 4246008..6c54f28 100644
--- a/src/arraytypes/fixedsizelist.jl
+++ b/src/arraytypes/fixedsizelist.jl
@@ -121,7 +121,7 @@ function arrowvector(::FixedSizeListKind{N, T}, x, i, nl, fi, de, ded, meta; kw.
     return FixedSizeList{S, typeof(data)}(UInt8[], validity, data, len, meta)
 end
 
-function compress(Z::Meta.CompressionType, comp, x::FixedSizeList{T, A}) where {T, A}
+function compress(Z::Meta.CompressionType.T, comp, x::FixedSizeList{T, A}) where {T, A}
     len = length(x)
     nc = nullcount(x)
     validity = compress(Z, comp, x.validity)
diff --git a/src/arraytypes/list.jl b/src/arraytypes/list.jl
index 2275f9f..df66f1f 100644
--- a/src/arraytypes/list.jl
+++ b/src/arraytypes/list.jl
@@ -223,7 +223,7 @@ function arrowvector(::ListKind, x, i, nl, fi, de, ded, meta; largelists::Bool=f
     return List{T, eltype(flat.inds), typeof(data)}(UInt8[], validity, offsets, data, len, meta)
 end
 
-function compress(Z::Meta.CompressionType, comp, x::List{T, O, A}) where {T, O, A}
+function compress(Z::Meta.CompressionType.T, comp, x::List{T, O, A}) where {T, O, A}
     len = length(x)
     nc = nullcount(x)
     validity = compress(Z, comp, x.validity)
diff --git a/src/arraytypes/map.jl b/src/arraytypes/map.jl
index 8140b25..30d71cc 100644
--- a/src/arraytypes/map.jl
+++ b/src/arraytypes/map.jl
@@ -64,7 +64,7 @@ function arrowvector(::MapKind, x, i, nl, fi, de, ded, meta; largelists::Bool=fa
     return Map{withmissing(ET, Dict{K, V}), eltype(flat.inds), typeof(data)}(validity, offsets, data, len, meta)
 end
 
-function compress(Z::Meta.CompressionType, comp, x::A) where {A <: Map}
+function compress(Z::Meta.CompressionType.T, comp, x::A) where {A <: Map}
     len = length(x)
     nc = nullcount(x)
     validity = compress(Z, comp, x.validity)
diff --git a/src/arraytypes/primitive.jl b/src/arraytypes/primitive.jl
index aca060b..7d9f61b 100644
--- a/src/arraytypes/primitive.jl
+++ b/src/arraytypes/primitive.jl
@@ -70,7 +70,7 @@ function arrowvector(::PrimitiveKind, x, i, nl, fi, de, ded, meta; kw...)
     return Primitive(eltype(x), UInt8[], validity, x, length(x), meta)
 end
 
-function compress(Z::Meta.CompressionType, comp, p::P) where {P <: Primitive}
+function compress(Z::Meta.CompressionType.T, comp, p::P) where {P <: Primitive}
     len = length(p)
     nc = nullcount(p)
     validity = compress(Z, comp, p.validity)
diff --git a/src/arraytypes/struct.jl b/src/arraytypes/struct.jl
index 806c58d..2b38847 100644
--- a/src/arraytypes/struct.jl
+++ b/src/arraytypes/struct.jl
@@ -94,7 +94,7 @@ function arrowvector(::StructKind, x, i, nl, fi, de, ded, meta; kw...)
     return Struct{withmissing(eltype(x), namedtupletype(T, data)), typeof(data)}(validity, data, len, meta)
 end
 
-function compress(Z::Meta.CompressionType, comp, x::A) where {A <: Struct}
+function compress(Z::Meta.CompressionType.T, comp, x::A) where {A <: Struct}
     len = length(x)
     nc = nullcount(x)
     validity = compress(Z, comp, x.validity)
diff --git a/src/arraytypes/unions.jl b/src/arraytypes/unions.jl
index 6b43ec7..d759fbf 100644
--- a/src/arraytypes/unions.jl
+++ b/src/arraytypes/unions.jl
@@ -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.UnionModes.Dense or Meta.UnionModes.Sparse,
+# here, T is Meta.UnionMode.Dense or Meta.UnionMode.Sparse,
 # typeIds is a NTuple{N, Int32}, and U is a Tuple{...} of the
 # unioned types
 struct UnionT{T, typeIds, U}
@@ -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.UnionModes.Dense, nothing, U}}
+struct DenseUnionVector{T, U} <: AbstractVector{UnionT{Meta.UnionMode.Dense, nothing, U}}
     itr::T
 end
 
@@ -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.UnionModes.Sparse, nothing, U}}
+struct SparseUnionVector{T, U} <: AbstractVector{UnionT{Meta.UnionMode.Sparse, nothing, U}}
     itr::T
 end
 
@@ -160,7 +160,7 @@ Base.@propagate_inbounds function Base.getindex(A::ToSparseUnion{T}, i::Integer)
     return @inbounds x isa T ? x : ArrowTypes.default(T)
 end
 
-function compress(Z::Meta.CompressionType, comp, x::A) where {A <: DenseUnion}
+function compress(Z::Meta.CompressionType.T, comp, x::A) where {A <: DenseUnion}
     len = length(x)
     nc = nullcount(x)
     typeIds = compress(Z, comp, x.typeIds)
@@ -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.UnionModes.Dense
+    if unionmode(UT) == Meta.UnionMode.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))
@@ -229,7 +229,7 @@ function arrowvector(::UnionKind, x, i, nl, fi, de, ded, meta; kw...)
     end
 end
 
-function compress(Z::Meta.CompressionType, comp, x::A) where {A <: SparseUnion}
+function compress(Z::Meta.CompressionType.T, comp, x::A) where {A <: SparseUnion}
     len = length(x)
     nc = nullcount(x)
     typeIds = compress(Z, comp, x.typeIds)
diff --git a/src/eltypes.jl b/src/eltypes.jl
index 11a845f..ce3c16e 100644
--- a/src/eltypes.jl
+++ b/src/eltypes.jl
@@ -109,18 +109,18 @@ end
 
 # primitive types
 function juliaeltype(f::Meta.Field, fp::Meta.FloatingPoint, convert)
-    if fp.precision == Meta.Precisions.HALF
+    if fp.precision == Meta.Precision.HALF
         Float16
-    elseif fp.precision == Meta.Precisions.SINGLE
+    elseif fp.precision == Meta.Precision.SINGLE
         Float32
-    elseif fp.precision == Meta.Precisions.DOUBLE
+    elseif fp.precision == Meta.Precision.DOUBLE
         Float64
     end
 end
 
 function arrowtype(b, ::Type{T}) where {T <: AbstractFloat}
     Meta.floatingPointStart(b)
-    Meta.floatingPointAddPrecision(b, T === Float16 ? Meta.Precisions.HALF : T === Float32 ? Meta.Precisions.SINGLE : Meta.Precisions.DOUBLE)
+    Meta.floatingPointAddPrecision(b, T === Float16 ? Meta.Precision.HALF : T === Float32 ? Meta.Precision.SINGLE : Meta.Precision.DOUBLE)
     return Meta.FloatingPoint, Meta.floatingPointEnd(b), nothing
 end
 
@@ -175,18 +175,18 @@ struct Date{U, T} <: ArrowTimeType
     x::T
 end
 
-const DATE = Date{Meta.DateUnits.DAY, Int32}
+const DATE = Date{Meta.DateUnit.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.DateUnits.DAY ? Int32 : Int64
-Date{Meta.DateUnits.DAY}(days) = DATE(Int32(days))
-Date{Meta.DateUnits.MILLISECOND}(ms) = Date{Meta.DateUnits.MILLISECOND, Int64}(Int64(ms))
+bitwidth(x::Meta.DateUnit.T) = 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))
 
 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.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)))
+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)))
 
 function arrowtype(b, ::Type{Date{U, T}}) where {U, T}
     Meta.dateStart(b)
@@ -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.DateUnits.MILLISECOND, Int64}}, x::Dates.DateTime) = Date{Meta.DateUnits.MILLISECOND, Int64}(Int64(Dates.value(x) - UNIX_EPOCH_DATETIME))
+Base.convert(::Type{Date{Meta.DateUnit.MILLISECOND, Int64}}, x::Dates.DateTime) = Date{Meta.DateUnit.MILLISECOND, Int64}(Int64(Dates.value(x) - UNIX_EPOCH_DATETIME))
 
 ArrowTypes.ArrowType(::Type{Dates.Date}) = DATE
 ArrowTypes.toarrow(x::Dates.Date) = convert(DATE, x)
@@ -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.TimeUnits.NANOSECOND, Int64}
+const TIME = Time{Meta.TimeUnit.NANOSECOND, 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))
+bitwidth(x::Meta.TimeUnit.T) = x == Meta.TimeUnit.SECOND || x == Meta.TimeUnit.MILLISECOND ? Int32 : Int64
+Time{U}(x) where {U <: Meta.TimeUnit.T} = 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.TimeUnits.SECOND ? Dates.Second :
-                               U === Meta.TimeUnits.MILLISECOND ? Dates.Millisecond :
-                               U === Meta.TimeUnits.MICROSECOND ? Dates.Microsecond : Dates.Nanosecond
+periodtype(U::Meta.TimeUnit.T) = U === Meta.TimeUnit.SECOND ? Dates.Second :
+                               U === Meta.TimeUnit.MILLISECOND ? Dates.Millisecond :
+                               U === Meta.TimeUnit.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}
@@ -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.TimeUnits.MILLISECOND, nothing}
+const DATETIME = Timestamp{Meta.TimeUnit.MILLISECOND, nothing}
 
 finaljuliatype(::Type{Timestamp{U, TZ}}) where {U, TZ} = ZonedDateTime
 finaljuliatype(::Type{Timestamp{U, nothing}}) where {U} = DateTime
@@ -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.TimeUnits.MICROSECOND || U == Meta.TimeUnits.NANOSECOND) && warntimestamp(U, ZonedDateTime)
+    (U === Meta.TimeUnit.MICROSECOND || U == Meta.TimeUnit.NANOSECOND) && warntimestamp(U, ZonedDateTime)
     return ZonedDateTime(Dates.DateTime(Dates.UTM(Int64(Dates.toms(periodtype(U)(x.x)) + UNIX_EPOCH_DATETIME))), TimeZone(String(TZ)); from_utc=true)
 end
 
 function Base.convert(::Type{DateTime}, x::Timestamp{U, nothing}) where {U}
-    (U === Meta.TimeUnits.MICROSECOND || U == Meta.TimeUnits.NANOSECOND) && warntimestamp(U, DateTime)
+    (U === Meta.TimeUnit.MICROSECOND || U == Meta.TimeUnit.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.TimeUnits.MILLISECOND, TZ}}, x::ZonedDateTime) where {TZ} =
-    Timestamp{Meta.TimeUnits.MILLISECOND, TZ}(Int64(Dates.value(DateTime(x, UTC)) - 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))
+Base.convert(::Type{Timestamp{Meta.TimeUnit.MILLISECOND, TZ}}, x::ZonedDateTime) where {TZ} =
+    Timestamp{Meta.TimeUnit.MILLISECOND, TZ}(Int64(Dates.value(DateTime(x, UTC)) - 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))
 
 function arrowtype(b, ::Type{Timestamp{U, TZ}}) where {U, TZ}
     tz = TZ !== nothing ? FlatBuffers.createstring!(b, String(TZ)) : FlatBuffers.UOffsetT(0)
@@ -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.DateUnits.MILLISECOND, Int64}) = convert(Dates.DateTime, x)
+ArrowTypes.fromarrow(::Type{Dates.DateTime}, x::Date{Meta.DateUnit.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.TimeUnits.MILLISECOND, Symbol(x.timezone)}, x)
+ArrowTypes.toarrow(x::ZonedDateTime) = convert(Timestamp{Meta.TimeUnit.MILLISECOND, Symbol(x.timezone)}, x)
 const ZONEDDATETIME_SYMBOL = Symbol("JuliaLang.ZonedDateTime-UTC")
 ArrowTypes.arrowname(::Type{ZonedDateTime}) = ZONEDDATETIME_SYMBOL
 ArrowTypes.JuliaType(::Val{ZONEDDATETIME_SYMBOL}, S) = ZonedDateTime
@@ -306,7 +306,7 @@ const OLD_ZONEDDATETIME_SYMBOL = Symbol("JuliaLang.ZonedDateTime")
 struct LocalZonedDateTime end
 ArrowTypes.JuliaType(::Val{OLD_ZONEDDATETIME_SYMBOL}, S) = LocalZonedDateTime
 function ArrowTypes.fromarrow(::Type{LocalZonedDateTime}, x::Timestamp{U, TZ}) where {U, TZ}
-    (U === Meta.TimeUnits.MICROSECOND || U == Meta.TimeUnits.NANOSECOND) && warntimestamp(U, ZonedDateTime)
+    (U === Meta.TimeUnit.MICROSECOND || U == Meta.TimeUnit.NANOSECOND) && warntimestamp(U, ZonedDateTime)
     return ZonedDateTime(Dates.DateTime(Dates.UTM(Int64(Dates.toms(periodtype(U)(x.x)) + UNIX_EPOCH_DATETIME))), TimeZone(String(TZ)))
 end
 
@@ -321,15 +321,15 @@ 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.TimeUnits.MILLISECOND, TZ}}
+struct ToTimestamp{A, TZ} <: AbstractVector{Timestamp{Meta.TimeUnit.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.TimeUnits.MILLISECOND, TZ}
-Base.getindex(x::ToTimestamp{A, TZ}, i::Int) where {A, TZ} = convert(Timestamp{Meta.TimeUnits.MILLISECOND, TZ}, getindex(x.data, i))
+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))
 
 struct Interval{U, T} <: ArrowTimeType
     x::T
@@ -337,9 +337,9 @@ end
 
 Base.zero(::Type{Interval{U, T}}) where {U, T} = Interval{U, T}(T(0))
 
-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))
+bitwidth(x::Meta.IntervalUnit.T) = 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))
 
 function juliaeltype(f::Meta.Field, x::Meta.Interval, convert)
     return Interval{x.unit, bitwidth(x.unit)}
@@ -372,10 +372,10 @@ end
 
 arrowtype(b, ::Type{P}) where {P <: Dates.Period} = arrowtype(b, Duration{arrowperiodtype(P)})
 
-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
+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
 
 Base.convert(::Type{Duration{U}}, x::Dates.Period) where {U} = Duration{U}(Dates.value(periodtype(U)(x)))
 
diff --git a/src/metadata/File.jl b/src/metadata/File.jl
index 6ad33ba..301a23c 100644
--- a/src/metadata/File.jl
+++ b/src/metadata/File.jl
@@ -24,8 +24,8 @@ Base.propertynames(x::Footer) = (:version, :schema, :dictionaries, :recordBatche
 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 MetadataVersions.V1
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), MetadataVersion.T)
+        return MetadataVersion.V1
     elseif field === :schema
         o = FlatBuffers.offset(x, 6)
         if o != 0
@@ -52,7 +52,7 @@ function Base.getproperty(x::Footer, field::Symbol)
 end
 
 footerStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 4)
-footerAddVersion(b::FlatBuffers.Builder, version::MetadataVersion) = FlatBuffers.prependslot!(b, 0, version, 0)
+footerAddVersion(b::FlatBuffers.Builder, version::MetadataVersion.T) = FlatBuffers.prependslot!(b, 0, version, 0)
 footerAddSchema(b::FlatBuffers.Builder, schema::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 1, schema, 0)
 footerAddDictionaries(b::FlatBuffers.Builder, dictionaries::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 2, dictionaries, 0)
 footerStartDictionariesVector(b::FlatBuffers.Builder, numelems) = FlatBuffers.startvector!(b, 24, numelems, 8)
diff --git a/src/metadata/Flatbuf.jl b/src/metadata/Flatbuf.jl
index a69230d..127e91b 100644
--- a/src/metadata/Flatbuf.jl
+++ b/src/metadata/Flatbuf.jl
@@ -16,6 +16,7 @@
 
 module Flatbuf
 
+using EnumX
 using ..FlatBuffers
 
 include("Schema.jl")
diff --git a/src/metadata/Message.jl b/src/metadata/Message.jl
index 6af3a6e..95c4675 100644
--- a/src/metadata/Message.jl
+++ b/src/metadata/Message.jl
@@ -39,9 +39,9 @@ function createFieldNode(b::FlatBuffers.Builder, length::Int64, nullCount::Int64
     return FlatBuffers.offset(b)
 end
 
-FlatBuffers.@scopedenum CompressionType::Int8 LZ4_FRAME ZSTD
+@enumx CompressionType::Int8 LZ4_FRAME ZSTD
 
-FlatBuffers.@scopedenum BodyCompressionMethod::Int8 BUFFER
+@enumx BodyCompressionMethod::Int8 BUFFER
 
 struct BodyCompression <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -53,19 +53,19 @@ Base.propertynames(x::BodyCompression) = (:codec, :method)
 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 CompressionTypes.LZ4_FRAME
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), CompressionType.T)
+        return CompressionType.LZ4_FRAME
     elseif field === :method
         o = FlatBuffers.offset(x, 6)
-        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), BodyCompressionMethod)
-        return BodyCompressionMethods.BUFFER
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), BodyCompressionMethod.T)
+        return BodyCompressionMethod.BUFFER
     end
     return nothing
 end
 
 bodyCompressionStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 2)
-bodyCompressionAddCodec(b::FlatBuffers.Builder, codec::CompressionType) = FlatBuffers.prependslot!(b, 0, codec, 0)
-bodyCompressionAddMethod(b::FlatBuffers.Builder, method::BodyCompressionMethod) = FlatBuffers.prependslot!(b, 1, method, 0)
+bodyCompressionAddCodec(b::FlatBuffers.Builder, codec::CompressionType.T) = FlatBuffers.prependslot!(b, 0, codec, 0)
+bodyCompressionAddMethod(b::FlatBuffers.Builder, method::BodyCompressionMethod.T) = FlatBuffers.prependslot!(b, 1, method, 0)
 bodyCompressionEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
 struct RecordBatch <: FlatBuffers.Table
@@ -168,7 +168,7 @@ Base.propertynames(x::Message) = (:version, :header, :bodyLength, :custom_metada
 function Base.getproperty(x::Message, field::Symbol)
     if field === :version
         o = FlatBuffers.offset(x, 4)
-        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), MetadataVersion)
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), MetadataVersion.T)
     elseif field === :header
         o = FlatBuffers.offset(x, 6)
         if o != 0
@@ -193,7 +193,7 @@ function Base.getproperty(x::Message, field::Symbol)
 end
 
 messageStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 5)
-messageAddVersion(b::FlatBuffers.Builder, version::MetadataVersion) = FlatBuffers.prependslot!(b, 0, version, 0)
+messageAddVersion(b::FlatBuffers.Builder, version::MetadataVersion.T) = FlatBuffers.prependslot!(b, 0, version, 0)
 messageAddHeaderType(b::FlatBuffers.Builder, ::Core.Type{T}) where {T} = FlatBuffers.prependslot!(b, 1, MessageHeader(T), 0)
 messageAddHeader(b::FlatBuffers.Builder, header::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 2, header, 0)
 messageAddBodyLength(b::FlatBuffers.Builder, bodyLength::Int64) = FlatBuffers.prependslot!(b, 3, bodyLength, 0)
diff --git a/src/metadata/Schema.jl b/src/metadata/Schema.jl
index d09b648..b8f321a 100644
--- a/src/metadata/Schema.jl
+++ b/src/metadata/Schema.jl
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FlatBuffers.@scopedenum MetadataVersion::Int16 V1 V2 V3 V4 V5
+@enumx MetadataVersion::Int16 V1 V2 V3 V4 V5
 
 struct Null <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -95,7 +95,7 @@ mapStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 1)
 mapAddKeysSorted(b::FlatBuffers.Builder, keyssorted::Base.Bool) = FlatBuffers.prependslot!(b, 0, keyssorted, 0)
 mapEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum UnionMode::Int16 Sparse Dense
+@enumx UnionMode::Int16 Sparse Dense
 
 struct Union <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -107,8 +107,8 @@ Base.propertynames(x::Union) = (:mode, :typeIds)
 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 UnionModes.Sparse
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), UnionMode.T)
+        return UnionMode.Sparse
     elseif field === :typeIds
         o = FlatBuffers.offset(x, 6)
         o != 0 && return FlatBuffers.Array{Int32}(x, o)
@@ -117,7 +117,7 @@ function Base.getproperty(x::Union, field::Symbol)
 end
 
 unionStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 2)
-unionAddMode(b::FlatBuffers.Builder, mode::UnionMode) = FlatBuffers.prependslot!(b, 0, mode, 0)
+unionAddMode(b::FlatBuffers.Builder, mode::UnionMode.T) = FlatBuffers.prependslot!(b, 0, mode, 0)
 unionAddTypeIds(b::FlatBuffers.Builder, typeIds::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 1, typeIds, 0)
 unionStartTypeIdsVector(b::FlatBuffers.Builder, numelems) = FlatBuffers.startvector!(b, 4, numelems, 4)
 unionEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
@@ -146,7 +146,7 @@ intAddBitWidth(b::FlatBuffers.Builder, bitwidth::Int32) = FlatBuffers.prependslo
 intAddIsSigned(b::FlatBuffers.Builder, issigned::Base.Bool) = FlatBuffers.prependslot!(b, 1, issigned, 0)
 intEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum Precision::Int16 HALF SINGLE DOUBLE
+@enumx Precision::Int16 HALF SINGLE DOUBLE
 
 struct FloatingPoint <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -158,14 +158,14 @@ Base.propertynames(x::FloatingPoint) = (:precision,)
 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 Precisions.HALF
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), Precision.T)
+        return Precision.HALF
     end
     return nothing
 end
 
 floatingPointStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 1)
-floatingPointAddPrecision(b::FlatBuffers.Builder, precision::Precision) = FlatBuffers.prependslot!(b, 0, precision, 0)
+floatingPointAddPrecision(b::FlatBuffers.Builder, precision::Precision.T) = FlatBuffers.prependslot!(b, 0, precision, 0)
 floatingPointEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
 struct Utf8 <: FlatBuffers.Table
@@ -267,7 +267,7 @@ decimalAddScale(b::FlatBuffers.Builder, scale::Int32) = FlatBuffers.prependslot!
 decimalAddBitWidth(b::FlatBuffers.Builder, bitWidth::Int32) = FlatBuffers.prependslot!(b, 2, bitWidth, Int32(128))
 decimalEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum DateUnit::Int16 DAY MILLISECOND
+@enumx DateUnit::Int16 DAY MILLISECOND
 
 struct Date <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -279,17 +279,17 @@ Base.propertynames(x::Date) = (:unit,)
 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 DateUnits.MILLISECOND
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), DateUnit.T)
+        return DateUnit.MILLISECOND
     end
     return nothing
 end
 
 dateStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 1)
-dateAddUnit(b::FlatBuffers.Builder, unit::DateUnit) = FlatBuffers.prependslot!(b, 0, unit, 1)
+dateAddUnit(b::FlatBuffers.Builder, unit::DateUnit.T) = FlatBuffers.prependslot!(b, 0, unit, 1)
 dateEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum TimeUnit::Int16 SECOND MILLISECOND MICROSECOND NANOSECOND
+@enumx TimeUnit::Int16 SECOND MILLISECOND MICROSECOND NANOSECOND
 
 struct Time <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -301,8 +301,8 @@ Base.propertynames(x::Time) = (:unit, :bitWidth)
 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 TimeUnits.MILLISECOND
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), TimeUnit.T)
+        return TimeUnit.MILLISECOND
     elseif field === :bitWidth
         o = FlatBuffers.offset(x, 6)
         o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), Int32)
@@ -312,7 +312,7 @@ function Base.getproperty(x::Time, field::Symbol)
 end
 
 timeStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 2)
-timeAddUnit(b::FlatBuffers.Builder, unit::TimeUnit) = FlatBuffers.prependslot!(b, 0, unit, 1)
+timeAddUnit(b::FlatBuffers.Builder, unit::TimeUnit.T) = FlatBuffers.prependslot!(b, 0, unit, 1)
 timeAddBitWidth(b::FlatBuffers.Builder, bitwidth::Int32) = FlatBuffers.prependslot!(b, 1, bitwidth, 32)
 timeEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
@@ -326,8 +326,8 @@ Base.propertynames(x::Timestamp) = (:unit, :timezone)
 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 TimeUnits.SECOND
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), TimeUnit.T)
+        return TimeUnit.SECOND
     elseif field === :timezone
         o = FlatBuffers.offset(x, 6)
         o != 0 && return String(x, o + FlatBuffers.pos(x))
@@ -336,11 +336,11 @@ function Base.getproperty(x::Timestamp, field::Symbol)
 end
 
 timestampStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 2)
-timestampAddUnit(b::FlatBuffers.Builder, unit::TimeUnit) = FlatBuffers.prependslot!(b, 0, unit, 0)
+timestampAddUnit(b::FlatBuffers.Builder, unit::TimeUnit.T) = FlatBuffers.prependslot!(b, 0, unit, 0)
 timestampAddTimezone(b::FlatBuffers.Builder, timezone::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 1, timezone, 0)
 timestampEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum IntervalUnit::Int16 YEAR_MONTH DAY_TIME
+@enumx IntervalUnit::Int16 YEAR_MONTH DAY_TIME
 
 struct Interval <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -352,14 +352,14 @@ Base.propertynames(x::Interval) = (:unit,)
 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 IntervalUnits.YEAR_MONTH
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), IntervalUnit.T)
+        return IntervalUnit.YEAR_MONTH
     end
     return nothing
 end
 
 intervalStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 1)
-intervalAddUnit(b::FlatBuffers.Builder, unit::IntervalUnit) = FlatBuffers.prependslot!(b, 0, unit, 0)
+intervalAddUnit(b::FlatBuffers.Builder, unit::IntervalUnit.T) = FlatBuffers.prependslot!(b, 0, unit, 0)
 intervalEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
 struct Duration <: FlatBuffers.Table
@@ -372,14 +372,14 @@ Base.propertynames(x::Duration) = (:unit,)
 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 TimeUnits.MILLISECOND
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), TimeUnit.T)
+        return TimeUnit.MILLISECOND
     end
     return nothing
 end
 
 durationStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 1)
-durationAddUnit(b::FlatBuffers.Builder, unit::TimeUnit) = FlatBuffers.prependslot!(b, 0, unit, 1)
+durationAddUnit(b::FlatBuffers.Builder, unit::TimeUnit.T) = FlatBuffers.prependslot!(b, 0, unit, 1)
 durationEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
 function Type(b::UInt8)
@@ -455,7 +455,7 @@ keyValueAddKey(b::FlatBuffers.Builder, key::FlatBuffers.UOffsetT) = FlatBuffers.
 keyValueAddValue(b::FlatBuffers.Builder, value::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 1, value, 0)
 keyValueEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum DictionaryKind::Int16 DenseArray
+@enumx DictionaryKind::Int16 DenseArray
 
 struct DictionaryEncoding <: FlatBuffers.Table
     bytes::Vector{UInt8}
@@ -481,7 +481,7 @@ function Base.getproperty(x::DictionaryEncoding, field::Symbol)
         return false
     elseif field === :dictionaryKind
         o = FlatBuffers.offset(x, 10)
-        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), DictionaryKind)
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), DictionaryKind.T)
     end
     return nothing
 end
@@ -549,7 +549,7 @@ fieldAddCustomMetadata(b::FlatBuffers.Builder, custommetadata::FlatBuffers.UOffs
 fieldStartCustomMetadataVector(b::FlatBuffers.Builder, numelems) = FlatBuffers.startvector!(b, 4, numelems, 4)
 fieldEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
 
-FlatBuffers.@scopedenum Endianness::Int16 Little Big
+@enumx Endianness::Int16 Little Big
 
 struct Buffer <: FlatBuffers.Struct
     bytes::Vector{UInt8}
@@ -586,7 +586,7 @@ Base.propertynames(x::Schema) = (:endianness, :fields, :custom_metadata)
 function Base.getproperty(x::Schema, field::Symbol)
     if field === :endianness
         o = FlatBuffers.offset(x, 4)
-        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), Endianness)
+        o != 0 && return FlatBuffers.get(x, o + FlatBuffers.pos(x), Endianness.T)
     elseif field === :fields
         o = FlatBuffers.offset(x, 6)
         if o != 0
@@ -602,7 +602,7 @@ function Base.getproperty(x::Schema, field::Symbol)
 end
 
 schemaStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 3)
-schemaAddEndianness(b::FlatBuffers.Builder, endianness::Endianness) = FlatBuffers.prependslot!(b, 0, endianness, 0)
+schemaAddEndianness(b::FlatBuffers.Builder, endianness::Endianness.T) = FlatBuffers.prependslot!(b, 0, endianness, 0)
 schemaAddFields(b::FlatBuffers.Builder, fields::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 1, fields, 0)
 schemaStartFieldsVector(b::FlatBuffers.Builder, numelems) = FlatBuffers.startvector!(b, 4, numelems, 4)
 schemaAddCustomMetadata(b::FlatBuffers.Builder, custommetadata::FlatBuffers.UOffsetT) = FlatBuffers.prependoffsetslot!(b, 2, custommetadata, 0)
diff --git a/src/table.jl b/src/table.jl
index 49b6153..b2d2c80 100644
--- a/src/table.jl
+++ b/src/table.jl
@@ -198,9 +198,9 @@ function Base.iterate(x::Stream, (pos, id)=(1, 0))
     end
 
     if compression !== nothing
-        if compression.codec == Flatbuf.CompressionTypes.ZSTD
+        if compression.codec == Flatbuf.CompressionType.ZSTD
             x.compression[] = :zstd
-        elseif compression.codec == Flatbuf.CompressionTypes.LZ4_FRAME
+        elseif compression.codec == Flatbuf.CompressionType.LZ4_FRAME
             x.compression[] = :lz4
         else
             throw(ArgumentError("unsupported compression codec: $(compression.codec)"))
@@ -528,9 +528,9 @@ function uncompress(ptr::Ptr{UInt8}, buffer, compression)
         return length(encodedbytes), copy(encodedbytes)
     end
     decodedbytes = Vector{UInt8}(undef, len)
-    if compression.codec === Meta.CompressionTypes.LZ4_FRAME
+    if compression.codec === Meta.CompressionType.LZ4_FRAME
         transcode(LZ4FrameDecompressor, encodedbytes, decodedbytes)
-    elseif compression.codec === Meta.CompressionTypes.ZSTD
+    elseif compression.codec === Meta.CompressionType.ZSTD
         transcode(ZstdDecompressor, encodedbytes, decodedbytes)
     else
         error("unsupported compression type when reading arrow buffers: $(typeof(compression.codec))")
@@ -648,7 +648,7 @@ function build(f::Meta.Field, L::Meta.Union, batch, rb, de, nodeidx, bufferidx,
     buffer = rb.buffers[bufferidx]
     bytes, typeIds = reinterp(UInt8, batch, buffer, rb.compression)
     bufferidx += 1
-    if L.mode == Meta.UnionModes.Dense
+    if L.mode == Meta.UnionMode.Dense
         buffer = rb.buffers[bufferidx]
         bytes2, offsets = reinterp(Int32, batch, buffer, rb.compression)
         bufferidx += 1
@@ -663,7 +663,7 @@ function build(f::Meta.Field, L::Meta.Union, batch, rb, de, nodeidx, bufferidx,
     meta = buildmetadata(f.custom_metadata)
     T = juliaeltype(f, meta, convert)
     UT = UnionT(f, convert)
-    if L.mode == Meta.UnionModes.Dense
+    if L.mode == Meta.UnionMode.Dense
         B = DenseUnion{T, UT, typeof(data)}(bytes, bytes2, typeIds, offsets, data, meta)
     else
         B = SparseUnion{T, UT, typeof(data)}(bytes, typeIds, data, meta)
diff --git a/src/write.jl b/src/write.jl
index 18dcb3b..1c6975d 100644
--- a/src/write.jl
+++ b/src/write.jl
@@ -263,7 +263,7 @@ function Base.close(writer::Writer)
         FlatBuffers.UOffsetT(0)
     end
     Meta.footerStart(b)
-    Meta.footerAddVersion(b, Meta.MetadataVersions.V5)
+    Meta.footerAddVersion(b, Meta.MetadataVersion.V5)
     Meta.footerAddSchema(b, schfoot)
     Meta.footerAddDictionaries(b, dicts)
     Meta.footerAddRecordBatches(b, recordbatches)
@@ -377,7 +377,7 @@ end
 function makemessage(b, headerType, header, columns=nothing, bodylen=0)
     # write the message flatbuffer object
     Meta.messageStart(b)
-    Meta.messageAddVersion(b, Meta.MetadataVersions.V5)
+    Meta.messageAddVersion(b, Meta.MetadataVersion.V5)
     Meta.messageAddHeaderType(b, headerType)
     Meta.messageAddHeader(b, header)
     Meta.messageAddBodyLength(b, Int64(bodylen))
@@ -419,7 +419,7 @@ function makeschema(b, sch::Tables.Schema, columns)
     end
     # write schema object
     Meta.schemaStart(b)
-    Meta.schemaAddEndianness(b, Meta.Endiannesses.Little)
+    Meta.schemaAddEndianness(b, Meta.Endianness.Little)
     Meta.schemaAddFields(b, fields)
     Meta.schemaAddCustomMetadata(b, meta)
     return Meta.schemaEnd(b)
@@ -550,7 +550,7 @@ function makerecordbatch(b, sch::Tables.Schema{names,types}, columns, alignment)
     if compress !== nothing
         Meta.bodyCompressionStart(b)
         Meta.bodyCompressionAddCodec(b, compress)
-        Meta.bodyCompressionAddMethod(b, Meta.BodyCompressionMethods.BUFFER)
+        Meta.bodyCompressionAddMethod(b, Meta.BodyCompressionMethod.BUFFER)
         compression = Meta.bodyCompressionEnd(b)
     else
         compression = FlatBuffers.UOffsetT(0)
diff --git a/test/arrowjson.jl b/test/arrowjson.jl
index 0c0c8e1..586ab93 100644
--- a/test/arrowjson.jl
+++ b/test/arrowjson.jl
@@ -80,14 +80,14 @@ mutable struct Timestamp <: Type
 end
 
 Timestamp() = Timestamp("", "", nothing)
-unit(U) = U == Arrow.Meta.TimeUnits.SECOND ? "SECOND" :
-          U == Arrow.Meta.TimeUnits.MILLISECOND ? "MILLISECOND" :
-          U == Arrow.Meta.TimeUnits.MICROSECOND ? "MICROSECOND" : "NANOSECOND"
+unit(U) = U == Arrow.Meta.TimeUnit.SECOND ? "SECOND" :
+          U == Arrow.Meta.TimeUnit.MILLISECOND ? "MILLISECOND" :
+          U == Arrow.Meta.TimeUnit.MICROSECOND ? "MICROSECOND" : "NANOSECOND"
 Type(::Base.Type{Arrow.Timestamp{U, TZ}}) where {U, TZ} = Timestamp("timestamp", unit(U), TZ === nothing ? nothing : String(TZ))
 StructTypes.StructType(::Base.Type{Timestamp}) = StructTypes.Mutable()
-unitT(u) = u == "SECOND" ? Arrow.Meta.TimeUnits.SECOND :
-           u == "MILLISECOND" ? Arrow.Meta.TimeUnits.MILLISECOND :
-           u == "MICROSECOND" ? Arrow.Meta.TimeUnits.MICROSECOND : Arrow.Meta.TimeUnits.NANOSECOND
+unitT(u) = u == "SECOND" ? Arrow.Meta.TimeUnit.SECOND :
+           u == "MILLISECOND" ? Arrow.Meta.TimeUnit.MILLISECOND :
+           u == "MICROSECOND" ? Arrow.Meta.TimeUnit.MICROSECOND : Arrow.Meta.TimeUnit.NANOSECOND
 juliatype(f, x::Timestamp) = Arrow.Timestamp{unitT(x.unit), x.timezone === nothing ? nothing : Symbol(x.timezone)}
 
 struct Duration <: Type
@@ -104,9 +104,9 @@ struct Date <: Type
     unit::String
 end
 
-Type(::Base.Type{Arrow.Date{U, T}}) where {U, T} = Date("date", U == Arrow.Meta.DateUnits.DAY ? "DAY" : "MILLISECOND")
+Type(::Base.Type{Arrow.Date{U, T}}) where {U, T} = Date("date", U == Arrow.Meta.DateUnit.DAY ? "DAY" : "MILLISECOND")
 StructTypes.StructType(::Base.Type{Date}) = StructTypes.Struct()
-juliatype(f, x::Date) = Arrow.Date{x.unit == "DAY" ? Arrow.Meta.DateUnits.DAY : Arrow.Meta.DateUnits.MILLISECOND, x.unit == "DAY" ? Int32 : Int64}
+juliatype(f, x::Date) = Arrow.Date{x.unit == "DAY" ? Arrow.Meta.DateUnit.DAY : Arrow.Meta.DateUnit.MILLISECOND, x.unit == "DAY" ? Int32 : Int64}
 
 struct Time <: Type
     name::String
@@ -123,9 +123,9 @@ struct Interval <: Type
     unit::String
 end
 
-Type(::Base.Type{Arrow.Interval{U, T}}) where {U, T} = Interval("interval", U == Arrow.Meta.IntervalUnits.YEAR_MONTH ? "YEAR_MONTH" : "DAY_TIME")
+Type(::Base.Type{Arrow.Interval{U, T}}) where {U, T} = Interval("interval", U == Arrow.Meta.IntervalUnit.YEAR_MONTH ? "YEAR_MONTH" : "DAY_TIME")
 StructTypes.StructType(::Base.Type{Interval}) = StructTypes.Struct()
-juliatype(f, x::Interval) = Arrow.Interval{x.unit == "YEAR_MONTH" ? Arrow.Meta.IntervalUnits.YEAR_MONTH : Arrow.Meta.IntervalUnits.DAY_TIME, x.unit == "YEAR_MONTH" ? Int32 : Int64}
+juliatype(f, x::Interval) = Arrow.Interval{x.unit == "YEAR_MONTH" ? Arrow.Meta.IntervalUnit.YEAR_MONTH : Arrow.Meta.IntervalUnit.DAY_TIME, x.unit == "YEAR_MONTH" ? Int32 : Int64}
 
 struct UnionT <: Type
     name::String
@@ -133,10 +133,10 @@ struct UnionT <: Type
     typIds::Vector{Int64}
 end
 
-Type(::Base.Type{Arrow.UnionT{T, typeIds, U}}) where {T, typeIds, U} = UnionT("union", T == Arrow.Meta.UnionModes.Dense ? "DENSE" : "SPARSE", collect(typeIds))
+Type(::Base.Type{Arrow.UnionT{T, typeIds, U}}) where {T, typeIds, U} = UnionT("union", T == Arrow.Meta.UnionMode.Dense ? "DENSE" : "SPARSE", collect(typeIds))
 children(::Base.Type{Arrow.UnionT{T, typeIds, U}}) where {T, typeIds, U} = Field[Field("", fieldtype(U, i), nothing) for i = 1:fieldcount(U)]
 StructTypes.StructType(::Base.Type{UnionT}) = StructTypes.Struct()
-juliatype(f, x::UnionT) = Arrow.UnionT{x.mode == "DENSE" ? Arrow.Meta.UnionModes.DENSE : Arrow.Meta.UnionModes.SPARSE, Tuple(x.typeIds), Tuple{(juliatype(y) for y in f.children)...}}
+juliatype(f, x::UnionT) = Arrow.UnionT{x.mode == "DENSE" ? Arrow.Meta.UnionMode.DENSE : Arrow.Meta.UnionMode.SPARSE, Tuple(x.typeIds), Tuple{(juliatype(y) for y in f.children)...}}
 
 struct List <: Type
     name::String
@@ -381,7 +381,7 @@ function FieldData(nm, ::Base.Type{T}, col, dictencodings) where {T}
             U = eltype(S)
             tids = Arrow.typeids(S) === nothing ? (0:fieldcount(U)) : Arrow.typeids(S)
             TYPE_ID = [x === missing ? 0 : tids[Arrow.isatypeid(x, U)] for x in col]
-            if Arrow.unionmode(S) == Arrow.Meta.UnionModes.Dense
+            if Arrow.unionmode(S) == Arrow.Meta.UnionMode.Dense
                 offs = zeros(Int32, fieldcount(U))
                 OFFSET = Int32[]
                 for x in col
@@ -502,7 +502,7 @@ function Base.getindex(x::ArrowArray{T}, i::Base.Int) where {T}
         U = eltype(S)
         tids = Arrow.typeids(S) === nothing ? (0:fieldcount(U)) : Arrow.typeids(S)
         typeid = tids[x.fielddata.TYPE_ID[i]]
-        if Arrow.unionmode(S) == Arrow.Meta.UnionModes.DENSE
+        if Arrow.unionmode(S) == Arrow.Meta.UnionMode.DENSE
             off = x.fielddata.OFFSET[i]
             return ArrowArray(x.field.children[typeid+1], x.fielddata.children[typeid+1], x.dictionaries)[off]
         else
diff --git a/test/runtests.jl b/test/runtests.jl
index 47a137f..a46a953 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -369,7 +369,7 @@ end
 
 @testset "# 166" begin
 t = (
-    col1=[zero(Arrow.Timestamp{Arrow.Meta.TimeUnits.NANOSECOND, nothing})],
+    col1=[zero(Arrow.Timestamp{Arrow.Meta.TimeUnit.NANOSECOND, nothing})],
 )
 tbl = Arrow.Table(Arrow.tobuffer(t))
 @test_logs (:warn, r"automatically converting Arrow.Timestamp with precision = NANOSECOND") begin
@@ -380,8 +380,8 @@ end
 @testset "# 95; Arrow.ToTimestamp" begin
 x = [ZonedDateTime(Dates.DateTime(2020), tz"Europe/Paris")]
 c = Arrow.ToTimestamp(x)
-@test eltype(c) == Arrow.Timestamp{Arrow.Flatbuf.TimeUnits.MILLISECOND, Symbol("Europe/Paris")}
-@test c[1] == Arrow.Timestamp{Arrow.Flatbuf.TimeUnits.MILLISECOND, Symbol("Europe/Paris")}(1577833200000)
+@test eltype(c) == Arrow.Timestamp{Arrow.Flatbuf.TimeUnit.MILLISECOND, Symbol("Europe/Paris")}
+@test c[1] == Arrow.Timestamp{Arrow.Flatbuf.TimeUnit.MILLISECOND, Symbol("Europe/Paris")}(1577833200000)
 end
 
 @testset "# 158" begin
diff --git a/test/testtables.jl b/test/testtables.jl
index 4288b36..10c1671 100644
--- a/test/testtables.jl
+++ b/test/testtables.jl
@@ -54,12 +54,12 @@ testtables = [
     "arrow date/time types",
     (
       col14=[zero(Arrow.Decimal{Int32(2), Int32(2), Int128}), zero(Arrow.Decimal{Int32(2), Int32(2), Int128}), zero(Arrow.Decimal{Int32(2), Int32(2), Int128}), missing],
-      col15=[zero(Arrow.Date{Arrow.Meta.DateUnits.DAY, Int32}), zero(Arrow.Date{Arrow.Meta.DateUnits.DAY, Int32}), zero(Arrow.Date{Arrow.Meta.DateUnits.DAY, Int32}), missing],
-      col16=[zero(Arrow.Time{Arrow.Meta.TimeUnits.SECOND, Int32}), zero(Arrow.Time{Arrow.Meta.TimeUnits.SECOND, Int32}), zero(Arrow.Time{Arrow.Meta.TimeUnits.SECOND, Int32}), missing],
-      col17=[zero(Arrow.Timestamp{Arrow.Meta.TimeUnits.SECOND, nothing}), zero(Arrow.Timestamp{Arrow.Meta.TimeUnits.SECOND, nothing}), zero(Arrow.Timestamp{Arrow.Meta.TimeUnits.SECOND, nothing}), missing],
-      col18=[zero(Arrow.Interval{Arrow.Meta.IntervalUnits.YEAR_MONTH, Int32}), zero(Arrow.Interval{Arrow.Meta.IntervalUnits.YEAR_MONTH, Int32}), zero(Arrow.Interval{Arrow.Meta.IntervalUnits.YEAR_MONTH, Int32}), missing],
-      col19=[zero(Arrow.Duration{Arrow.Meta.TimeUnits.SECOND}), zero(Arrow.Duration{Arrow.Meta.TimeUnits.SECOND}), zero(Arrow.Duration{Arrow.Meta.TimeUnits.SECOND}), missing],
-      col20=[zero(Arrow.Date{Arrow.Meta.DateUnits.MILLISECOND, Int64}), zero(Arrow.Date{Arrow.Meta.DateUnits.MILLISECOND, Int64}), zero(Arrow.Date{Arrow.Meta.DateUnits.MILLISECOND, Int64}), missing],
+      col15=[zero(Arrow.Date{Arrow.Meta.DateUnit.DAY, Int32}), zero(Arrow.Date{Arrow.Meta.DateUnit.DAY, Int32}), zero(Arrow.Date{Arrow.Meta.DateUnit.DAY, Int32}), missing],
+      col16=[zero(Arrow.Time{Arrow.Meta.TimeUnit.SECOND, Int32}), zero(Arrow.Time{Arrow.Meta.TimeUnit.SECOND, Int32}), zero(Arrow.Time{Arrow.Meta.TimeUnit.SECOND, Int32}), missing],
+      col17=[zero(Arrow.Timestamp{Arrow.Meta.TimeUnit.SECOND, nothing}), zero(Arrow.Timestamp{Arrow.Meta.TimeUnit.SECOND, nothing}), zero(Arrow.Timestamp{Arrow.Meta.TimeUnit.SECOND, nothing}), missing],
+      col18=[zero(Arrow.Interval{Arrow.Meta.IntervalUnit.YEAR_MONTH, Int32}), zero(Arrow.Interval{Arrow.Meta.IntervalUnit.YEAR_MONTH, Int32}), zero(Arrow.Interval{Arrow.Meta.IntervalUnit.YEAR_MONTH, Int32}), missing],
+      col19=[zero(Arrow.Duration{Arrow.Meta.TimeUnit.SECOND}), zero(Arrow.Duration{Arrow.Meta.TimeUnit.SECOND}), zero(Arrow.Duration{Arrow.Meta.TimeUnit.SECOND}), missing],
+      col20=[zero(Arrow.Date{Arrow.Meta.DateUnit.MILLISECOND, Int64}), zero(Arrow.Date{Arrow.Meta.DateUnit.MILLISECOND, Int64}), zero(Arrow.Date{Arrow.Meta.DateUnit.MILLISECOND, Int64}), missing],
     ),
     NamedTuple(),
     (convert=false,),