# TableOperations.select

**URL:** <https://discourse.julialang.org/t/tableoperations-select/50334>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [November 17, 2020, 9:43pm UTC](https://discourse.julialang.org/t/tableoperations-select/50334 "2020-11-17T21:43:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![djholiver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djholiver/32/50470_2.png) [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Post date:** [November 17, 2020, 9:43pm UTC](https://discourse.julialang.org/t/tableoperations-select/50334/1 "2020-11-17T21:43:20Z")

</div>

Hi,

I have been making use of the Arrow.jl library and am currently experiencing difficulty in attempting to obtain a subset of columns from the original (Arrow) table and writing to another, via the TableOperations.select function

Naively, I attempted this:

```julia
symbols = tblFile |> TableOperations.select(columnSymbols) |> Tables.columntable
Arrow.write(arrowLookupTarget,symbols)

```

where columnSymbols = Vector{Symbol}()

and other variations like:

```julia
symbols = tblFile |> TableOperations.select(p -> for p in [1: length(columnSymbols)] columnSymbols[p] end) |> Tables.columntable
Arrow.write(arrowLookupTarget,symbols)

```

since the documentation for TableOperations.select gives the example:

```julia
table_subset = ctable |> TableOperations.select(:C, :A) |> Tables.columntable

```

How can I progress this?

Also, as an aside, when (trying to) reviewing the source code for “select”: [https://github.com/JuliaData/TableOperations.jl/blob/b3703bab6ebb6b019bcf8070062520246b9f0f77/src/TableOperations.jl](https://github.com/JuliaData/TableOperations.jl/blob/b3703bab6ebb6b019bcf8070062520246b9f0f77/src/TableOperations.jl)

I found it to be confusing:

```julia
# select
struct Select{T, columnaccess, names}
    source::T
end

"""
    Tables.select(source, columns...) => Tables.Select
    source |> Tables.select(columns...) => Tables.Select
Create a lazy wrapper that satisfies the Tables.jl interface and keeps only the columns given by the columns arguments, which can be `String`s, `Symbol`s, or `Integer`s
"""
function select end

select(names::Symbol...) = x->select(x, names...)
select(names::String...) = x->select(x, Base.map(Symbol, names)...)
select(inds::Integer...) = x->select(x, Base.map(Int, inds)...)

function select(x::T, names...) where {T}
    colaccess = Tables.columnaccess(T)
    r = colaccess ? Tables.columns(x) : Tables.rows(x)
    return Select{typeof(r), colaccess, names}(r)
end

```

which I know to be my lack of knowledge and as someone pursuing Julia with the intention of creating production grade code, using the source as a guide. I point it out purely as my ability to solve my own issue was hindered: I could not fathom where the iteration takes place. How is the struct bound to the function and then how does the piping work?

Regards
