yeesian / ArchGDAL.jl

A high level API for GDAL - Geospatial Data Abstraction Library
https://yeesian.github.io/ArchGDAL.jl/stable/
Other
141 stars 27 forks source link

Failing tests on 1.9 #285

Closed evetion closed 1 year ago

evetion commented 2 years ago

As seen in master and in recent PRs (#284), nightly fails with

MethodError: no method matching regenerateoverviews!(::ArchGDAL.IRasterBand{UInt8}, ::Vector{Matrix{UInt8}}) https://github.com/yeesian/ArchGDAL.jl/runs/5513853907?check_suite_focus=true#step%3A6%3A165=

yeesian commented 2 years ago

Thank you for filing this; I looked at the code and it seems that everything's working as-intended, but please correct me if I'm wrong!

In the meantime, let me doublecheck that failure on nightlies are not a blocker for merging PRs

evetion commented 2 years ago

Ok, from what I can see, in the failing function regenerateoverviews!(::T, ::Vector{<:ArchGDAL.AbstractRasterBand}) Julia normally dispatches fine on Vector{<:ArchGDAL.AbstractRasterBand}. In Julia 1.9 it doesn't and walks all the way up its supertypes to Matrix as ArchGDAL.AbstractRasterBand <: AbstractDiskArray{T,2} <: AbstractArray{T,N}.

This was wrong, what happens is that in the test we do: [overview, AG.getoverview(destband, 2)]

where overview is a ArchGDAL.RasterBand{UInt8} and the second is a ArchGDAL.IRasterBand{UInt8}. These different types (note the I) joined in a vector leads to Vector{ArchGDAL.AbstractRasterBand{UInt8}} in 1.8 and below, but on 1.9 it actually walks upwards to Vector{Matrix{UInt8}}.

Will file an upstream bug report.

yeesian commented 2 years ago

I really appreciate your investigation and follow-up in https://github.com/JuliaLang/julia/issues/44821. The lack of stability in the common type for vectors seems slightly concerning. Should I consider setting up a system of promotion rules defined for the types in this package?

evetion commented 2 years ago

It seems wise to add promotion rules indeed, but only for the (probably small amount) of cases where it's needed. In the test we triggered this by mixing both RasterBand and IRasterBand, the same is probably needed for Geometry, but I don't know more cases. I also don't expect a user to quickly mix these, as the public interface mostly works with the I variants.

maxfreu commented 1 year ago

I think this can be closed, right? https://github.com/JuliaLang/julia/pull/47893