<br>Julian,<br><br>I like the approach you took. It does make more sense to encapsulate the region and region query specs. <br><br>Concerning your Javadoc comment for review for <span style="font-family: courier new,monospace;">get(SpatialRegionRequest regionRequest)</span>, I agree that we should remove it for now. It would be hard to implement and does not provide any functionality we need right now.<br>

<br>As for the <span style="font-family: courier new,monospace;">rollup(Map&lt;SpatialDimension, Object&gt; dimensions)</span>, I think there might be an issue with it. Right now, it would only allow us to lookup one cell at a time. The API we need must be able to lookup all the regions necessary to populate a region &quot;superset&quot;. Maybe I&#39;m not understanding the API right.<br>

<br>Luc<br><br><br><div class="gmail_quote">On Tue, Apr 19, 2011 at 4:39 PM, Julian Hyde <span dir="ltr">&lt;<a href="mailto:jhyde@pentaho.com">jhyde@pentaho.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">







<div link="blue" vlink="purple" lang="EN-US">
<div><span><font size="2" color="#000080" face="Lucida Sans">Luc, Will,</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">I&#39;ve checked in a version that captures the requirements as I 
see them. It includes a method to identify sets of segments (I&#39;ve called them 
SpatialRegions) that can be rolled up.</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span>
<div><span><a href="http://perforce.eigenbase.org:8080/@rev1=head@//open/mondrian/src/main/mondrian/util/SpatialValueTree2.java" target="_blank">http://perforce.eigenbase.org:8080/@rev1=head@//open/mondrian/src/main/mondrian/util/SpatialValueTree2.java</a></span></div>


<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans">I have re-introduced the distinction between &#39;segment 
requests&#39; (called SpatialRegionRequest; for each dimension, the set of values to 
retrieve) and &#39;segments&#39; (called SpatialRegion; the actual set of 
values).</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">For performance, I have made all kinds of constraints, e.g. 
SpatialDimensions are created by the tree itself, have contiguous and unique 
ordinals; values implement Comparable; arrays of values are sorted and unique 
and the client will not modify them. We can add more constraints, if it improves 
performance.</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">Conversely, if there are things in this API that mondrian 
does not need, let&#39;s remove them.</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">There are other general design notes in the javadoc comments 
at the head of the class.</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">Developers,</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">I would like to have this discussion in a public forum, so we 
might as well start now. Briefly, this is what we are trying to 
achieve...</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">The goal is to design a data structure that will allow us to 
manage thousands, possibly millions, of segments containing cell values. 
Currently mondrian stores segments in a linked list for each dimensionality 
(e.g. all segments for (year, month, nation) are in the same list). But that 
won&#39;t be tenable when we (a) have an external cache with many thousands of 
segments, (b) we want to answer a cell request by rolling up coarser granularity 
segment(s). Our design process is to (a) propose an API, (b) write unit tests 
for functionality, performance and thread-safety, (c) write several 
implementations of the API, and may the best one win.</font></span></div>
<div><span><font size="2" color="#000080" face="Lucida Sans"></font></span> </div>
<div><span><font size="2" color="#000080" face="Lucida Sans">Julian</font></span></div><br>
<blockquote style="border-left:#000080 2px solid;padding-left:5px;margin-left:5px;margin-right:0px" dir="ltr">
  <div dir="ltr" align="left" lang="en-us">
  <hr>
  <font size="2" face="Tahoma"><b>From:</b> Luc Boudreau 
  [mailto:<a href="mailto:lboudreau@pentaho.com" target="_blank">lboudreau@pentaho.com</a>] <br><b>Sent:</b> Monday, April 18, 2011 9:05 
  PM<br><b>To:</b> Will Gorman; Julian Hyde<br><b>Subject:</b> Spatial 
  index<br></font><br></div>
  <div></div>
  <div>
  <p class="MsoNormal">As discussed, I’ve sketched a first draft at a proposed 
  spatial index.</p>
  <p class="MsoNormal"> </p>
  <p class="MsoNormal"><a href="http://perforce.eigenbase.org:8080/@rev1=head@/open/mondrian/src/main/mondrian/util/SpatialValueTree.java" target="_blank">http://perforce.eigenbase.org:8080/@rev1=head@//open/mondrian/src/main/mondrian/util/SpatialValueTree.java</a></p>


  <p class="MsoNormal"> </p>
  <p class="MsoNormal">If you could give it a quick read and tell me if there is 
  anything I might have missed or overlooked, I could then start writing a bunch 
  of unit tests.</p>
  <p class="MsoNormal"> </p>
  <p class="MsoNormal">Thanks!</p>
  <p class="MsoNormal"> </p>
  <p class="MsoNormal">Luc</p></div></blockquote></div>
<br>_______________________________________________<br>
Mondrian mailing list<br>
<a href="mailto:Mondrian@pentaho.org">Mondrian@pentaho.org</a><br>
<a href="http://lists.pentaho.org/mailman/listinfo/mondrian" target="_blank">http://lists.pentaho.org/mailman/listinfo/mondrian</a><br>
<br></blockquote></div><br>