davidagold / StructuredQueries.jl

Query representations for Julia
Other
53 stars 5 forks source link

Support query composition #27

Closed davidagold closed 8 years ago

davidagold commented 8 years ago

It was noted in this discussion that dummy sources could be replaced by functions, so long as one can compose Querys by means of the @query macro. This PR introduces that functionality:

julia> df = DataFrame()
0×0 DataFrames.DataFrame

julia> f(q::Query) = @query q |> select(A)
f (generic function with 1 method)

julia> f(@query filter(df, A > .5))
Query against a source of type 0×0 DataFrames.DataFrame

julia> ans.graph
SelectNode
  arguments:
      1)  A
  inputs:
      1)  FilterNode
            arguments:
                1)  A > 0.5
            inputs:
                1)  DataNode
                      source:  source of type DataFrame

EDIT: c.f. https://github.com/davidagold/StructuredQueries.jl/issues/20

codecov-io commented 8 years ago

Current coverage is 84.55% (diff: 100%)

Merging #27 into master will increase coverage by 0.12%

@@             master        #27   diff @@
==========================================
  Files            24         24          
  Lines           244        246     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            206        208     +2   
  Misses           38         38          
  Partials          0          0          

Powered by Codecov. Last update b4afe26...f0fe683