alf 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/CHANGELOG.md +64 -0
  2. data/Gemfile.lock +4 -4
  3. data/README.md +257 -171
  4. data/TODO.md +4 -4
  5. data/alf.gemspec +3 -3
  6. data/alf.noespec +11 -6
  7. data/examples/pseudo-with.alf +7 -0
  8. data/examples/runall.sh +2 -2
  9. data/examples/unwrap.alf +4 -0
  10. data/examples/wrap.alf +2 -0
  11. data/lib/alf/relation.rb +118 -0
  12. data/lib/alf/version.rb +1 -1
  13. data/lib/alf.rb +320 -169
  14. data/spec/integration/src/test_minus.alf +5 -0
  15. data/spec/integration/src/test_project.alf +9 -0
  16. data/spec/{alf_spec.rb → integration/test_alf.rb} +8 -21
  17. data/spec/integration/test_alf_specs.rb +37 -0
  18. data/spec/{examples_spec.rb → integration/test_examples.rb} +1 -1
  19. data/spec/spec_helper.rb +19 -1
  20. data/spec/unit/environment/examples/suppliers.rash +5 -0
  21. data/spec/{environment/explicit_spec.rb → unit/environment/test_explicit.rb} +0 -0
  22. data/spec/{environment/folder_spec.rb → unit/environment/test_folder.rb} +1 -1
  23. data/spec/{operator → unit/operator}/non_relational/compact/buffer_based.rb +0 -0
  24. data/spec/{operator/non_relational/compact/sort_based_spec.rb → unit/operator/non_relational/compact/test_sort_based.rb} +0 -0
  25. data/spec/{operator/non_relational/autonum_spec.rb → unit/operator/non_relational/test_autonum.rb} +0 -0
  26. data/spec/{operator/non_relational/clip_spec.rb → unit/operator/non_relational/test_clip.rb} +0 -0
  27. data/spec/{operator/non_relational/compact_spec.rb → unit/operator/non_relational/test_compact.rb} +0 -0
  28. data/spec/{operator/non_relational/defaults_spec.rb → unit/operator/non_relational/test_defaults.rb} +0 -0
  29. data/spec/{operator/non_relational/sort_spec.rb → unit/operator/non_relational/test_sort.rb} +0 -0
  30. data/spec/{operator/relational/join/hash_based_spec.rb → unit/operator/relational/join/test_hash_based.rb} +0 -0
  31. data/spec/unit/operator/relational/summarize/test_hash_based.rb +38 -0
  32. data/spec/{operator/relational/summarize/sort_based_spec.rb → unit/operator/relational/summarize/test_sort_based.rb} +0 -0
  33. data/spec/{operator/relational/extend_spec.rb → unit/operator/relational/test_extend.rb} +0 -0
  34. data/spec/{operator/relational/group_spec.rb → unit/operator/relational/test_group.rb} +3 -2
  35. data/spec/{operator/relational/intersect_spec.rb → unit/operator/relational/test_intersect.rb} +0 -0
  36. data/spec/unit/operator/relational/test_join.rb +36 -0
  37. data/spec/{operator/relational/minus_spec.rb → unit/operator/relational/test_minus.rb} +0 -0
  38. data/spec/{operator/relational/project_spec.rb → unit/operator/relational/test_project.rb} +0 -0
  39. data/spec/{operator/relational/quota_spec.rb → unit/operator/relational/test_quota.rb} +0 -0
  40. data/spec/{operator/relational/rename_spec.rb → unit/operator/relational/test_rename.rb} +0 -0
  41. data/spec/{operator/relational/restrict_spec.rb → unit/operator/relational/test_restrict.rb} +0 -0
  42. data/spec/unit/operator/relational/test_summarize.rb +64 -0
  43. data/spec/{operator/relational/ungroup_spec.rb → unit/operator/relational/test_ungroup.rb} +0 -0
  44. data/spec/{operator/relational/union_spec.rb → unit/operator/relational/test_union.rb} +0 -0
  45. data/spec/{operator/relational/unnest_spec.rb → unit/operator/relational/test_unwrap.rb} +5 -5
  46. data/spec/{operator/relational/nest_spec.rb → unit/operator/relational/test_wrap.rb} +5 -5
  47. data/spec/{operator/command_methods_spec.rb → unit/operator/test_command_methods.rb} +0 -0
  48. data/spec/unit/operator/test_non_relational.rb +18 -0
  49. data/spec/unit/operator/test_relational.rb +27 -0
  50. data/spec/{reader → unit/reader}/input.rb +0 -0
  51. data/spec/unit/reader/test_alf_file.rb +27 -0
  52. data/spec/{reader/rash_spec.rb → unit/reader/test_rash.rb} +0 -0
  53. data/spec/unit/relation/test_coerce.rb +53 -0
  54. data/spec/unit/relation/test_inspect.rb +20 -0
  55. data/spec/unit/relation/test_relops.rb +46 -0
  56. data/spec/{renderer/text/cell_spec.rb → unit/renderer/text/test_cell.rb} +0 -0
  57. data/spec/{renderer/text/row_spec.rb → unit/renderer/text/test_row.rb} +0 -0
  58. data/spec/{renderer/text/table_spec.rb → unit/renderer/text/test_table.rb} +0 -0
  59. data/spec/{aggregator_spec.rb → unit/test_aggregator.rb} +6 -6
  60. data/spec/{assumptions_spec.rb → unit/test_assumptions.rb} +0 -0
  61. data/spec/{lispy_spec.rb → unit/test_lispy.rb} +0 -0
  62. data/spec/unit/test_operator.rb +16 -0
  63. data/spec/{reader_spec.rb → unit/test_reader.rb} +4 -0
  64. data/spec/unit/test_relation.rb +40 -0
  65. data/spec/{renderer_spec.rb → unit/test_renderer.rb} +0 -0
  66. data/spec/{tools/ordering_key_spec.rb → unit/tools/test_ordering_key.rb} +0 -0
  67. data/spec/{tools/projection_key_spec.rb → unit/tools/test_projection_key.rb} +0 -0
  68. data/spec/{tools/tools_spec.rb → unit/tools/test_tools.rb} +0 -0
  69. data/spec/{tools/tuple_handle_spec.rb → unit/tools/test_tuple_handle.rb} +0 -0
  70. data/tasks/clean.rake +3 -0
  71. data/tasks/spec_test.rake +1 -1
  72. metadata +143 -114
  73. data/examples/nest.alf +0 -2
  74. data/examples/unnest.alf +0 -4
  75. data/examples/with.alf +0 -23
  76. data/spec/operator/relational/summarize_spec.rb +0 -41
  77. data/spec/reader/alf_file_spec.rb +0 -15
File without changes
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ module Alf
3
+ describe Operator do
4
+
5
+ specify "each" do
6
+ ops = []
7
+ Operator.each{|m| ops << m}
8
+ nonrel = []
9
+ Operator::NonRelational.each{|m| nonrel << m}
10
+ rel = []
11
+ Operator::Relational.each{|m| rel << m}
12
+ ops.should == nonrel + rel
13
+ end
14
+
15
+ end
16
+ end
@@ -21,6 +21,10 @@ module Alf
21
21
  lambda{ Reader.reader('.noone') }.should raise_error
22
22
  end
23
23
 
24
+ specify "when an IO" do
25
+ Reader.reader($stdin).should be_a(Reader::Rash)
26
+ end
27
+
24
28
  end
25
29
 
26
30
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ module Alf
3
+ describe Relation do
4
+
5
+ let(:tuples){[
6
+ {:sid => 'S1', :name => 'Smith', :status => 20, :city => 'London'},
7
+ {:sid => 'S2', :name => 'Jones', :status => 10, :city => 'Paris'},
8
+ {:sid => 'S3', :name => 'Blake', :status => 30, :city => 'Paris'}
9
+ ]}
10
+ let(:tuples2){ tuples.sort{|t1,t2| t1[:name] <=> t2[:name]} }
11
+
12
+ let(:rel1){ Relation.new(tuples.to_set) }
13
+ let(:rel2){ Relation.new(tuples2.to_set) }
14
+ let(:rel3){ Relation.new(tuples[0..1].to_set) }
15
+
16
+ it "should have a cardinality method" do
17
+ rel1.cardinality.should == 3
18
+ end
19
+
20
+ it "should define == correctly" do
21
+ rel1.should == rel2
22
+ rel2.should == rel1
23
+ rel3.should_not == rel1
24
+ end
25
+
26
+ it "should allow putting them in hashes" do
27
+ h = {}
28
+ h[rel1] = 1
29
+ h[rel2] = 2
30
+ h[rel3] = 3
31
+ h.size.should == 2
32
+ h[rel1].should == 2
33
+ end
34
+
35
+ it "should be enumerable" do
36
+ rel1.to_a.sort{|t1,t2| t1[:sid] <=> t2[:sid]}.should == tuples
37
+ end
38
+
39
+ end
40
+ end
File without changes
data/tasks/clean.rake ADDED
@@ -0,0 +1,3 @@
1
+ task :clean do
2
+ Dir["**/*.rbc"].each{|f| FileUtils.rm_rf(f)}
3
+ end
data/tasks/spec_test.rake CHANGED
@@ -30,7 +30,7 @@ begin
30
30
  desc "Run RSpec code examples"
31
31
  RSpec::Core::RakeTask.new(:spec_test) do |t|
32
32
  # Glob pattern to match files.
33
- t.pattern = "spec/**/*_spec.rb"
33
+ t.pattern = "spec/**/test_*.rb"
34
34
 
35
35
  # By default, if there is a Gemfile, the generated command will include
36
36
  # 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,23 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-19 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2011-07-13 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rake
17
- requirement: &80781680 !ruby/object:Gem::Requirement
16
+ requirement: &73619970 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
21
20
  - !ruby/object:Gem::Version
22
- version: 0.8.7
21
+ version: 0.9.2
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *80781680
24
+ version_requirements: *73619970
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: bundler
28
- requirement: &80781160 !ruby/object:Gem::Requirement
27
+ requirement: &73619720 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ~>
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '1.0'
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: *80781160
35
+ version_requirements: *73619720
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: rspec
39
- requirement: &80780760 !ruby/object:Gem::Requirement
38
+ requirement: &73619490 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ~>
@@ -44,10 +43,10 @@ dependencies:
44
43
  version: 2.6.0
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *80780760
46
+ version_requirements: *73619490
48
47
  - !ruby/object:Gem::Dependency
49
48
  name: yard
50
- requirement: &80780420 !ruby/object:Gem::Requirement
49
+ requirement: &73619260 !ruby/object:Gem::Requirement
51
50
  none: false
52
51
  requirements:
53
52
  - - ~>
@@ -55,10 +54,10 @@ dependencies:
55
54
  version: 0.7.2
56
55
  type: :development
57
56
  prerelease: false
58
- version_requirements: *80780420
57
+ version_requirements: *73619260
59
58
  - !ruby/object:Gem::Dependency
60
59
  name: bluecloth
61
- requirement: &80780050 !ruby/object:Gem::Requirement
60
+ requirement: &73619030 !ruby/object:Gem::Requirement
62
61
  none: false
63
62
  requirements:
64
63
  - - ~>
@@ -66,10 +65,10 @@ dependencies:
66
65
  version: 2.0.9
67
66
  type: :development
68
67
  prerelease: false
69
- version_requirements: *80780050
68
+ version_requirements: *73619030
70
69
  - !ruby/object:Gem::Dependency
71
70
  name: wlang
72
- requirement: &80779450 !ruby/object:Gem::Requirement
71
+ requirement: &73618800 !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
74
  - - ~>
@@ -77,10 +76,10 @@ dependencies:
77
76
  version: 0.10.1
78
77
  type: :development
79
78
  prerelease: false
80
- version_requirements: *80779450
79
+ version_requirements: *73618800
81
80
  - !ruby/object:Gem::Dependency
82
81
  name: noe
83
- requirement: &80778880 !ruby/object:Gem::Requirement
82
+ requirement: &73618570 !ruby/object:Gem::Requirement
84
83
  none: false
85
84
  requirements:
86
85
  - - ~>
@@ -88,10 +87,10 @@ dependencies:
88
87
  version: 1.3.0
89
88
  type: :development
90
89
  prerelease: false
91
- version_requirements: *80778880
90
+ version_requirements: *73618570
92
91
  - !ruby/object:Gem::Dependency
93
92
  name: quickl
94
- requirement: &80778310 !ruby/object:Gem::Requirement
93
+ requirement: &73618340 !ruby/object:Gem::Requirement
95
94
  none: false
96
95
  requirements:
97
96
  - - ~>
@@ -99,9 +98,12 @@ dependencies:
99
98
  version: 0.2.1
100
99
  type: :runtime
101
100
  prerelease: false
102
- version_requirements: *80778310
103
- description: ! "Alf is a commandline tool and Ruby library to manipulate data with
104
- all the \npower of a truly relational algebra approach. "
101
+ version_requirements: *73618340
102
+ description: ! "Alf brings the relational algebra both in Shell and in Ruby. In Shell,
103
+ because \nmanipulating any relation-like data source should be as straightforward
104
+ as a \none-liner. In Ruby, because I've never understood why programming languages
105
+ \nprovide data structures like arrays, hashes, sets, trees and graphs but not \n_relations_...
106
+ Let's stop the segregation ;-)"
105
107
  email:
106
108
  - blambeau@gmail.com
107
109
  executables:
@@ -119,8 +121,6 @@ files:
119
121
  - examples/schema.yaml
120
122
  - examples/nulls.rash
121
123
  - examples/autonum.alf
122
- - examples/with.alf
123
- - examples/unnest.alf
124
124
  - examples/sort.alf
125
125
  - examples/quota.alf
126
126
  - examples/rename.alf
@@ -129,9 +129,12 @@ files:
129
129
  - examples/parts.rash
130
130
  - examples/cities.rash
131
131
  - examples/defaults.alf
132
+ - examples/unwrap.alf
132
133
  - examples/join.alf
133
134
  - examples/union.alf
135
+ - examples/pseudo-with.alf
134
136
  - examples/runall.sh
137
+ - examples/wrap.alf
135
138
  - examples/database.alf
136
139
  - examples/extend.alf
137
140
  - examples/compact.alf
@@ -139,58 +142,72 @@ files:
139
142
  - examples/summarize.alf
140
143
  - examples/minus.alf
141
144
  - examples/clip.alf
142
- - examples/nest.alf
143
145
  - examples/restrict.alf
144
146
  - lib/alf.rb
147
+ - lib/alf/relation.rb
145
148
  - lib/alf/loader.rb
146
149
  - lib/alf/renderer/yaml.rb
147
150
  - lib/alf/renderer/text.rb
148
151
  - lib/alf/version.rb
149
152
  - spec/spec_helper.rb
150
- - spec/examples_spec.rb
151
- - spec/reader/alf_file_spec.rb
152
- - spec/reader/input.rb
153
- - spec/reader/rash_spec.rb
154
- - spec/renderer_spec.rb
155
- - spec/alf_spec.rb
156
- - spec/aggregator_spec.rb
157
- - spec/lispy_spec.rb
158
- - spec/assumptions_spec.rb
159
- - spec/environment/explicit_spec.rb
160
- - spec/environment/folder_spec.rb
161
- - spec/tools/ordering_key_spec.rb
162
- - spec/tools/tuple_handle_spec.rb
163
- - spec/tools/projection_key_spec.rb
164
- - spec/tools/tools_spec.rb
165
- - spec/reader_spec.rb
166
- - spec/renderer/text/table_spec.rb
167
- - spec/renderer/text/row_spec.rb
168
- - spec/renderer/text/cell_spec.rb
169
- - spec/operator/command_methods_spec.rb
170
- - spec/operator/relational/extend_spec.rb
171
- - spec/operator/relational/union_spec.rb
172
- - spec/operator/relational/minus_spec.rb
173
- - spec/operator/relational/join/hash_based_spec.rb
174
- - spec/operator/relational/project_spec.rb
175
- - spec/operator/relational/group_spec.rb
176
- - spec/operator/relational/summarize_spec.rb
177
- - spec/operator/relational/rename_spec.rb
178
- - spec/operator/relational/unnest_spec.rb
179
- - spec/operator/relational/quota_spec.rb
180
- - spec/operator/relational/nest_spec.rb
181
- - spec/operator/relational/intersect_spec.rb
182
- - spec/operator/relational/restrict_spec.rb
183
- - spec/operator/relational/ungroup_spec.rb
184
- - spec/operator/relational/summarize/sort_based_spec.rb
185
- - spec/operator/non_relational/compact/sort_based_spec.rb
186
- - spec/operator/non_relational/compact/buffer_based.rb
187
- - spec/operator/non_relational/sort_spec.rb
188
- - spec/operator/non_relational/clip_spec.rb
189
- - spec/operator/non_relational/defaults_spec.rb
190
- - spec/operator/non_relational/autonum_spec.rb
191
- - spec/operator/non_relational/compact_spec.rb
153
+ - spec/integration/test_examples.rb
154
+ - spec/integration/test_alf_specs.rb
155
+ - spec/integration/src/test_minus.alf
156
+ - spec/integration/src/test_project.alf
157
+ - spec/integration/test_alf.rb
158
+ - spec/unit/test_operator.rb
159
+ - spec/unit/test_relation.rb
160
+ - spec/unit/relation/test_relops.rb
161
+ - spec/unit/relation/test_inspect.rb
162
+ - spec/unit/relation/test_coerce.rb
163
+ - spec/unit/reader/input.rb
164
+ - spec/unit/reader/test_rash.rb
165
+ - spec/unit/reader/test_alf_file.rb
166
+ - spec/unit/test_lispy.rb
167
+ - spec/unit/test_aggregator.rb
168
+ - spec/unit/environment/examples/suppliers.rash
169
+ - spec/unit/environment/test_explicit.rb
170
+ - spec/unit/environment/test_folder.rb
171
+ - spec/unit/tools/test_projection_key.rb
172
+ - spec/unit/tools/test_tools.rb
173
+ - spec/unit/tools/test_ordering_key.rb
174
+ - spec/unit/tools/test_tuple_handle.rb
175
+ - spec/unit/test_assumptions.rb
176
+ - spec/unit/renderer/text/test_cell.rb
177
+ - spec/unit/renderer/text/test_table.rb
178
+ - spec/unit/renderer/text/test_row.rb
179
+ - spec/unit/test_renderer.rb
180
+ - spec/unit/operator/test_non_relational.rb
181
+ - spec/unit/operator/relational/test_join.rb
182
+ - spec/unit/operator/relational/test_extend.rb
183
+ - spec/unit/operator/relational/test_intersect.rb
184
+ - spec/unit/operator/relational/test_summarize.rb
185
+ - spec/unit/operator/relational/test_rename.rb
186
+ - spec/unit/operator/relational/join/test_hash_based.rb
187
+ - spec/unit/operator/relational/test_wrap.rb
188
+ - spec/unit/operator/relational/test_restrict.rb
189
+ - spec/unit/operator/relational/test_minus.rb
190
+ - spec/unit/operator/relational/test_quota.rb
191
+ - spec/unit/operator/relational/test_unwrap.rb
192
+ - spec/unit/operator/relational/test_group.rb
193
+ - spec/unit/operator/relational/test_union.rb
194
+ - spec/unit/operator/relational/test_project.rb
195
+ - spec/unit/operator/relational/summarize/test_hash_based.rb
196
+ - spec/unit/operator/relational/summarize/test_sort_based.rb
197
+ - spec/unit/operator/relational/test_ungroup.rb
198
+ - spec/unit/operator/non_relational/test_defaults.rb
199
+ - spec/unit/operator/non_relational/compact/test_sort_based.rb
200
+ - spec/unit/operator/non_relational/compact/buffer_based.rb
201
+ - spec/unit/operator/non_relational/test_sort.rb
202
+ - spec/unit/operator/non_relational/test_clip.rb
203
+ - spec/unit/operator/non_relational/test_autonum.rb
204
+ - spec/unit/operator/non_relational/test_compact.rb
205
+ - spec/unit/operator/test_command_methods.rb
206
+ - spec/unit/operator/test_relational.rb
207
+ - spec/unit/test_reader.rb
192
208
  - tasks/debug_mail.rake
193
209
  - tasks/yard.rake
210
+ - tasks/clean.rake
194
211
  - tasks/gem.rake
195
212
  - tasks/spec_test.rake
196
213
  - tasks/unit_test.rake
@@ -205,7 +222,6 @@ files:
205
222
  - Manifest.txt
206
223
  - README.md
207
224
  - TODO.md
208
- has_rdoc: true
209
225
  homepage: http://rubydoc.info/github/blambeau/alf/master/frames
210
226
  licenses: []
211
227
  post_install_message:
@@ -220,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
236
  version: '0'
221
237
  segments:
222
238
  - 0
223
- hash: 1038168221
239
+ hash: 861666799
224
240
  required_rubygems_version: !ruby/object:Gem::Requirement
225
241
  none: false
226
242
  requirements:
@@ -229,54 +245,67 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
245
  version: '0'
230
246
  segments:
231
247
  - 0
232
- hash: 1038168221
248
+ hash: 861666799
233
249
  requirements: []
234
250
  rubyforge_project:
235
- rubygems_version: 1.6.2
251
+ rubygems_version: 1.8.5
236
252
  signing_key:
237
253
  specification_version: 3
238
- summary: Classy data-manipulation dressed in a DSL (+ commandline)
254
+ summary: Relational Algebra at your fingertips
239
255
  test_files:
240
256
  - spec/spec_helper.rb
241
- - spec/examples_spec.rb
242
- - spec/reader/alf_file_spec.rb
243
- - spec/reader/input.rb
244
- - spec/reader/rash_spec.rb
245
- - spec/renderer_spec.rb
246
- - spec/alf_spec.rb
247
- - spec/aggregator_spec.rb
248
- - spec/lispy_spec.rb
249
- - spec/assumptions_spec.rb
250
- - spec/environment/explicit_spec.rb
251
- - spec/environment/folder_spec.rb
252
- - spec/tools/ordering_key_spec.rb
253
- - spec/tools/tuple_handle_spec.rb
254
- - spec/tools/projection_key_spec.rb
255
- - spec/tools/tools_spec.rb
256
- - spec/reader_spec.rb
257
- - spec/renderer/text/table_spec.rb
258
- - spec/renderer/text/row_spec.rb
259
- - spec/renderer/text/cell_spec.rb
260
- - spec/operator/command_methods_spec.rb
261
- - spec/operator/relational/extend_spec.rb
262
- - spec/operator/relational/union_spec.rb
263
- - spec/operator/relational/minus_spec.rb
264
- - spec/operator/relational/join/hash_based_spec.rb
265
- - spec/operator/relational/project_spec.rb
266
- - spec/operator/relational/group_spec.rb
267
- - spec/operator/relational/summarize_spec.rb
268
- - spec/operator/relational/rename_spec.rb
269
- - spec/operator/relational/unnest_spec.rb
270
- - spec/operator/relational/quota_spec.rb
271
- - spec/operator/relational/nest_spec.rb
272
- - spec/operator/relational/intersect_spec.rb
273
- - spec/operator/relational/restrict_spec.rb
274
- - spec/operator/relational/ungroup_spec.rb
275
- - spec/operator/relational/summarize/sort_based_spec.rb
276
- - spec/operator/non_relational/compact/sort_based_spec.rb
277
- - spec/operator/non_relational/compact/buffer_based.rb
278
- - spec/operator/non_relational/sort_spec.rb
279
- - spec/operator/non_relational/clip_spec.rb
280
- - spec/operator/non_relational/defaults_spec.rb
281
- - spec/operator/non_relational/autonum_spec.rb
282
- - spec/operator/non_relational/compact_spec.rb
257
+ - spec/integration/test_examples.rb
258
+ - spec/integration/test_alf_specs.rb
259
+ - spec/integration/src/test_minus.alf
260
+ - spec/integration/src/test_project.alf
261
+ - spec/integration/test_alf.rb
262
+ - spec/unit/test_operator.rb
263
+ - spec/unit/test_relation.rb
264
+ - spec/unit/relation/test_relops.rb
265
+ - spec/unit/relation/test_inspect.rb
266
+ - spec/unit/relation/test_coerce.rb
267
+ - spec/unit/reader/input.rb
268
+ - spec/unit/reader/test_rash.rb
269
+ - spec/unit/reader/test_alf_file.rb
270
+ - spec/unit/test_lispy.rb
271
+ - spec/unit/test_aggregator.rb
272
+ - spec/unit/environment/examples/suppliers.rash
273
+ - spec/unit/environment/test_explicit.rb
274
+ - spec/unit/environment/test_folder.rb
275
+ - spec/unit/tools/test_projection_key.rb
276
+ - spec/unit/tools/test_tools.rb
277
+ - spec/unit/tools/test_ordering_key.rb
278
+ - spec/unit/tools/test_tuple_handle.rb
279
+ - spec/unit/test_assumptions.rb
280
+ - spec/unit/renderer/text/test_cell.rb
281
+ - spec/unit/renderer/text/test_table.rb
282
+ - spec/unit/renderer/text/test_row.rb
283
+ - spec/unit/test_renderer.rb
284
+ - spec/unit/operator/test_non_relational.rb
285
+ - spec/unit/operator/relational/test_join.rb
286
+ - spec/unit/operator/relational/test_extend.rb
287
+ - spec/unit/operator/relational/test_intersect.rb
288
+ - spec/unit/operator/relational/test_summarize.rb
289
+ - spec/unit/operator/relational/test_rename.rb
290
+ - spec/unit/operator/relational/join/test_hash_based.rb
291
+ - spec/unit/operator/relational/test_wrap.rb
292
+ - spec/unit/operator/relational/test_restrict.rb
293
+ - spec/unit/operator/relational/test_minus.rb
294
+ - spec/unit/operator/relational/test_quota.rb
295
+ - spec/unit/operator/relational/test_unwrap.rb
296
+ - spec/unit/operator/relational/test_group.rb
297
+ - spec/unit/operator/relational/test_union.rb
298
+ - spec/unit/operator/relational/test_project.rb
299
+ - spec/unit/operator/relational/summarize/test_hash_based.rb
300
+ - spec/unit/operator/relational/summarize/test_sort_based.rb
301
+ - spec/unit/operator/relational/test_ungroup.rb
302
+ - spec/unit/operator/non_relational/test_defaults.rb
303
+ - spec/unit/operator/non_relational/compact/test_sort_based.rb
304
+ - spec/unit/operator/non_relational/compact/buffer_based.rb
305
+ - spec/unit/operator/non_relational/test_sort.rb
306
+ - spec/unit/operator/non_relational/test_clip.rb
307
+ - spec/unit/operator/non_relational/test_autonum.rb
308
+ - spec/unit/operator/non_relational/test_compact.rb
309
+ - spec/unit/operator/test_command_methods.rb
310
+ - spec/unit/operator/test_relational.rb
311
+ - spec/unit/test_reader.rb
data/examples/nest.alf DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env alf
2
- (nest :suppliers, [:city, :status], :loc_and_status)
data/examples/unnest.alf DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env alf
2
- (unnest \
3
- (nest :suppliers, [:city, :status], :loc_and_status),
4
- :loc_and_status)
data/examples/with.alf DELETED
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env alf
2
-
3
- # Compute the total qty supplied in each country together with the subset
4
- # of products shipped there. Only consider suppliers that have a status
5
- # greater than 10, however.
6
- (summarize \
7
- (join \
8
- (join (restrict :suppliers, lambda{ status > 10 }),
9
- :supplies),
10
- :cities),
11
- [:country],
12
- :which => Agg::group(:pid),
13
- :total => Agg::sum{ qty })
14
-
15
- # Another equivalent way to write it
16
- with( :kept_suppliers => (restrict :suppliers, lambda{ status > 10 }),
17
- :with_countries => (join :kept_suppliers, :cities),
18
- :supplying => (join :with_countries, :supplies) ) do
19
- (summarize :supplying,
20
- [:country],
21
- :which => Agg::group(:pid),
22
- :total => Agg::sum{ qty })
23
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- module Operator::Relational
4
- describe Summarize do
5
-
6
- let(:operator_class){ Summarize }
7
- it_should_behave_like("An operator class")
8
-
9
- let(:input) {[
10
- {:a => "via_reader", :time => 2},
11
- {:a => "via_method", :time => 1},
12
- {:a => "via_method", :time => 2},
13
- {:a => "via_reader", :time => 4},
14
- {:a => "via_method", :time => 1},
15
- ]}
16
-
17
- let(:expected) {[
18
- {:a => "via_method", :time_sum => 4, :time_max => 2},
19
- {:a => "via_reader", :time_sum => 6, :time_max => 4},
20
- ]}
21
-
22
- subject{ operator.to_a }
23
-
24
- describe "When factored with commandline args" do
25
- let(:opts){ ["--by=a"] }
26
- let(:aggs){ ["time_sum", "sum(:time)", "time_max", "max(:time)"] }
27
- let(:operator){ Summarize.run(opts + ["--"] +aggs) }
28
- before{ operator.pipe(input) }
29
- it { should == expected }
30
- end
31
-
32
- describe "When factored with Lispy" do
33
- let(:aggs){{:time_sum => Aggregator.sum(:time),
34
- :time_max => Aggregator.max(:time)}}
35
- let(:operator){ Lispy.summarize(input, [:a], aggs) }
36
- it { should == expected }
37
- end
38
-
39
- end
40
- end
41
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
- module Alf
3
- describe Reader::AlfFile do
4
-
5
- let(:io){ StringIO.new "(restrict :suppliers, lambda{status > 20})" }
6
- let(:reader){ Reader::AlfFile.new(io, self) }
7
- def dataset(name)
8
- [{:status => 10},{:status => 30}]
9
- end
10
-
11
- subject{ reader.to_a }
12
- it{ should == [{:status => 30}]}
13
-
14
- end
15
- end