Skip to content

Add binary parsing for interval type #236

@morris25

Description

@morris25

We have a postgres table that contains intervals and are using binary parsing on all our other tables to increase query speed in our internal database support package. We are currently running into the nested error when trying to run queries on the new table due to the interval data failing to parse.

  nested task error: Couldn't parse ,? as interval using regex r"^P(?:(?<Year>-?\d+)Y)?(?:(?<Month>-?\d+)M)?(?:(?<Day>-?\d+)D)?(?:T(?:(?<Hour>-?\d+)H)?(?:(?<Minute>-?\d+)M)?(?:(?<Second>(?<whole_seconds>-?\d+)(?:\.(?<frac_seconds>\d{1,9}))?)S)?)?$"
    Stacktrace:
      [1] error(s::String)
        @ Base ./error.jl:33
      [2] pqparse(#unused#::Type{Dates.CompoundPeriod}, str::String)
        @ LibPQ ~/.julia/packages/LibPQ/IcOLJ/src/parsing.jl:444
      [3] parse(#unused#::Type{Dates.CompoundPeriod}, pqv::LibPQ.PQValue{0x000004a2, true})
        @ LibPQ ~/.julia/packages/LibPQ/IcOLJ/src/parsing.jl:127
      [4] (::LibPQ.var"#parse_type#79"{DataType})(pqv::LibPQ.PQValue{0x000004a2, true})
        @ LibPQ ~/.julia/packages/LibPQ/IcOLJ/src/parsing.jl:644
      [5] getindex(jl_result::LibPQ.Result{true}, row::Int64, col::Int64)
        @ LibPQ ~/.julia/packages/LibPQ/IcOLJ/src/results.jl:536
      [6] getproperty(pqrow::LibPQ.Row, name::Symbol)
        @ LibPQ ~/.julia/packages/LibPQ/IcOLJ/src/tables.jl:37
      [7] getcolumn
        @ ~/.julia/packages/Tables/OWzlh/src/Tables.jl:102 [inlined]
      [8] getcolumn
        @ ~/.julia/packages/Tables/OWzlh/src/Tables.jl:103 [inlined]
      [9] eachcolumn
        @ ~/.julia/packages/Tables/OWzlh/src/utils.jl:70 [inlined]
     [10] writerow(buf::Vector{UInt8}, pos::Base.RefValue{Int64}, len::Int64, io::IOStream, sch::Tables.Schema{(:release_date, :target_start, :target_end, :region, :tag, :target_bounds, :horizon, :temperature, :target), Tuple{Union{Missing, ZonedDateTime}, Union{Missing, ZonedDateTime}, Union{Missing, ZonedDateTime}, Union{Missing, String}, Union{Missing, String}, Union{Missing, Int16}, Union{Missing, Dates.CompoundPeriod}, Union{Missing, Float64}, Union{Missing, Interval{ZonedDateTime, L, R} where {L<:Bound, R<:Bound}}}}, row::LibPQ.Row, cols::Int64, opts::CSV.Options{UInt8, UInt8, Nothing, Tuple{}, typeof(CSV._identity)})
        @ CSV ~/.julia/packages/CSV/owrEo/src/write.jl:367

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions