JuliaData / JuliaData/TableOperations.jl

`TableOperations.transform()` returns lazy table with no schema

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

Nobody has claimed this yet.

Dominant language
Julia
Stars
48
Forks
8
PR merge metrics
No merged PRs in 30d

Description

I'm attempting to perform transformations on a table and subsequently convert it into a matrix.

X = DataFrame(rand(10, 2), :auto)             # also tried a matrix table
Xcat = X |> TableOperations.transform(Dict(0=> x -> x)) |> Tables.matrix

However, I get the error

type Nothing has no field types

Stacktrace:
 [1] getproperty(x::Nothing, f::Symbol)
   @ Base [./Base.jl:38](https://file+.vscode-resource.vscode-cdn.net/Users/essam/Documents/GitHub/Imbalance.jl/Base.jl:38)
 [2] matrix(table::TableOperations.Transforms{true, Tables.MatrixTable{Matrix{Float64}}, Dict{Int64, var"#15#16"}}; transpose::Bool)
   @ Tables [~/.julia/packages/Tables/AcRIE/src/matrix.jl:87](https://file+.vscode-resource.vscode-cdn.net/Users/essam/Documents/GitHub/Imbalance.jl/~/.julia/packages/Tables/AcRIE/src/matrix.jl:87)
 [3] matrix(table::TableOperations.Transforms{true, Tables.MatrixTable{Matrix{Float64}}, Dict{Int64, var"#15#16"}})
   @ Tables [~/.julia/packages/Tables/AcRIE/src/matrix.jl:84](https://file+.vscode-resource.vscode-cdn.net/Users/essam/Documents/GitHub/Imbalance.jl/~/.julia/packages/Tables/AcRIE/src/matrix.jl:84)
 [4] |>(x::TableOperations.Transforms{true, Tables.MatrixTable{Matrix{Float64}}, Dict{Int64, var"#15#16"}}, f::typeof(Tables.matrix))
   @ Base [./operators.jl:911](https://file+.vscode-resource.vscode-cdn.net/Users/essam/Documents/GitHub/Imbalance.jl/operators.jl:911)
 [5] top-level scope

The underlying reason as far as I understand is that the following test passes

Xcat = X |> TableOperations.transform(Dict(0=> x -> x)) 
@test isnothing(Tables.schema(Xcat))

Note that we don't run into the same issue if we use TableTransforms.select(...). Also, on the other hands, converting to a columntable works but I am not sure how efficient that operation is if I were to follow it with a matrix conversion.

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 with the reproducer and the Tables.schema(Xcat) check, then inspect Tables' matrix.jl around line 87 and compare the behavior with TableOperations.select(...). Add a regression test for transforming a table and converting it with Tables.matrix; done means the transformed table has usable schema information and the conversion no longer raises the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.