1
@require JuliaDB begin
2
using TableTraits
3
using JuliaDB: DTable
4
import IndexedTables
5

6 0
TableTraits.isiterable(x::DTable) = true
7 0
TableTraits.isiterabletable(x::DTable) = true
8

9
# TODO Replace with something more efficient
10
function TableTraits.getiterator{S<:DTable}(source::S)
11 0
    it  = collect(source)
12 0
    iter = getiterator(it)
13

14 0
    return iter
15
end
16

17
# TODO Replace with something more efficient
18
function JuliaDB.distribute(source, rowgroups::AbstractArray; idxcols::Union{Void,Vector{Symbol}}=nothing, datacols::Union{Void,Vector{Symbol}}=nothing)
19 0
    isiterabletable(source) || error()
20

21 0
    it = IndexedTables.IndexedTable(source, idxcols=idxcols, datacols=datacols)
22

23 0
    dt = JuliaDB.distribute(it, rowgroups)
24

25 0
    return dt
26
end
27

28
# TODO Replace with something more efficient
29
function JuliaDB.distribute(source, nchunks::Int=nworkers(); idxcols::Union{Void,Vector{Symbol}}=nothing, datacols::Union{Void,Vector{Symbol}}=nothing)
30 0
    isiterabletable(source) || error()
31

32 0
    it = IndexedTables.IndexedTable(source, idxcols=idxcols, datacols=datacols)
33

34 0
    dt = JuliaDB.distribute(it, nchunks)
35

36 0
    return dt
37
end
38

39
end

Read our documentation on viewing source code .

Loading