JuliaArrays / JuliaArrays/AxisArrays.jl

Add more join methods to avoid confuse dispatch to fallback Base.join

Open
#158 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
207
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Currently join dispatches on the typed positional arguments As::AxisArray{T,N,D,Ax}.... Every array must have the same parameters for this to be called. With

A = AxisArray(1:3,1:3)
B = AxisArray(0. + 1:3,2:4)

one gets

julia> join(A,B)
"1[1.0, 2.0, 3.0]2[1.0, 2.0, 3.0]3"
julia> @which join(A,B)
join(strings, delim) in Base at strings/io.jl:277

This is "correct" inasmuch as that is the behavior for AbstractArrays but is surprising for AxisArrays. If this behavior is intentional probably good to explicitly document. Alternatively, I would propose that additional methods for join be defined to handle in cases when the parameters of the the AxisArrays don't match.

Possible appropriate behaviors include:

  • When types don't match, throw an error
  • When only the eltypes (the T's) don't match promote eltypes and call on result

Possible maybe appropriate behaviors include:

  • When N doesn't match but no matching axes have length one expand these dims and call on result
  • When only the array types (the Ds) don't match trying to promote Ds/ convert to dense then call on result

There are probably other options could be added to this list. Happy to hear thoughts on what makes sense here and implement if consensus on items.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing join(A, B) with the AxisArray examples and inspect the existing join dispatch for typed positional arguments. The issue lists several possible behaviors, so first establish which behavior is accepted; done requires an agreed design, appropriate join methods, and coverage for mismatched parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.