alf 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +22 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +9 -10
- data/alf.gemspec +3 -3
- data/alf.noespec +5 -4
- data/doc/commands/show.md +1 -1
- data/doc/operators/relational/heading.md +20 -0
- data/doc/operators/relational/join.md +4 -3
- data/doc/operators/relational/matching.md +7 -3
- data/doc/operators/relational/restrict.md +2 -2
- data/examples/hitradio/compact.rb +48 -0
- data/examples/hitradio/compare1.rb +28 -0
- data/examples/hitradio/gz_reader.rb +23 -0
- data/examples/hitradio/hitradio-1.alf +1 -0
- data/examples/hitradio/hitradio.log +25080 -0
- data/examples/hitradio/hitradio.mar +25081 -0
- data/examples/hitradio/hitradio.mar.gz +0 -0
- data/examples/hitradio/hitradio.rash +25080 -0
- data/examples/hitradio/mar_reader.rb +18 -0
- data/lib/alf/aggregator/aggregators.rb +28 -0
- data/lib/alf/aggregator/aggregators.rbc +2640 -0
- data/lib/alf/aggregator/base.rbc +1055 -0
- data/lib/alf/aggregator/class_methods.rb +1 -1
- data/lib/alf/aggregator/class_methods.rbc +830 -0
- data/lib/alf/buffer/sorted.rbc +715 -0
- data/lib/alf/command/class_methods.rbc +453 -0
- data/lib/alf/command/doc_manager.rbc +1604 -0
- data/lib/alf/command/exec.rbc +408 -0
- data/lib/alf/command/help.rbc +764 -0
- data/lib/alf/command/main.rb +37 -5
- data/lib/alf/command/main.rbc +3612 -0
- data/lib/alf/command/show.rb +37 -5
- data/lib/alf/command/show.rbc +1327 -0
- data/lib/alf/environment/base.rbc +459 -0
- data/lib/alf/environment/class_methods.rbc +1110 -0
- data/lib/alf/environment/explicit.rb +2 -2
- data/lib/alf/environment/explicit.rbc +601 -0
- data/lib/alf/environment/folder.rb +2 -2
- data/lib/alf/environment/folder.rbc +942 -0
- data/lib/alf/errors.rb +4 -0
- data/lib/alf/errors.rbc +155 -0
- data/lib/alf/extra/csv.rb +5 -2
- data/lib/alf/extra/csv.rbc +2021 -0
- data/lib/alf/extra/logs.rbc +1957 -0
- data/lib/alf/extra/sequel.rbc +1417 -0
- data/lib/alf/extra/yaml.rbc +435 -0
- data/lib/alf/extra.rbc +101 -0
- data/lib/alf/iterator/base.rbc +437 -0
- data/lib/alf/iterator/class_methods.rbc +518 -0
- data/lib/alf/iterator/proxy.rbc +599 -0
- data/lib/alf/lispy/instance_methods.rbc +2535 -0
- data/lib/alf/loader.rb +2 -1
- data/lib/alf/loader.rbc +85 -0
- data/lib/alf/operator/base.rbc +860 -0
- data/lib/alf/operator/binary.rbc +595 -0
- data/lib/alf/operator/cesure.rbc +883 -0
- data/lib/alf/operator/class_methods.rbc +1915 -0
- data/lib/alf/operator/experimental.rbc +200 -0
- data/lib/alf/operator/non_relational/autonum.rbc +587 -0
- data/lib/alf/operator/non_relational/clip.rbc +522 -0
- data/lib/alf/operator/non_relational/coerce.rbc +596 -0
- data/lib/alf/operator/non_relational/compact.rbc +1283 -0
- data/lib/alf/operator/non_relational/defaults.rbc +733 -0
- data/lib/alf/operator/non_relational/generator.rbc +1015 -0
- data/lib/alf/operator/non_relational/sort.rbc +665 -0
- data/lib/alf/operator/nullary.rbc +404 -0
- data/lib/alf/operator/relational/extend.rbc +616 -0
- data/lib/alf/operator/relational/group.rbc +968 -0
- data/lib/alf/operator/relational/heading.rb +30 -0
- data/lib/alf/operator/relational/heading.rbc +657 -0
- data/lib/alf/operator/relational/intersect.rbc +969 -0
- data/lib/alf/operator/relational/join.rbc +1708 -0
- data/lib/alf/operator/relational/matching.rbc +1047 -0
- data/lib/alf/operator/relational/minus.rbc +965 -0
- data/lib/alf/operator/relational/not_matching.rbc +1047 -0
- data/lib/alf/operator/relational/project.rbc +669 -0
- data/lib/alf/operator/relational/quota.rbc +1193 -0
- data/lib/alf/operator/relational/rank.rbc +1217 -0
- data/lib/alf/operator/relational/rename.rbc +496 -0
- data/lib/alf/operator/relational/restrict.rbc +611 -0
- data/lib/alf/operator/relational/summarize.rbc +1922 -0
- data/lib/alf/operator/relational/ungroup.rbc +643 -0
- data/lib/alf/operator/relational/union.rbc +846 -0
- data/lib/alf/operator/relational/unwrap.rbc +540 -0
- data/lib/alf/operator/relational/wrap.rbc +560 -0
- data/lib/alf/operator/shortcut.rbc +809 -0
- data/lib/alf/operator/signature.rbc +4640 -0
- data/lib/alf/operator/transform.rbc +484 -0
- data/lib/alf/operator/unary.rbc +629 -0
- data/lib/alf/reader/alf_file.rbc +464 -0
- data/lib/alf/reader/base.rbc +1613 -0
- data/lib/alf/reader/class_methods.rb +1 -1
- data/lib/alf/reader/class_methods.rbc +1099 -0
- data/lib/alf/reader/rash.rbc +583 -0
- data/lib/alf/relation/class_methods.rbc +674 -0
- data/lib/alf/relation/instance_methods.rb +7 -0
- data/lib/alf/relation/instance_methods.rbc +2107 -0
- data/lib/alf/renderer/base.rbc +936 -0
- data/lib/alf/renderer/class_methods.rbc +875 -0
- data/lib/alf/renderer/rash.rb +16 -2
- data/lib/alf/renderer/rash.rbc +802 -0
- data/lib/alf/renderer/text.rb +54 -16
- data/lib/alf/renderer/text.rbc +5530 -0
- data/lib/alf/tools/coerce.rbc +352 -0
- data/lib/alf/tools/miscellaneous.rb +8 -1
- data/lib/alf/tools/miscellaneous.rbc +1497 -0
- data/lib/alf/tools/to_lispy.rbc +2618 -0
- data/lib/alf/tools/to_ruby_literal.rbc +344 -0
- data/lib/alf/tools/tuple_handle.rbc +738 -0
- data/lib/alf/types/attr_list.rbc +1535 -0
- data/lib/alf/types/attr_name.rbc +781 -0
- data/lib/alf/types/boolean.rbc +365 -0
- data/lib/alf/types/heading.rb +16 -1
- data/lib/alf/types/heading.rbc +1778 -0
- data/lib/alf/types/ordering.rbc +2228 -0
- data/lib/alf/types/renaming.rbc +1064 -0
- data/lib/alf/types/summarization.rbc +1394 -0
- data/lib/alf/types/tuple_computation.rbc +1061 -0
- data/lib/alf/types/tuple_expression.rbc +1016 -0
- data/lib/alf/types/tuple_predicate.rbc +1349 -0
- data/lib/alf/version.rb +1 -1
- data/lib/alf/version.rbc +350 -0
- data/lib/alf.rb +13 -5
- data/lib/alf.rbc +3884 -0
- data/spec/integration/command/alf/alf_help.stdout +8 -6
- data/spec/integration/command/help/help_1.stdout +3 -1
- data/spec/integration/command/show/show_base.cmd +1 -1
- data/spec/integration/command/show/show_base_sort_1.cmd +1 -0
- data/spec/integration/command/show/show_base_sort_1.stdout +9 -0
- data/spec/integration/command/show/show_base_sort_2.cmd +1 -0
- data/spec/integration/command/show/show_base_sort_2.stdout +9 -0
- data/spec/integration/command/show/show_ff.cmd +1 -0
- data/spec/integration/command/show/show_ff.stdout +10 -0
- data/spec/integration/command/show/show_rash_pretty.cmd +1 -0
- data/spec/integration/command/show/show_rash_pretty.stdout +30 -0
- data/spec/integration/test_alf.rbc +1098 -0
- data/spec/integration/test_command.rbc +1832 -0
- data/spec/integration/test_examples.rbc +559 -0
- data/spec/integration/test_semantics.rbc +991 -0
- data/spec/regression/alf_file/test___FILE__.rbc +524 -0
- data/spec/regression/heading/test_heading_with_date.rbc +381 -0
- data/spec/regression/lispy/test_compile.rbc +404 -0
- data/spec/regression/logs/test_path_attribute.rbc +687 -0
- data/spec/regression/relation/test_relation_allbut_all.rbc +468 -0
- data/spec/regression/relation/test_relation_with_date.rbc +381 -0
- data/spec/regression/restrict/test_restrict_with_keywords.rbc +628 -0
- data/spec/shared/a_value.rbc +337 -0
- data/spec/shared/an_operator_class.rbc +908 -0
- data/spec/spec_helper.rbc +453 -0
- data/spec/unit/assumptions/test_file.rbc +668 -0
- data/spec/unit/assumptions/test_instance_eval.rbc +654 -0
- data/spec/unit/assumptions/test_scoping.rbc +755 -0
- data/spec/unit/assumptions/test_set.rbc +1928 -0
- data/spec/unit/command/doc_manager/test_call.rbc +1537 -0
- data/spec/unit/csv/test_reader.rbc +2228 -0
- data/spec/unit/csv/test_renderer.rbc +2426 -0
- data/spec/unit/environment/test_explicit.rbc +464 -0
- data/spec/unit/environment/test_folder.rb +2 -2
- data/spec/unit/environment/test_folder.rbc +1304 -0
- data/spec/unit/lispy/test_relation.rbc +1477 -0
- data/spec/unit/lispy/test_run.rbc +1735 -0
- data/spec/unit/lispy/test_tuple.rbc +1686 -0
- data/spec/unit/logs/test_reader.rb +6 -4
- data/spec/unit/logs/test_reader.rbc +1807 -0
- data/spec/unit/operator/non_relational/compact/test_buffer_based.rbc +1127 -0
- data/spec/unit/operator/non_relational/compact/test_sort_based.rbc +1127 -0
- data/spec/unit/operator/non_relational/test_autonum.rbc +1969 -0
- data/spec/unit/operator/non_relational/test_clip.rbc +1850 -0
- data/spec/unit/operator/non_relational/test_coerce.rbc +1290 -0
- data/spec/unit/operator/non_relational/test_compact.rbc +1382 -0
- data/spec/unit/operator/non_relational/test_defaults.rbc +2319 -0
- data/spec/unit/operator/non_relational/test_generator.rbc +2361 -0
- data/spec/unit/operator/non_relational/test_sort.rbc +2583 -0
- data/spec/unit/operator/relational/join/test_hash_based.rbc +2481 -0
- data/spec/unit/operator/relational/matching/test_hash_based.rbc +2458 -0
- data/spec/unit/operator/relational/not_matching/test_hash_based.rbc +1632 -0
- data/spec/unit/operator/relational/summarize/test_hash_based.rbc +1990 -0
- data/spec/unit/operator/relational/summarize/test_sort_based.rbc +1990 -0
- data/spec/unit/operator/relational/test_extend.rbc +1300 -0
- data/spec/unit/operator/relational/test_group.rbc +2142 -0
- data/spec/unit/operator/relational/test_intersect.rbc +2069 -0
- data/spec/unit/operator/relational/test_join.rbc +1282 -0
- data/spec/unit/operator/relational/test_minus.rbc +1995 -0
- data/spec/unit/operator/relational/test_project.rbc +2870 -0
- data/spec/unit/operator/relational/test_quota.rbc +1788 -0
- data/spec/unit/operator/relational/test_rank.rbc +2079 -0
- data/spec/unit/operator/relational/test_rename.rbc +1158 -0
- data/spec/unit/operator/relational/test_restrict.rbc +2305 -0
- data/spec/unit/operator/relational/test_summarize.rbc +2570 -0
- data/spec/unit/operator/relational/test_ungroup.rbc +1425 -0
- data/spec/unit/operator/relational/test_union.rbc +1089 -0
- data/spec/unit/operator/relational/test_unwrap.rbc +1176 -0
- data/spec/unit/operator/relational/test_wrap.rbc +1203 -0
- data/spec/unit/operator/signature/test_collect_on.rbc +1989 -0
- data/spec/unit/operator/signature/test_initialize.rbc +544 -0
- data/spec/unit/operator/signature/test_install.rbc +1671 -0
- data/spec/unit/operator/signature/test_option_parser.rbc +1348 -0
- data/spec/unit/operator/signature/test_parse_args.rbc +1908 -0
- data/spec/unit/operator/signature/test_parse_argv.rbc +2878 -0
- data/spec/unit/operator/signature/test_to_lispy.rbc +3305 -0
- data/spec/unit/operator/signature/test_to_shell.rbc +3327 -0
- data/spec/unit/operator/test_non_relational.rbc +571 -0
- data/spec/unit/operator/test_relational.rb +2 -1
- data/spec/unit/operator/test_relational.rbc +758 -0
- data/spec/unit/reader/test_alf_file.rbc +1107 -0
- data/spec/unit/reader/test_initialize.rbc +1774 -0
- data/spec/unit/reader/test_rash.rbc +1127 -0
- data/spec/unit/relation/test_coerce.rbc +2320 -0
- data/spec/unit/relation/test_inspect.rbc +502 -0
- data/spec/unit/relation/test_relops.rbc +1585 -0
- data/spec/unit/relation/test_to_a.rbc +1112 -0
- data/spec/unit/renderer/test_initialize.rbc +1766 -0
- data/spec/unit/sequel/test_environment.rbc +1723 -0
- data/spec/unit/test_aggregator.rb +38 -1
- data/spec/unit/test_aggregator.rbc +4358 -0
- data/spec/unit/test_environment.rbc +1271 -0
- data/spec/unit/test_lispy.rbc +879 -0
- data/spec/unit/test_operator.rbc +531 -0
- data/spec/unit/test_reader.rb +6 -2
- data/spec/unit/test_reader.rbc +1249 -0
- data/spec/unit/test_relation.rbc +2588 -0
- data/spec/unit/test_renderer.rb +12 -1
- data/spec/unit/test_renderer.rbc +2011 -0
- data/spec/unit/text/test_cell.rb +1 -0
- data/spec/unit/text/test_cell.rbc +1532 -0
- data/spec/unit/text/test_row.rbc +847 -0
- data/spec/unit/text/test_table.rbc +978 -0
- data/spec/unit/tools/test_coalesce.rbc +456 -0
- data/spec/unit/tools/test_coerce.rbc +279 -0
- data/spec/unit/tools/test_to_lispy.rbc +5711 -0
- data/spec/unit/tools/test_to_ruby_literal.rbc +272 -0
- data/spec/unit/tools/test_tools.rbc +672 -0
- data/spec/unit/tools/test_tuple_handle.rbc +1591 -0
- data/spec/unit/tools/test_tuple_heading.rb +20 -0
- data/spec/unit/tools/test_tuple_heading.rbc +821 -0
- data/spec/unit/tools/test_varargs.rbc +495 -0
- data/spec/unit/types/heading/test_union.rb +21 -0
- data/spec/unit/types/heading/test_union.rbc +1043 -0
- data/spec/unit/types/test_attr_list.rbc +4481 -0
- data/spec/unit/types/test_attr_name.rbc +1872 -0
- data/spec/unit/types/test_heading.rbc +1735 -0
- data/spec/unit/types/test_ordering.rbc +3695 -0
- data/spec/unit/types/test_renaming.rbc +2426 -0
- data/spec/unit/types/test_summarization.rbc +2538 -0
- data/spec/unit/types/test_tuple_computation.rbc +2340 -0
- data/spec/unit/types/test_tuple_expression.rbc +2285 -0
- data/spec/unit/types/test_tuple_predicate.rbc +3168 -0
- data/tasks/gh-pages.rake +1 -1
- metadata +529 -125
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 0.10.1 / 2011-08-31
|
2
|
+
|
3
|
+
## Miscellaneous enhancements
|
4
|
+
|
5
|
+
* Added Variance and Stddev aggregation operators; they are available under
|
6
|
+
Aggregator.variance{} and Aggregator.stddev{}, respectively
|
7
|
+
* Added a --pretty option to 'alf', whose semantics is delegated to the output
|
8
|
+
renderer. Same option is available on 'alf show'.
|
9
|
+
* 'alf show' now accepts an optional ordering argument. This avoids explicitely
|
10
|
+
including non-relational sort invocations in your pipe (sorting should be
|
11
|
+
seen as a displaying issue)
|
12
|
+
* Added an options hash to text renderer, :float_format among others
|
13
|
+
* Added a --ff option to 'alf show', for float format in text rendering
|
14
|
+
|
15
|
+
## Bugfixes
|
16
|
+
|
17
|
+
* Alf::Environment::(Folder/Explicit)#dataset now correctly raises a
|
18
|
+
NoSuchDatasetError when the dataset cannot be found, as required by the
|
19
|
+
specification.
|
20
|
+
* Alf::Reader.reader now correctly returns a Rash reader when invoked on a
|
21
|
+
StringIO
|
22
|
+
|
1
23
|
# 0.10.0 / 2011-08-15
|
2
24
|
|
3
25
|
## New recognized data sources
|
data/Gemfile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
group :runtime do
|
4
|
-
gem "quickl", "~> 0.4.
|
5
|
-
gem "myrrha", "~> 1.2.
|
4
|
+
gem "quickl", "~> 0.4.1"
|
5
|
+
gem "myrrha", "~> 1.2.1"
|
6
|
+
gem "highline", "~> 1.6.2"
|
6
7
|
end
|
7
8
|
|
8
9
|
group :test do
|
@@ -17,7 +18,6 @@ group :release do
|
|
17
18
|
end
|
18
19
|
|
19
20
|
group :doc do
|
20
|
-
gem "rcov", "~> 0.9.9"
|
21
21
|
gem "yard", "~> 0.7.2"
|
22
22
|
gem "bluecloth", "~> 2.1.0"
|
23
23
|
gem "redcarpet", "~> 1.17.2"
|
data/Gemfile.lock
CHANGED
@@ -2,15 +2,14 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
bluecloth (2.1.0)
|
5
|
-
diff-lcs (1.1.
|
5
|
+
diff-lcs (1.1.3)
|
6
6
|
fastercsv (1.5.4)
|
7
|
-
|
8
|
-
|
7
|
+
highline (1.6.2)
|
8
|
+
myrrha (1.2.1)
|
9
|
+
quickl (0.4.1)
|
9
10
|
rake (0.9.2)
|
10
|
-
rcov (0.9.9)
|
11
|
-
rcov (0.9.9-java)
|
12
11
|
redcarpet (1.17.2)
|
13
|
-
request-log-analyzer (1.11.
|
12
|
+
request-log-analyzer (1.11.1)
|
14
13
|
rspec (2.6.0)
|
15
14
|
rspec-core (~> 2.6.0)
|
16
15
|
rspec-expectations (~> 2.6.0)
|
@@ -20,7 +19,7 @@ GEM
|
|
20
19
|
diff-lcs (~> 1.1.2)
|
21
20
|
rspec-mocks (2.6.0)
|
22
21
|
sequel (3.25.0)
|
23
|
-
sqlite3 (1.3.
|
22
|
+
sqlite3 (1.3.4)
|
24
23
|
wlang (0.10.2)
|
25
24
|
yard (0.7.2)
|
26
25
|
|
@@ -31,10 +30,10 @@ PLATFORMS
|
|
31
30
|
DEPENDENCIES
|
32
31
|
bluecloth (~> 2.1.0)
|
33
32
|
fastercsv (~> 1.5.4)
|
34
|
-
|
35
|
-
|
33
|
+
highline (~> 1.6.2)
|
34
|
+
myrrha (~> 1.2.1)
|
35
|
+
quickl (~> 0.4.1)
|
36
36
|
rake (~> 0.9.2)
|
37
|
-
rcov (~> 0.9.9)
|
38
37
|
redcarpet (~> 1.17.2)
|
39
38
|
request-log-analyzer (~> 1.11.0)
|
40
39
|
rspec (~> 2.6.0)
|
data/alf.gemspec
CHANGED
@@ -126,7 +126,6 @@ Gem::Specification.new do |s|
|
|
126
126
|
s.add_development_dependency("rake", "~> 0.9.2")
|
127
127
|
s.add_development_dependency("rspec", "~> 2.6.0")
|
128
128
|
s.add_development_dependency("wlang", "~> 0.10.2")
|
129
|
-
s.add_development_dependency("rcov", "~> 0.9.9")
|
130
129
|
s.add_development_dependency("yard", "~> 0.7.2")
|
131
130
|
s.add_development_dependency("bluecloth", "~> 2.1.0")
|
132
131
|
s.add_development_dependency("redcarpet", "~> 1.17.2")
|
@@ -134,8 +133,9 @@ Gem::Specification.new do |s|
|
|
134
133
|
s.add_development_dependency("request-log-analyzer", "~> 1.11.0")
|
135
134
|
s.add_development_dependency("sequel", "~> 3.25.0")
|
136
135
|
s.add_development_dependency("sqlite3", "~> 1.3.0")
|
137
|
-
s.add_dependency("quickl", "~> 0.4.
|
138
|
-
s.add_dependency("myrrha", "~> 1.2.
|
136
|
+
s.add_dependency("quickl", "~> 0.4.1")
|
137
|
+
s.add_dependency("myrrha", "~> 1.2.1")
|
138
|
+
s.add_dependency("highline", "~> 1.6.2")
|
139
139
|
|
140
140
|
# The version of ruby required by this gem
|
141
141
|
#
|
data/alf.noespec
CHANGED
@@ -16,7 +16,7 @@ variables:
|
|
16
16
|
upper:
|
17
17
|
Alf
|
18
18
|
version:
|
19
|
-
0.10.
|
19
|
+
0.10.1
|
20
20
|
summary: |-
|
21
21
|
Relational Algebra at your fingertips
|
22
22
|
description: |-
|
@@ -33,12 +33,13 @@ variables:
|
|
33
33
|
- http://rubygems.org/gems/alf
|
34
34
|
- http://rubydoc.info/gems/alf
|
35
35
|
dependencies:
|
36
|
-
- {name: quickl, version: "~> 0.4.
|
37
|
-
- {name: myrrha, version: "~> 1.2.
|
36
|
+
- {name: quickl, version: "~> 0.4.1", groups: [runtime ]}
|
37
|
+
- {name: myrrha, version: "~> 1.2.1", groups: [runtime ]}
|
38
|
+
- {name: highline, version: "~> 1.6.2", groups: [runtime ]}
|
38
39
|
- {name: rake, version: "~> 0.9.2", groups: [test, release]}
|
39
40
|
- {name: rspec, version: "~> 2.6.0", groups: [test, release]}
|
40
41
|
- {name: wlang, version: "~> 0.10.2", groups: [release ]}
|
41
|
-
|
42
|
+
#- {name: rcov, version: "~> 0.9.9", groups: [doc ]}
|
42
43
|
- {name: yard, version: "~> 0.7.2", groups: [doc ]}
|
43
44
|
- {name: bluecloth, version: "~> 2.1.0", groups: [doc ]}
|
44
45
|
- {name: redcarpet, version: "~> 1.17.2", groups: [doc ]}
|
data/doc/commands/show.md
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Relational heading (print the relation type)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator simply outputs a relation containing one tuple: the heading of
|
11
|
+
its operand.
|
12
|
+
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# What is the heading of the `suppliers` relation?
|
16
|
+
!(alf heading suppliers)
|
17
|
+
|
18
|
+
# What is the heading of the following join?
|
19
|
+
!(alf join suppliers supplies | alf heading)
|
20
|
+
|
@@ -9,9 +9,10 @@ DESCRIPTION
|
|
9
9
|
|
10
10
|
This operator computes the (natural) join of its operands.
|
11
11
|
|
12
|
-
Natural join means that, unlike what is commonly used in SQL,
|
13
|
-
|
14
|
-
|
12
|
+
Natural join means that, unlike what is commonly used in SQL, joining is based
|
13
|
+
on equality of all attributes that are shared between LEFT and RIGHT performed
|
14
|
+
on common attribute names. You can use the `rename` operator if this behavior
|
15
|
+
does not fit your needs.
|
15
16
|
|
16
17
|
When operands have no attribute in common, this operator naturally "degenerates"
|
17
18
|
to a cartesian product.
|
@@ -7,12 +7,16 @@ SYNOPSIS
|
|
7
7
|
|
8
8
|
DESCRIPTION
|
9
9
|
|
10
|
-
This operator restricts its LEFT operand to tuples for which there exists
|
11
|
-
|
12
|
-
|
10
|
+
This operator restricts its LEFT operand to tuples for which there exists at
|
11
|
+
least one tuple in RIGHT that (naturally) joins. This is a shortcut operator
|
12
|
+
for the following longer expression:
|
13
13
|
|
14
14
|
(project (join xxx, yyy), [xxx's attributes])
|
15
15
|
|
16
|
+
Or equivalently,
|
17
|
+
|
18
|
+
(join xxx, (project xxx, [common attributes]))
|
19
|
+
|
16
20
|
EXAMPLE
|
17
21
|
|
18
22
|
# Which suppliers supply at least one part?
|
@@ -7,8 +7,8 @@ SYNOPSIS
|
|
7
7
|
|
8
8
|
DESCRIPTION
|
9
9
|
|
10
|
-
This command restricts
|
11
|
-
true.
|
10
|
+
This command restricts restricts relations to those tuples for which PREDICATE
|
11
|
+
evaluates to true.
|
12
12
|
|
13
13
|
PREDICATE must be a valid tuple expression that returns a truth-value. It
|
14
14
|
may be specified as a ruby code literal, or a mapping between (name, value)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'alf'
|
3
|
+
require 'benchmark'
|
4
|
+
|
5
|
+
#rel = Alf.lispy('.').compile{ environment.dataset("hitradio.log") }
|
6
|
+
#keys = nil
|
7
|
+
#rel.each do |tuple|
|
8
|
+
# unless keys
|
9
|
+
# keys = tuple.keys
|
10
|
+
# puts Alf::Tools.to_ruby_literal(keys)
|
11
|
+
# end
|
12
|
+
# values = keys.collect{|k| tuple[k]}
|
13
|
+
# puts Alf::Tools.to_ruby_literal(values)
|
14
|
+
#end
|
15
|
+
|
16
|
+
m = Benchmark.measure do
|
17
|
+
keys = nil
|
18
|
+
File.open("hitradio.mar").each_line do |line|
|
19
|
+
eval(line)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
puts "hitradio.mar: #{m}"
|
23
|
+
|
24
|
+
m = Benchmark.measure do
|
25
|
+
rel = Alf.lispy('.').compile{ environment.dataset("hitradio.log") }
|
26
|
+
rel.each do |tuple|
|
27
|
+
end
|
28
|
+
end
|
29
|
+
puts "hitradio.log: #{m}"
|
30
|
+
|
31
|
+
m = Benchmark.measure do
|
32
|
+
rel = Alf.lispy('.').compile{ environment.dataset("hitradio.rash") }
|
33
|
+
rel.each do |tuple|
|
34
|
+
end
|
35
|
+
end
|
36
|
+
puts "hitradio.rash: #{m}"
|
37
|
+
|
38
|
+
require 'zlib'
|
39
|
+
m = Benchmark.measure do
|
40
|
+
File.open("hitradio.mar.gz", "r") do |io|
|
41
|
+
reader = Zlib::GzipReader.new(io)
|
42
|
+
reader.each_line do |line|
|
43
|
+
eval(line)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
puts "hitradio.mar.gz: #{m}"
|
48
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'alf'
|
3
|
+
require File.expand_path('../mar_reader', __FILE__)
|
4
|
+
require File.expand_path('../gz_reader', __FILE__)
|
5
|
+
require 'benchmark'
|
6
|
+
|
7
|
+
def which_ruby
|
8
|
+
if Object.const_defined?(:RUBY_DESCRIPTION)
|
9
|
+
RUBY_DESCRIPTION =~ /^([^\s]+\s*[^\s]+)/
|
10
|
+
$1
|
11
|
+
else
|
12
|
+
"ruby #{RUBY_VERSION} (#{RUBY_PLATFORM})"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
log = Alf::Environment.folder('.').dataset("hitradio.log")
|
18
|
+
rash = Alf::Environment.folder('.').dataset("hitradio.rash")
|
19
|
+
mar = Alf::Environment.folder('.').dataset("hitradio.mar")
|
20
|
+
gz = Alf::Environment.folder('.').dataset("hitradio.mar.gz")
|
21
|
+
|
22
|
+
puts which_ruby
|
23
|
+
Benchmark.bm do |bench|
|
24
|
+
bench.report('.log'){ log.each{} }
|
25
|
+
bench.report('.rash'){ rash.each{} }
|
26
|
+
bench.report('.mar'){ mar.each{} }
|
27
|
+
bench.report('.gz'){ gz.each{} }
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'alf'
|
2
|
+
require 'zlib'
|
3
|
+
class GzReader < Alf::Reader
|
4
|
+
|
5
|
+
def each
|
6
|
+
keys = nil
|
7
|
+
with_input_io do |io|
|
8
|
+
reader = Zlib::GzipReader.new(io)
|
9
|
+
reader.each_line do |line|
|
10
|
+
decoded = eval(line)
|
11
|
+
if keys.nil?
|
12
|
+
keys = decoded
|
13
|
+
else
|
14
|
+
yield Hash[keys.zip(decoded)]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Alf::Reader.register(:gz, [".gz"], self)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
(restrict (rank (summarize "hitradio.log", [:path], :weight => sum{ bytes_sent }), [[:weight, :desc]], :podium), lambda{ podium < 10 })
|