arrow-julia
arrow-julia copied to clipboard
Avoid extending `Type` from Base on Julia 1.12
The internal Flatbuf module defines a function called Type. On Julia 1.12, defining a new function by defining methods is insufficient to distinguish it from defining new constructor methods for a visible type of the same name. It's now necessary to forward-declare the function to ensure it takes precedence over the other visible binding. Without doing so, Base.Type is extended in Flatbuf instead.
On current main with Julia v1.13.0-DEV.122:
julia> using Arrow
Info Given Arrow was explicitly requested, output will be shown live
WARNING: Constructor for type "Type" was extended in `Flatbuf` without explicit qualification or import.
NOTE: Assumed "Type" refers to `Base.Type`. This behavior is deprecated and may differ in future versions.
NOTE: This behavior may have differed in Julia versions prior to 1.12.
Hint: If you intended to create a new generic function of the same name, use `function Type end`.
Hint: To silence the warning, qualify `Type` as `Base.Type` in the method signature or explicitly `import Base: Type`.
Precompiling Arrow finished.
1 dependency successfully precompiled in 4 seconds. 47 already precompiled.
1 dependency had output during precompilation:
┌ Arrow
│ [Output was shown above]
└
julia> methods(Type)
# 2 methods for type constructor:
[1] Type(b::UInt8)
@ Arrow.Flatbuf ~/Projects/julia-packages/arrow-julia/src/metadata/Schema.jl:489
[2] Type(::Type{T}) where T
@ Arrow.Flatbuf ~/Projects/julia-packages/arrow-julia/src/metadata/Schema.jl:519
julia> Arrow.Flatbuf.Type === Type
[ Warning: Type is defined in Core and is not public in Arrow.Flatbuf
true
With this PR, the output is the same because of https://github.com/JuliaLang/julia/issues/57546 but will have the correct behavior once that issue is fixed.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 86.96%. Comparing base (3712291) to head (9eb80c1).
:warning: Report is 32 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #543 +/- ##
==========================================
- Coverage 87.43% 86.96% -0.48%
==========================================
Files 26 27 +1
Lines 3288 3398 +110
==========================================
+ Hits 2875 2955 +80
- Misses 413 443 +30
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Same problem on Julia 1.12-beta3
Could you rebase on main to re-run CI?
@kou, I've rebased.
Hmm... CI isn't executed... Could you re-rebase...?
Done, but I still don't see CI status. Is the repository configured such that CI is not run on PRs from forks?
Thanks. I can approve CI execution for "first-time contributor" now. I've approved now. Let's see the CI result with this change.
Looks like CI fails on Julia nightly with multiple threads, but not in a way that could plausibly be related to the changes here, so I think we're okay.
@quinnj @ericphanson @baumgold Can we merge this?
@quinnj @ericphanson @baumgold I'll merge this in the next week if nobody objects it.
@kou please merge since 1.12 is now RC2 ❤️
Merged. Should we release a new version before Julia 1.12 release?
@kou yes!
OK. Let's discuss it in #567.