activewarehouse 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/README +27 -14
  2. data/Rakefile +16 -5
  3. data/doc/references.txt +4 -0
  4. data/generators/bridge/templates/migration.rb +9 -2
  5. data/generators/bridge/templates/unit_test.rb +8 -0
  6. data/generators/date_dimension/USAGE +1 -0
  7. data/generators/date_dimension/date_dimension_generator.rb +16 -0
  8. data/generators/date_dimension/templates/fixture.yml +5 -0
  9. data/generators/date_dimension/templates/migration.rb +31 -0
  10. data/generators/date_dimension/templates/model.rb +3 -0
  11. data/generators/date_dimension/templates/unit_test.rb +8 -0
  12. data/generators/dimension/templates/migration.rb +1 -10
  13. data/generators/dimension_view/dimension_view_generator.rb +2 -2
  14. data/generators/dimension_view/templates/migration.rb +8 -2
  15. data/generators/fact/templates/migration.rb +2 -0
  16. data/generators/time_dimension/USAGE +1 -0
  17. data/generators/time_dimension/templates/fixture.yml +5 -0
  18. data/generators/time_dimension/templates/migration.rb +12 -0
  19. data/generators/time_dimension/templates/model.rb +3 -0
  20. data/generators/time_dimension/templates/unit_test.rb +8 -0
  21. data/generators/time_dimension/time_dimension_generator.rb +14 -0
  22. data/lib/active_warehouse.rb +13 -2
  23. data/lib/active_warehouse/aggregate.rb +54 -253
  24. data/lib/active_warehouse/aggregate/dwarf/node.rb +36 -0
  25. data/lib/active_warehouse/aggregate/dwarf_aggregate.rb +369 -0
  26. data/lib/active_warehouse/aggregate/dwarf_common.rb +44 -0
  27. data/lib/active_warehouse/aggregate/dwarf_printer.rb +34 -0
  28. data/lib/active_warehouse/aggregate/no_aggregate.rb +194 -0
  29. data/lib/active_warehouse/aggregate/pid_aggregate.rb +29 -0
  30. data/lib/active_warehouse/aggregate/pipelined_rolap_aggregate.rb +129 -0
  31. data/lib/active_warehouse/aggregate/rolap_aggregate.rb +181 -0
  32. data/lib/active_warehouse/aggregate/rolap_common.rb +89 -0
  33. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_1.sql +12 -0
  34. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_10.sql +7166 -0
  35. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_11.sql +14334 -0
  36. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_12.sql +28670 -0
  37. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_13.sql +57342 -0
  38. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_2.sql +26 -0
  39. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_3.sql +54 -0
  40. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_4.sql +110 -0
  41. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_5.sql +222 -0
  42. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_6.sql +446 -0
  43. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_7.sql +894 -0
  44. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_8.sql +1790 -0
  45. data/lib/active_warehouse/aggregate/templates/pipelined_rollup_9.sql +3582 -0
  46. data/lib/active_warehouse/aggregate_field.rb +49 -0
  47. data/lib/active_warehouse/{dimension/bridge.rb → bridge.rb} +7 -3
  48. data/lib/active_warehouse/bridge/hierarchy_bridge.rb +46 -0
  49. data/lib/active_warehouse/builder.rb +2 -1
  50. data/lib/active_warehouse/builder/date_dimension_builder.rb +5 -2
  51. data/lib/active_warehouse/builder/generator/generator.rb +13 -0
  52. data/lib/active_warehouse/builder/generator/name_generator.rb +20 -0
  53. data/lib/active_warehouse/builder/generator/paragraph_generator.rb +11 -0
  54. data/lib/active_warehouse/builder/random_data_builder.rb +21 -11
  55. data/lib/active_warehouse/builder/test_data_builder.rb +54 -0
  56. data/lib/active_warehouse/calculated_field.rb +27 -0
  57. data/lib/active_warehouse/compat/compat.rb +4 -4
  58. data/lib/active_warehouse/cube.rb +126 -225
  59. data/lib/active_warehouse/cube_query_result.rb +69 -0
  60. data/lib/active_warehouse/dimension.rb +64 -29
  61. data/lib/active_warehouse/dimension/date_dimension.rb +15 -0
  62. data/lib/active_warehouse/dimension/dimension_reflection.rb +21 -0
  63. data/lib/active_warehouse/dimension/dimension_view.rb +17 -2
  64. data/lib/active_warehouse/dimension/hierarchical_dimension.rb +43 -5
  65. data/lib/active_warehouse/dimension/slowly_changing_dimension.rb +22 -12
  66. data/lib/active_warehouse/fact.rb +119 -40
  67. data/lib/active_warehouse/field.rb +74 -0
  68. data/lib/active_warehouse/ordered_hash.rb +34 -0
  69. data/lib/active_warehouse/prejoin_fact.rb +97 -0
  70. data/lib/active_warehouse/report/abstract_report.rb +40 -14
  71. data/lib/active_warehouse/report/chart_report.rb +3 -3
  72. data/lib/active_warehouse/report/table_report.rb +8 -3
  73. data/lib/active_warehouse/version.rb +1 -1
  74. data/lib/active_warehouse/view/report_helper.rb +144 -34
  75. data/tasks/active_warehouse_tasks.rake +28 -10
  76. metadata +107 -30
@@ -0,0 +1,26 @@
1
+ INSERT INTO <%= @rollup_table_name %>_2
2
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>,
3
+ <%= @aggregate_fields_from_flat_table %>
4
+ FROM <%= @flat_table_name %>
5
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null
6
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>
7
+
8
+ INSERT INTO <%= @rollup_table_name %>_1
9
+ SELECT <%= @dimension_0 %>, null,
10
+ <%= @aggregate_fields %>
11
+ FROM <%= @rollup_table_name %>_2
12
+ WHERE <%= @dimension_0 %> is not null
13
+ GROUP BY <%= @dimension_0 %>
14
+
15
+ INSERT INTO <%= @rollup_table_name %>_0
16
+ SELECT null, null,
17
+ <%= @aggregate_fields %>
18
+ FROM <%= @rollup_table_name %>_1
19
+
20
+ INSERT INTO <%= @rollup_table_name %>_1
21
+ SELECT null, <%= @dimension_1 %>,
22
+ <%= @aggregate_fields %>
23
+ FROM <%= @rollup_table_name %>_2
24
+ WHERE <%= @dimension_1 %> is not null
25
+ GROUP BY <%= @dimension_1 %>
26
+
@@ -0,0 +1,54 @@
1
+ INSERT INTO <%= @rollup_table_name %>_3
2
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>,
3
+ <%= @aggregate_fields_from_flat_table %>
4
+ FROM <%= @flat_table_name %>
5
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
6
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>
7
+
8
+ INSERT INTO <%= @rollup_table_name %>_2
9
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null,
10
+ <%= @aggregate_fields %>
11
+ FROM <%= @rollup_table_name %>_3
12
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null
13
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>
14
+
15
+ INSERT INTO <%= @rollup_table_name %>_1
16
+ SELECT <%= @dimension_0 %>, null, null,
17
+ <%= @aggregate_fields %>
18
+ FROM <%= @rollup_table_name %>_2
19
+ WHERE <%= @dimension_0 %> is not null
20
+ GROUP BY <%= @dimension_0 %>
21
+
22
+ INSERT INTO <%= @rollup_table_name %>_0
23
+ SELECT null, null, null,
24
+ <%= @aggregate_fields %>
25
+ FROM <%= @rollup_table_name %>_1
26
+
27
+ INSERT INTO <%= @rollup_table_name %>_1
28
+ SELECT null, <%= @dimension_1 %>, null,
29
+ <%= @aggregate_fields %>
30
+ FROM <%= @rollup_table_name %>_2
31
+ WHERE <%= @dimension_1 %> is not null
32
+ GROUP BY <%= @dimension_1 %>
33
+
34
+ INSERT INTO <%= @rollup_table_name %>_2
35
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>,
36
+ <%= @aggregate_fields %>
37
+ FROM <%= @rollup_table_name %>_3
38
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null
39
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>
40
+
41
+ INSERT INTO <%= @rollup_table_name %>_1
42
+ SELECT null, null, <%= @dimension_2 %>,
43
+ <%= @aggregate_fields %>
44
+ FROM <%= @rollup_table_name %>_2
45
+ WHERE <%= @dimension_2 %> is not null
46
+ GROUP BY <%= @dimension_2 %>
47
+
48
+ INSERT INTO <%= @rollup_table_name %>_2
49
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>,
50
+ <%= @aggregate_fields %>
51
+ FROM <%= @rollup_table_name %>_3
52
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
53
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>
54
+
@@ -0,0 +1,110 @@
1
+ INSERT INTO <%= @rollup_table_name %>_4
2
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>,
3
+ <%= @aggregate_fields_from_flat_table %>
4
+ FROM <%= @flat_table_name %>
5
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
6
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
7
+
8
+ INSERT INTO <%= @rollup_table_name %>_3
9
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null,
10
+ <%= @aggregate_fields %>
11
+ FROM <%= @rollup_table_name %>_4
12
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
13
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>
14
+
15
+ INSERT INTO <%= @rollup_table_name %>_2
16
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null,
17
+ <%= @aggregate_fields %>
18
+ FROM <%= @rollup_table_name %>_3
19
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null
20
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>
21
+
22
+ INSERT INTO <%= @rollup_table_name %>_1
23
+ SELECT <%= @dimension_0 %>, null, null, null,
24
+ <%= @aggregate_fields %>
25
+ FROM <%= @rollup_table_name %>_2
26
+ WHERE <%= @dimension_0 %> is not null
27
+ GROUP BY <%= @dimension_0 %>
28
+
29
+ INSERT INTO <%= @rollup_table_name %>_0
30
+ SELECT null, null, null, null,
31
+ <%= @aggregate_fields %>
32
+ FROM <%= @rollup_table_name %>_1
33
+
34
+ INSERT INTO <%= @rollup_table_name %>_1
35
+ SELECT null, <%= @dimension_1 %>, null, null,
36
+ <%= @aggregate_fields %>
37
+ FROM <%= @rollup_table_name %>_2
38
+ WHERE <%= @dimension_1 %> is not null
39
+ GROUP BY <%= @dimension_1 %>
40
+
41
+ INSERT INTO <%= @rollup_table_name %>_2
42
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null,
43
+ <%= @aggregate_fields %>
44
+ FROM <%= @rollup_table_name %>_3
45
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null
46
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>
47
+
48
+ INSERT INTO <%= @rollup_table_name %>_1
49
+ SELECT null, null, <%= @dimension_2 %>, null,
50
+ <%= @aggregate_fields %>
51
+ FROM <%= @rollup_table_name %>_2
52
+ WHERE <%= @dimension_2 %> is not null
53
+ GROUP BY <%= @dimension_2 %>
54
+
55
+ INSERT INTO <%= @rollup_table_name %>_2
56
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null,
57
+ <%= @aggregate_fields %>
58
+ FROM <%= @rollup_table_name %>_3
59
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
60
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>
61
+
62
+ INSERT INTO <%= @rollup_table_name %>_3
63
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>,
64
+ <%= @aggregate_fields %>
65
+ FROM <%= @rollup_table_name %>_4
66
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null
67
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>
68
+
69
+ INSERT INTO <%= @rollup_table_name %>_2
70
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>,
71
+ <%= @aggregate_fields %>
72
+ FROM <%= @rollup_table_name %>_3
73
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null
74
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>
75
+
76
+ INSERT INTO <%= @rollup_table_name %>_1
77
+ SELECT null, null, null, <%= @dimension_3 %>,
78
+ <%= @aggregate_fields %>
79
+ FROM <%= @rollup_table_name %>_2
80
+ WHERE <%= @dimension_3 %> is not null
81
+ GROUP BY <%= @dimension_3 %>
82
+
83
+ INSERT INTO <%= @rollup_table_name %>_2
84
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>,
85
+ <%= @aggregate_fields %>
86
+ FROM <%= @rollup_table_name %>_3
87
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null
88
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>
89
+
90
+ INSERT INTO <%= @rollup_table_name %>_3
91
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>,
92
+ <%= @aggregate_fields %>
93
+ FROM <%= @rollup_table_name %>_4
94
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
95
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
96
+
97
+ INSERT INTO <%= @rollup_table_name %>_2
98
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>,
99
+ <%= @aggregate_fields %>
100
+ FROM <%= @rollup_table_name %>_3
101
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
102
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>
103
+
104
+ INSERT INTO <%= @rollup_table_name %>_3
105
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>,
106
+ <%= @aggregate_fields %>
107
+ FROM <%= @rollup_table_name %>_4
108
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
109
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
110
+
@@ -0,0 +1,222 @@
1
+ INSERT INTO <%= @rollup_table_name %>_5
2
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>,
3
+ <%= @aggregate_fields_from_flat_table %>
4
+ FROM <%= @flat_table_name %>
5
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
6
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
7
+
8
+ INSERT INTO <%= @rollup_table_name %>_4
9
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, null,
10
+ <%= @aggregate_fields %>
11
+ FROM <%= @rollup_table_name %>_5
12
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
13
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
14
+
15
+ INSERT INTO <%= @rollup_table_name %>_3
16
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null, null,
17
+ <%= @aggregate_fields %>
18
+ FROM <%= @rollup_table_name %>_4
19
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
20
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>
21
+
22
+ INSERT INTO <%= @rollup_table_name %>_2
23
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null, null,
24
+ <%= @aggregate_fields %>
25
+ FROM <%= @rollup_table_name %>_3
26
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null
27
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>
28
+
29
+ INSERT INTO <%= @rollup_table_name %>_1
30
+ SELECT <%= @dimension_0 %>, null, null, null, null,
31
+ <%= @aggregate_fields %>
32
+ FROM <%= @rollup_table_name %>_2
33
+ WHERE <%= @dimension_0 %> is not null
34
+ GROUP BY <%= @dimension_0 %>
35
+
36
+ INSERT INTO <%= @rollup_table_name %>_0
37
+ SELECT null, null, null, null, null,
38
+ <%= @aggregate_fields %>
39
+ FROM <%= @rollup_table_name %>_1
40
+
41
+ INSERT INTO <%= @rollup_table_name %>_1
42
+ SELECT null, <%= @dimension_1 %>, null, null, null,
43
+ <%= @aggregate_fields %>
44
+ FROM <%= @rollup_table_name %>_2
45
+ WHERE <%= @dimension_1 %> is not null
46
+ GROUP BY <%= @dimension_1 %>
47
+
48
+ INSERT INTO <%= @rollup_table_name %>_2
49
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null, null,
50
+ <%= @aggregate_fields %>
51
+ FROM <%= @rollup_table_name %>_3
52
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null
53
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>
54
+
55
+ INSERT INTO <%= @rollup_table_name %>_1
56
+ SELECT null, null, <%= @dimension_2 %>, null, null,
57
+ <%= @aggregate_fields %>
58
+ FROM <%= @rollup_table_name %>_2
59
+ WHERE <%= @dimension_2 %> is not null
60
+ GROUP BY <%= @dimension_2 %>
61
+
62
+ INSERT INTO <%= @rollup_table_name %>_2
63
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null, null,
64
+ <%= @aggregate_fields %>
65
+ FROM <%= @rollup_table_name %>_3
66
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
67
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>
68
+
69
+ INSERT INTO <%= @rollup_table_name %>_3
70
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>, null,
71
+ <%= @aggregate_fields %>
72
+ FROM <%= @rollup_table_name %>_4
73
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null
74
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>
75
+
76
+ INSERT INTO <%= @rollup_table_name %>_2
77
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>, null,
78
+ <%= @aggregate_fields %>
79
+ FROM <%= @rollup_table_name %>_3
80
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null
81
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>
82
+
83
+ INSERT INTO <%= @rollup_table_name %>_1
84
+ SELECT null, null, null, <%= @dimension_3 %>, null,
85
+ <%= @aggregate_fields %>
86
+ FROM <%= @rollup_table_name %>_2
87
+ WHERE <%= @dimension_3 %> is not null
88
+ GROUP BY <%= @dimension_3 %>
89
+
90
+ INSERT INTO <%= @rollup_table_name %>_2
91
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>, null,
92
+ <%= @aggregate_fields %>
93
+ FROM <%= @rollup_table_name %>_3
94
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null
95
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>
96
+
97
+ INSERT INTO <%= @rollup_table_name %>_3
98
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>, null,
99
+ <%= @aggregate_fields %>
100
+ FROM <%= @rollup_table_name %>_4
101
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
102
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
103
+
104
+ INSERT INTO <%= @rollup_table_name %>_2
105
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>, null,
106
+ <%= @aggregate_fields %>
107
+ FROM <%= @rollup_table_name %>_3
108
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
109
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>
110
+
111
+ INSERT INTO <%= @rollup_table_name %>_3
112
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, null,
113
+ <%= @aggregate_fields %>
114
+ FROM <%= @rollup_table_name %>_4
115
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
116
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
117
+
118
+ INSERT INTO <%= @rollup_table_name %>_4
119
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null, <%= @dimension_4 %>,
120
+ <%= @aggregate_fields %>
121
+ FROM <%= @rollup_table_name %>_5
122
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
123
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_4 %>
124
+
125
+ INSERT INTO <%= @rollup_table_name %>_3
126
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null, <%= @dimension_4 %>,
127
+ <%= @aggregate_fields %>
128
+ FROM <%= @rollup_table_name %>_4
129
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_4 %> is not null
130
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_4 %>
131
+
132
+ INSERT INTO <%= @rollup_table_name %>_2
133
+ SELECT <%= @dimension_0 %>, null, null, null, <%= @dimension_4 %>,
134
+ <%= @aggregate_fields %>
135
+ FROM <%= @rollup_table_name %>_3
136
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_4 %> is not null
137
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_4 %>
138
+
139
+ INSERT INTO <%= @rollup_table_name %>_1
140
+ SELECT null, null, null, null, <%= @dimension_4 %>,
141
+ <%= @aggregate_fields %>
142
+ FROM <%= @rollup_table_name %>_2
143
+ WHERE <%= @dimension_4 %> is not null
144
+ GROUP BY <%= @dimension_4 %>
145
+
146
+ INSERT INTO <%= @rollup_table_name %>_2
147
+ SELECT null, <%= @dimension_1 %>, null, null, <%= @dimension_4 %>,
148
+ <%= @aggregate_fields %>
149
+ FROM <%= @rollup_table_name %>_3
150
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_4 %> is not null
151
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_4 %>
152
+
153
+ INSERT INTO <%= @rollup_table_name %>_3
154
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null, <%= @dimension_4 %>,
155
+ <%= @aggregate_fields %>
156
+ FROM <%= @rollup_table_name %>_4
157
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
158
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_4 %>
159
+
160
+ INSERT INTO <%= @rollup_table_name %>_2
161
+ SELECT null, null, <%= @dimension_2 %>, null, <%= @dimension_4 %>,
162
+ <%= @aggregate_fields %>
163
+ FROM <%= @rollup_table_name %>_3
164
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
165
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_4 %>
166
+
167
+ INSERT INTO <%= @rollup_table_name %>_3
168
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null, <%= @dimension_4 %>,
169
+ <%= @aggregate_fields %>
170
+ FROM <%= @rollup_table_name %>_4
171
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
172
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_4 %>
173
+
174
+ INSERT INTO <%= @rollup_table_name %>_4
175
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>, <%= @dimension_4 %>,
176
+ <%= @aggregate_fields %>
177
+ FROM <%= @rollup_table_name %>_5
178
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
179
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
180
+
181
+ INSERT INTO <%= @rollup_table_name %>_3
182
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>, <%= @dimension_4 %>,
183
+ <%= @aggregate_fields %>
184
+ FROM <%= @rollup_table_name %>_4
185
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
186
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
187
+
188
+ INSERT INTO <%= @rollup_table_name %>_2
189
+ SELECT null, null, null, <%= @dimension_3 %>, <%= @dimension_4 %>,
190
+ <%= @aggregate_fields %>
191
+ FROM <%= @rollup_table_name %>_3
192
+ WHERE <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
193
+ GROUP BY <%= @dimension_3 %>, <%= @dimension_4 %>
194
+
195
+ INSERT INTO <%= @rollup_table_name %>_3
196
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>, <%= @dimension_4 %>,
197
+ <%= @aggregate_fields %>
198
+ FROM <%= @rollup_table_name %>_4
199
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
200
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
201
+
202
+ INSERT INTO <%= @rollup_table_name %>_4
203
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>,
204
+ <%= @aggregate_fields %>
205
+ FROM <%= @rollup_table_name %>_5
206
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
207
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
208
+
209
+ INSERT INTO <%= @rollup_table_name %>_3
210
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>,
211
+ <%= @aggregate_fields %>
212
+ FROM <%= @rollup_table_name %>_4
213
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
214
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
215
+
216
+ INSERT INTO <%= @rollup_table_name %>_4
217
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>,
218
+ <%= @aggregate_fields %>
219
+ FROM <%= @rollup_table_name %>_5
220
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
221
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
222
+
@@ -0,0 +1,446 @@
1
+ INSERT INTO <%= @rollup_table_name %>_6
2
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
3
+ <%= @aggregate_fields_from_flat_table %>
4
+ FROM <%= @flat_table_name %>
5
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
6
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
7
+
8
+ INSERT INTO <%= @rollup_table_name %>_5
9
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
10
+ <%= @aggregate_fields %>
11
+ FROM <%= @rollup_table_name %>_6
12
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
13
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
14
+
15
+ INSERT INTO <%= @rollup_table_name %>_4
16
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, null, null,
17
+ <%= @aggregate_fields %>
18
+ FROM <%= @rollup_table_name %>_5
19
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
20
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
21
+
22
+ INSERT INTO <%= @rollup_table_name %>_3
23
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null, null, null,
24
+ <%= @aggregate_fields %>
25
+ FROM <%= @rollup_table_name %>_4
26
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
27
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>
28
+
29
+ INSERT INTO <%= @rollup_table_name %>_2
30
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null, null, null,
31
+ <%= @aggregate_fields %>
32
+ FROM <%= @rollup_table_name %>_3
33
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null
34
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>
35
+
36
+ INSERT INTO <%= @rollup_table_name %>_1
37
+ SELECT <%= @dimension_0 %>, null, null, null, null, null,
38
+ <%= @aggregate_fields %>
39
+ FROM <%= @rollup_table_name %>_2
40
+ WHERE <%= @dimension_0 %> is not null
41
+ GROUP BY <%= @dimension_0 %>
42
+
43
+ INSERT INTO <%= @rollup_table_name %>_0
44
+ SELECT null, null, null, null, null, null,
45
+ <%= @aggregate_fields %>
46
+ FROM <%= @rollup_table_name %>_1
47
+
48
+ INSERT INTO <%= @rollup_table_name %>_1
49
+ SELECT null, <%= @dimension_1 %>, null, null, null, null,
50
+ <%= @aggregate_fields %>
51
+ FROM <%= @rollup_table_name %>_2
52
+ WHERE <%= @dimension_1 %> is not null
53
+ GROUP BY <%= @dimension_1 %>
54
+
55
+ INSERT INTO <%= @rollup_table_name %>_2
56
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null, null, null,
57
+ <%= @aggregate_fields %>
58
+ FROM <%= @rollup_table_name %>_3
59
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null
60
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>
61
+
62
+ INSERT INTO <%= @rollup_table_name %>_1
63
+ SELECT null, null, <%= @dimension_2 %>, null, null, null,
64
+ <%= @aggregate_fields %>
65
+ FROM <%= @rollup_table_name %>_2
66
+ WHERE <%= @dimension_2 %> is not null
67
+ GROUP BY <%= @dimension_2 %>
68
+
69
+ INSERT INTO <%= @rollup_table_name %>_2
70
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null, null, null,
71
+ <%= @aggregate_fields %>
72
+ FROM <%= @rollup_table_name %>_3
73
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null
74
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>
75
+
76
+ INSERT INTO <%= @rollup_table_name %>_3
77
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>, null, null,
78
+ <%= @aggregate_fields %>
79
+ FROM <%= @rollup_table_name %>_4
80
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null
81
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>
82
+
83
+ INSERT INTO <%= @rollup_table_name %>_2
84
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>, null, null,
85
+ <%= @aggregate_fields %>
86
+ FROM <%= @rollup_table_name %>_3
87
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null
88
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>
89
+
90
+ INSERT INTO <%= @rollup_table_name %>_1
91
+ SELECT null, null, null, <%= @dimension_3 %>, null, null,
92
+ <%= @aggregate_fields %>
93
+ FROM <%= @rollup_table_name %>_2
94
+ WHERE <%= @dimension_3 %> is not null
95
+ GROUP BY <%= @dimension_3 %>
96
+
97
+ INSERT INTO <%= @rollup_table_name %>_2
98
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>, null, null,
99
+ <%= @aggregate_fields %>
100
+ FROM <%= @rollup_table_name %>_3
101
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null
102
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>
103
+
104
+ INSERT INTO <%= @rollup_table_name %>_3
105
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>, null, null,
106
+ <%= @aggregate_fields %>
107
+ FROM <%= @rollup_table_name %>_4
108
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
109
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
110
+
111
+ INSERT INTO <%= @rollup_table_name %>_2
112
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>, null, null,
113
+ <%= @aggregate_fields %>
114
+ FROM <%= @rollup_table_name %>_3
115
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
116
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>
117
+
118
+ INSERT INTO <%= @rollup_table_name %>_3
119
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, null, null,
120
+ <%= @aggregate_fields %>
121
+ FROM <%= @rollup_table_name %>_4
122
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null
123
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>
124
+
125
+ INSERT INTO <%= @rollup_table_name %>_4
126
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null, <%= @dimension_4 %>, null,
127
+ <%= @aggregate_fields %>
128
+ FROM <%= @rollup_table_name %>_5
129
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
130
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_4 %>
131
+
132
+ INSERT INTO <%= @rollup_table_name %>_3
133
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null, <%= @dimension_4 %>, null,
134
+ <%= @aggregate_fields %>
135
+ FROM <%= @rollup_table_name %>_4
136
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_4 %> is not null
137
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_4 %>
138
+
139
+ INSERT INTO <%= @rollup_table_name %>_2
140
+ SELECT <%= @dimension_0 %>, null, null, null, <%= @dimension_4 %>, null,
141
+ <%= @aggregate_fields %>
142
+ FROM <%= @rollup_table_name %>_3
143
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_4 %> is not null
144
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_4 %>
145
+
146
+ INSERT INTO <%= @rollup_table_name %>_1
147
+ SELECT null, null, null, null, <%= @dimension_4 %>, null,
148
+ <%= @aggregate_fields %>
149
+ FROM <%= @rollup_table_name %>_2
150
+ WHERE <%= @dimension_4 %> is not null
151
+ GROUP BY <%= @dimension_4 %>
152
+
153
+ INSERT INTO <%= @rollup_table_name %>_2
154
+ SELECT null, <%= @dimension_1 %>, null, null, <%= @dimension_4 %>, null,
155
+ <%= @aggregate_fields %>
156
+ FROM <%= @rollup_table_name %>_3
157
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_4 %> is not null
158
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_4 %>
159
+
160
+ INSERT INTO <%= @rollup_table_name %>_3
161
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null, <%= @dimension_4 %>, null,
162
+ <%= @aggregate_fields %>
163
+ FROM <%= @rollup_table_name %>_4
164
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
165
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_4 %>
166
+
167
+ INSERT INTO <%= @rollup_table_name %>_2
168
+ SELECT null, null, <%= @dimension_2 %>, null, <%= @dimension_4 %>, null,
169
+ <%= @aggregate_fields %>
170
+ FROM <%= @rollup_table_name %>_3
171
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
172
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_4 %>
173
+
174
+ INSERT INTO <%= @rollup_table_name %>_3
175
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null, <%= @dimension_4 %>, null,
176
+ <%= @aggregate_fields %>
177
+ FROM <%= @rollup_table_name %>_4
178
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null
179
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_4 %>
180
+
181
+ INSERT INTO <%= @rollup_table_name %>_4
182
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
183
+ <%= @aggregate_fields %>
184
+ FROM <%= @rollup_table_name %>_5
185
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
186
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
187
+
188
+ INSERT INTO <%= @rollup_table_name %>_3
189
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
190
+ <%= @aggregate_fields %>
191
+ FROM <%= @rollup_table_name %>_4
192
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
193
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
194
+
195
+ INSERT INTO <%= @rollup_table_name %>_2
196
+ SELECT null, null, null, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
197
+ <%= @aggregate_fields %>
198
+ FROM <%= @rollup_table_name %>_3
199
+ WHERE <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
200
+ GROUP BY <%= @dimension_3 %>, <%= @dimension_4 %>
201
+
202
+ INSERT INTO <%= @rollup_table_name %>_3
203
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
204
+ <%= @aggregate_fields %>
205
+ FROM <%= @rollup_table_name %>_4
206
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
207
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
208
+
209
+ INSERT INTO <%= @rollup_table_name %>_4
210
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
211
+ <%= @aggregate_fields %>
212
+ FROM <%= @rollup_table_name %>_5
213
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
214
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
215
+
216
+ INSERT INTO <%= @rollup_table_name %>_3
217
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
218
+ <%= @aggregate_fields %>
219
+ FROM <%= @rollup_table_name %>_4
220
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
221
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
222
+
223
+ INSERT INTO <%= @rollup_table_name %>_4
224
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, null,
225
+ <%= @aggregate_fields %>
226
+ FROM <%= @rollup_table_name %>_5
227
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null
228
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>
229
+
230
+ INSERT INTO <%= @rollup_table_name %>_5
231
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
232
+ <%= @aggregate_fields %>
233
+ FROM <%= @rollup_table_name %>_6
234
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
235
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
236
+
237
+ INSERT INTO <%= @rollup_table_name %>_4
238
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null, null, <%= @dimension_5 %>,
239
+ <%= @aggregate_fields %>
240
+ FROM <%= @rollup_table_name %>_5
241
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_5 %> is not null
242
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_5 %>
243
+
244
+ INSERT INTO <%= @rollup_table_name %>_3
245
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null, null, <%= @dimension_5 %>,
246
+ <%= @aggregate_fields %>
247
+ FROM <%= @rollup_table_name %>_4
248
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_5 %> is not null
249
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_5 %>
250
+
251
+ INSERT INTO <%= @rollup_table_name %>_2
252
+ SELECT <%= @dimension_0 %>, null, null, null, null, <%= @dimension_5 %>,
253
+ <%= @aggregate_fields %>
254
+ FROM <%= @rollup_table_name %>_3
255
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_5 %> is not null
256
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_5 %>
257
+
258
+ INSERT INTO <%= @rollup_table_name %>_1
259
+ SELECT null, null, null, null, null, <%= @dimension_5 %>,
260
+ <%= @aggregate_fields %>
261
+ FROM <%= @rollup_table_name %>_2
262
+ WHERE <%= @dimension_5 %> is not null
263
+ GROUP BY <%= @dimension_5 %>
264
+
265
+ INSERT INTO <%= @rollup_table_name %>_2
266
+ SELECT null, <%= @dimension_1 %>, null, null, null, <%= @dimension_5 %>,
267
+ <%= @aggregate_fields %>
268
+ FROM <%= @rollup_table_name %>_3
269
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_5 %> is not null
270
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_5 %>
271
+
272
+ INSERT INTO <%= @rollup_table_name %>_3
273
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null, null, <%= @dimension_5 %>,
274
+ <%= @aggregate_fields %>
275
+ FROM <%= @rollup_table_name %>_4
276
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_5 %> is not null
277
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_5 %>
278
+
279
+ INSERT INTO <%= @rollup_table_name %>_2
280
+ SELECT null, null, <%= @dimension_2 %>, null, null, <%= @dimension_5 %>,
281
+ <%= @aggregate_fields %>
282
+ FROM <%= @rollup_table_name %>_3
283
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_5 %> is not null
284
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_5 %>
285
+
286
+ INSERT INTO <%= @rollup_table_name %>_3
287
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null, null, <%= @dimension_5 %>,
288
+ <%= @aggregate_fields %>
289
+ FROM <%= @rollup_table_name %>_4
290
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_5 %> is not null
291
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_5 %>
292
+
293
+ INSERT INTO <%= @rollup_table_name %>_4
294
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
295
+ <%= @aggregate_fields %>
296
+ FROM <%= @rollup_table_name %>_5
297
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
298
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
299
+
300
+ INSERT INTO <%= @rollup_table_name %>_3
301
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
302
+ <%= @aggregate_fields %>
303
+ FROM <%= @rollup_table_name %>_4
304
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
305
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
306
+
307
+ INSERT INTO <%= @rollup_table_name %>_2
308
+ SELECT null, null, null, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
309
+ <%= @aggregate_fields %>
310
+ FROM <%= @rollup_table_name %>_3
311
+ WHERE <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
312
+ GROUP BY <%= @dimension_3 %>, <%= @dimension_5 %>
313
+
314
+ INSERT INTO <%= @rollup_table_name %>_3
315
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
316
+ <%= @aggregate_fields %>
317
+ FROM <%= @rollup_table_name %>_4
318
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
319
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
320
+
321
+ INSERT INTO <%= @rollup_table_name %>_4
322
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
323
+ <%= @aggregate_fields %>
324
+ FROM <%= @rollup_table_name %>_5
325
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
326
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
327
+
328
+ INSERT INTO <%= @rollup_table_name %>_3
329
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
330
+ <%= @aggregate_fields %>
331
+ FROM <%= @rollup_table_name %>_4
332
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
333
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
334
+
335
+ INSERT INTO <%= @rollup_table_name %>_4
336
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, null, <%= @dimension_5 %>,
337
+ <%= @aggregate_fields %>
338
+ FROM <%= @rollup_table_name %>_5
339
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_5 %> is not null
340
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_5 %>
341
+
342
+ INSERT INTO <%= @rollup_table_name %>_5
343
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
344
+ <%= @aggregate_fields %>
345
+ FROM <%= @rollup_table_name %>_6
346
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
347
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
348
+
349
+ INSERT INTO <%= @rollup_table_name %>_4
350
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
351
+ <%= @aggregate_fields %>
352
+ FROM <%= @rollup_table_name %>_5
353
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
354
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
355
+
356
+ INSERT INTO <%= @rollup_table_name %>_3
357
+ SELECT <%= @dimension_0 %>, null, null, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
358
+ <%= @aggregate_fields %>
359
+ FROM <%= @rollup_table_name %>_4
360
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
361
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
362
+
363
+ INSERT INTO <%= @rollup_table_name %>_2
364
+ SELECT null, null, null, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
365
+ <%= @aggregate_fields %>
366
+ FROM <%= @rollup_table_name %>_3
367
+ WHERE <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
368
+ GROUP BY <%= @dimension_4 %>, <%= @dimension_5 %>
369
+
370
+ INSERT INTO <%= @rollup_table_name %>_3
371
+ SELECT null, <%= @dimension_1 %>, null, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
372
+ <%= @aggregate_fields %>
373
+ FROM <%= @rollup_table_name %>_4
374
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
375
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
376
+
377
+ INSERT INTO <%= @rollup_table_name %>_4
378
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
379
+ <%= @aggregate_fields %>
380
+ FROM <%= @rollup_table_name %>_5
381
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
382
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
383
+
384
+ INSERT INTO <%= @rollup_table_name %>_3
385
+ SELECT null, null, <%= @dimension_2 %>, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
386
+ <%= @aggregate_fields %>
387
+ FROM <%= @rollup_table_name %>_4
388
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
389
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
390
+
391
+ INSERT INTO <%= @rollup_table_name %>_4
392
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, null, <%= @dimension_4 %>, <%= @dimension_5 %>,
393
+ <%= @aggregate_fields %>
394
+ FROM <%= @rollup_table_name %>_5
395
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
396
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
397
+
398
+ INSERT INTO <%= @rollup_table_name %>_5
399
+ SELECT <%= @dimension_0 %>, <%= @dimension_1 %>, null, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
400
+ <%= @aggregate_fields %>
401
+ FROM <%= @rollup_table_name %>_6
402
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
403
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
404
+
405
+ INSERT INTO <%= @rollup_table_name %>_4
406
+ SELECT <%= @dimension_0 %>, null, null, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
407
+ <%= @aggregate_fields %>
408
+ FROM <%= @rollup_table_name %>_5
409
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
410
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
411
+
412
+ INSERT INTO <%= @rollup_table_name %>_3
413
+ SELECT null, null, null, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
414
+ <%= @aggregate_fields %>
415
+ FROM <%= @rollup_table_name %>_4
416
+ WHERE <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
417
+ GROUP BY <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
418
+
419
+ INSERT INTO <%= @rollup_table_name %>_4
420
+ SELECT null, <%= @dimension_1 %>, null, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
421
+ <%= @aggregate_fields %>
422
+ FROM <%= @rollup_table_name %>_5
423
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
424
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
425
+
426
+ INSERT INTO <%= @rollup_table_name %>_5
427
+ SELECT <%= @dimension_0 %>, null, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
428
+ <%= @aggregate_fields %>
429
+ FROM <%= @rollup_table_name %>_6
430
+ WHERE <%= @dimension_0 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
431
+ GROUP BY <%= @dimension_0 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
432
+
433
+ INSERT INTO <%= @rollup_table_name %>_4
434
+ SELECT null, null, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
435
+ <%= @aggregate_fields %>
436
+ FROM <%= @rollup_table_name %>_5
437
+ WHERE <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
438
+ GROUP BY <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
439
+
440
+ INSERT INTO <%= @rollup_table_name %>_5
441
+ SELECT null, <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>,
442
+ <%= @aggregate_fields %>
443
+ FROM <%= @rollup_table_name %>_6
444
+ WHERE <%= @dimension_1 %> is not null and <%= @dimension_2 %> is not null and <%= @dimension_3 %> is not null and <%= @dimension_4 %> is not null and <%= @dimension_5 %> is not null
445
+ GROUP BY <%= @dimension_1 %>, <%= @dimension_2 %>, <%= @dimension_3 %>, <%= @dimension_4 %>, <%= @dimension_5 %>
446
+