diff --git a/Project.toml b/Project.toml index 5dec6c4..554f125 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FeatureTransforms" uuid = "8fd68953-04b8-4117-ac19-158bf6de9782" authors = ["Invenia Technical Computing Corporation"] -version = "0.3.6" +version = "0.3.7" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/apply.jl b/src/apply.jl index cf69bd5..8837c27 100644 --- a/src/apply.jl +++ b/src/apply.jl @@ -118,7 +118,8 @@ the usual [`Transform`](@ref) being invoked. function apply_append(A::AbstractArray, t; append_dim, kwargs...)::AbstractArray result = apply(A, t; kwargs...) result = _postformat(cardinality(t), result, A, append_dim) - return cat(A, result; dims=append_dim) + # Conver result to Array to avoid clashing axis/key names in concatenated result + return cat(A, Array(result); dims=append_dim) end """ @@ -153,5 +154,5 @@ _postformat(::Cardinality, result, A, append_dim) = result function _postformat(::ManyToOne, result, A, append_dim) new_size = collect(size(A)) setindex!(new_size, 1, dim(A, append_dim)) - return reshape(result, new_size...) + return copy(reshape(result, new_size...)) # return a copy to remove the reshape type end diff --git a/test/runtests.jl b/test/runtests.jl index 2e9dd36..c79833b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using AxisArrays using AxisKeys +using Base: ReshapedArray using DataFrames: DataFrame using Dates using Documenter: doctest diff --git a/test/types/matrix.jl b/test/types/matrix.jl index f4b3fed..3724eb1 100644 --- a/test/types/matrix.jl +++ b/test/types/matrix.jl @@ -1,6 +1,11 @@ -@testset "matrix" begin +# Want to test that certain subtypes of arrays are compatible +_make_matrix(::Type{Matrix}) = [1 2 3; 4 5 6] +_make_matrix(::Type{SubArray}) = view([1 2 3; 4 5 6], :, :) +_make_matrix(::Type{ReshapedArray}) = reshape([1 2 3; 4 5 6], 2, 3) - x = [1 2 3; 4 5 6] +@testset "$MatrixType" for MatrixType in (Matrix, SubArray, ReshapedArray) + + x = _make_matrix(MatrixType) @test is_transformable(x) diff --git a/test/types/xarray.jl b/test/types/xarray.jl index f8bccdc..b7eac33 100644 --- a/test/types/xarray.jl +++ b/test/types/xarray.jl @@ -1,4 +1,4 @@ -@testset "$ArrayType" for ArrayType in (AxisArray, KeyedArray) +@testset "$ArrayType" for ArrayType in (AxisArray, KeyedArray, NamedDimsArray) x = ArrayType([1 2 3; 4 5 6], foo=["a", "b"], bar=[:x, :y, :z]) @@ -114,7 +114,7 @@ end - if ArrayType == KeyedArray + if ArrayType != AxisArray @testset "indexing with dims" begin T = FakeOneToOneTransform()