diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 647b9513..6e5f975b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: version: - - "1.0" # LTS + - "1.3" # Oldest release supported by Arrow.jl - "1" # Latest Release os: - ubuntu-latest diff --git a/Project.toml b/Project.toml index 4b976c86..a475800d 100644 --- a/Project.toml +++ b/Project.toml @@ -8,17 +8,21 @@ version = "1.5.0" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" +Requires = "ae029012-a4dd-5104-9daa-d747884805df" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" [compat] +Arrow = "1" Documenter = "0.23, 0.24" Infinity = "0.2.3" RecipesBase = "0.7, 0.8, 1" +Requires = "1" TimeZones = "0.7, 0.8, 0.9, 0.10, 0.11, 1" julia = "1" [extras] +Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1" Infinity = "a303e19e-6eb4-11e9-3b09-cd9505f79100" @@ -27,4 +31,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92" [targets] -test = ["Documenter", "ImageMagick", "Infinity", "Plots", "Test", "VisualRegressionTests"] +test = ["Arrow", "Documenter", "ImageMagick", "Infinity", "Plots", "Test", "VisualRegressionTests"] diff --git a/src/Intervals.jl b/src/Intervals.jl index 0c606436..6163c932 100644 --- a/src/Intervals.jl +++ b/src/Intervals.jl @@ -3,6 +3,7 @@ module Intervals using Dates using Printf using RecipesBase +using Requires using Serialization: Serialization, AbstractSerializer, deserialize using TimeZones @@ -35,6 +36,10 @@ include("docstrings.jl") include("deprecated.jl") include("compat.jl") +function __init__() + @require Arrow="69666777-d1a9-59fb-9406-91d4454c9d45" include("arrow.jl") +end + export Bound, Closed, Open, diff --git a/src/arrow.jl b/src/arrow.jl new file mode 100644 index 00000000..770e8226 --- /dev/null +++ b/src/arrow.jl @@ -0,0 +1,6 @@ +# Register our structs with Arrow.jl +Arrow.ArrowTypes.registertype!(Closed, Closed) +Arrow.ArrowTypes.registertype!(Open, Open) +Arrow.ArrowTypes.registertype!(Unbounded, Unbounded) +Arrow.ArrowTypes.registertype!(Interval, Interval) +Arrow.ArrowTypes.registertype!(AnchoredInterval, AnchoredInterval) diff --git a/test/arrow.jl b/test/arrow.jl new file mode 100644 index 00000000..34cfa46a --- /dev/null +++ b/test/arrow.jl @@ -0,0 +1,16 @@ +@testset "arrow" begin + zdt_start = ZonedDateTime(2016, 8, 11, 1, tz"America/Winnipeg") + zdt_end = ZonedDateTime(2016, 8, 12, 0, tz"America/Winnipeg") + table = (time = HE.(zdt_start:Hour(1):zdt_end), val = collect(1:24)) + + # Just test that we can save and load our table type without the time column being + # converted to a NamedTuple + mktempdir() do d + file = joinpath(d, "data.arrow") + Arrow.write(file, table) + loaded = Arrow.Table(file) + @test loaded isa Arrow.Table + @test loaded.time == table.time + @test loaded.val == table.val + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 2c9b64cf..9d159c02 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,3 +1,6 @@ +# NOTE: v1.3 checks are for if you want to test on pre-1.3 w/o the Arrow.jl dependency +VERSION >= v"1.3" && using Arrow + using Base.Iterators: product using Dates using Documenter: doctest @@ -19,6 +22,7 @@ include("test_utils.jl") include("anchoredinterval.jl") include("comparisons.jl") include("plotting.jl") + VERSION >= v"1.3" && include("arrow.jl") # Note: The output of the doctests currently requires a newer version of Julia # https://github.com/JuliaLang/julia/pull/34387