13

Like many these days, I am an old relational-model user approaching Cassandra for the first time. I have been trying to understand Cassandra's data model, and when I read about it I frequently encounter statements that encourage me to think about it as 4 and 5 dimensional maps.

Now I'm familiar with an ordinary key/value Map, but I have never thought of how many dimensions it has, and that gives me no basis to plunge headlong into trying to visualize 4 and 5 dimensions.

Is there a more gentle introduction to dimensionality in maps? How many dimensions are there in an ordinary hashtable? One? Two? Zero?

If an ordinary hashtable has, say, just one dimension, then what would a two-dimensional map be? If two, then what would a 3-dimensional map be?

pohl
  • 3,158
  • 1
  • 30
  • 48

2 Answers2

20
Map<String, String>                           -- One dimension
Map<String, Map<String, String>>              -- Two dimensions
Map<String, Map<String, Map<String,String>>>  -- Three dimensions

etc...

Schildmeijer
  • 20,702
  • 12
  • 62
  • 79
  • 7
    In retrospect, the concept is the same as dimensionality in arrays: a two-dimensional array is an array-of-arrays, a two-dimensional map is a map-of-maps, etc. I'm not sure why this didn't occur to me earlier. – pohl Apr 19 '11 at 22:16
  • It seems that the existence of Column Family could be described more precisely as: Map> >, i.e. Column Family is a list of map. Am I right? – realjin May 09 '12 at 02:41
3

Encouraging you to think of it as 4 or 5 dimensional maps is one of the best signs that the author of what you're reading doesn't know what he's talking about.

Read the Max Grinev posts linked at the top of http://wiki.apache.org/cassandra/ArticlesAndPresentations instead.

jbellis
  • 19,347
  • 2
  • 38
  • 47