Sunday, September 9, 2007

Parallel OLAP Cube Construction

Still tilting at windmills here, with my quest to calculate an OLAP cube still trotting along. Lately I've been using Erlang to see if I can use its concurrent programming abilities to scale the OLAP cube generation. The initial progress is promising, with clear concurrency complete.

I hope to post the majority of the code soon, after I run a few more tests. For now, here's how I add two lists of numbers in Erlang. Please let me know if there's a better way.

Update:

The best way to do this is (thanks to Daniel Larsson):

lists:zipwith(fun(X,Y) -> X+Y end, [1,2],[3,4])

Old 'n busted way:

add_measures(OldMeasures, NewMeasures) ->
add_measures(OldMeasures, NewMeasures, []).

add_measures([Old|OldRest], [New|NewRest], Accum) ->
add_measures(OldRest, NewRest, [Old+New|Accum]);

add_measures([], [], Accum) -> lists:reverse(Accum).

0 comments: