Closed palday closed 1 year ago
Hmmmm.....I do see the issue on 1.9-rc1, but not on a recent julia#master (as of 4 days ago).
bisected it to
25bad181eb184bce7d3a32a18699fe9f9f9a9325 is the first bad commit
commit 25bad181eb184bce7d3a32a18699fe9f9f9a9325
Author: Jeff Bezanson <jeff.bezanson@gmail.com>
Date: Tue Jan 24 09:05:18 2023 -0500
fix #47658, state stack overflow on unions containing typevars (#48221)
(cherry picked from commit 596ce6542624e9b8c3782b19936e2226f307e118)
src/subtype.c | 34 ++++++++++++++++++++++++++++++++++
test/subtype.jl | 24 +++++++++++++++++++++++-
2 files changed, 57 insertions(+), 1 deletion(-)
(bisecting between 1.9-alpha1
and current head of release-1.9
). I'll also take a look at bisecting on master to see what fixed it again there
On Julia master, this seems to be fixed by:
commit 96acd4d4e90647caab17af0f689723f5a2594cfd
Author: N5N3 <2642243996@qq.com>
Date: Thu Feb 2 11:41:26 2023 +0800
Subtype: avoid false alarm caused by eager `forall_exists_subtype`. (#48441)
* Avoid earsing `Runion` within nested `forall_exists_subtype`
If `Runion.more != 0` we‘d better not erase the local `Runion` as we need it if the subtyping fails after.
This commit replaces `forall_exists_subtype` with a local version.
It first tries `forall_exists_subtype` and estimates the "problem scale".
If subtyping fails and the scale looks small then it switches to the slow path.
TODO: At present, the "problem scale" only counts the number of checked `Lunion`s.
But perhaps we need a more accurate result (e.g. sum of `Runion.depth`)
* Change the reversed subtyping into a local check.
Make sure we don't forget the bound in `env`.
(And we can fuse `local_forall_exists_subtype`)
* Optimization for non-union invariant parameter.
src/subtype.c | 119 ++++++++++++++++++++++++++++++++++++++------------------
test/subtype.jl | 13 +++++--
2 files changed, 91 insertions(+), 41 deletions(-)
The upstream fix has been cherry-picked onto the backports-release-1.9
branch. Building on that fixes the issue.
The lines impacted are
https://github.com/apache/arrow-julia/blob/63d2c9d3ca4539a0ea831ae8ecafa71b051d475d/src/ArrowTypes/src/ArrowTypes.jl#L337-L339
This may be a Julia issue -- if
default(::Type{Union{T, Missing, Nothing}})
overwritesdefault(::Type{Union{T, Missing}})
, it feels like it should also overwritedefault(::Type{Union{T, Nothing}})
and besides there's no<:
in there so this shouldn't be handled as covariant anyway.