<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Dynamic Pipelining of Multidimensional Range Queries?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Amalia Duch</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Daniel Lugosi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Edelmira Pasarella</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Cristina Zoltan</string-name>
          <email>zoltang@cs.upc.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universitat Politecnica de Catalunya</institution>
          ,
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The problem of evaluating orthogonal range queries e ciently has been studied widely in the data structures community. It has been common wisdom for several years that for queries containing more than 20% of the elements of the dataset a linear scanning of the data was the most e cient solution. In recent experimental works using modern hardware{with main memory and parallelism{ the conclusion is that linear scan is preferable for almost every query con guration (even containing a 1% of the data). In this work we propose an alternative approach to evaluate multidimensional range queries based on the dynamic pipeline paradigm {using main memory and concurrency. Our aim is to prove that under this framework, it is possible to beat the performance of linear scanning by the one of hierarchical multidimensional data structures{ such as kd trees, quad trees, R trees or similar.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        ? Work supported by grant GRAMM (TIN2017-86727-C2-1-R) and EU FEDER funds.
queries. However, in practice, the usefulness of this approach heavily relies on the
selectivity and con guration of the sequence of range queries and, unfortunately
common wisdom told that a simple scan beats multidimensional data structures
for queries accessing more than 15%-20% of a data collection [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        Recently, multidimensional range queries as well as the e ciency of
hierarchical multidimensional data structures to support them have been revisited
under a modern hardware perspective [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Moreover, in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] the authors state that
in current machines {using main memory and parallelisation{ data structures
are useless even for very selective range queries an thus, they conclude that in
current machines scanning should be favoured over parallel versions of such data
structures.
      </p>
      <p>
        In this work, we propose a new way to parallelise the multidimensional range
query problem using the dynamic pipeline model [
        <xref ref-type="bibr" rid="ref1 ref3">1, 3</xref>
        ]. Our aim is to prove
that, with our algorithm, the use of hierarchical multidimensional data
structures would be preferable over scanning for range queries containing a sub-linear
number of elements of the collection.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Dynamic Pipeline Algorithms</title>
      <p>
        We propose an algorithm based on a dynamic pipeline [
        <xref ref-type="bibr" rid="ref1 ref3">1, 3</xref>
        ] of processes via
an asynchronous model of computation, synchronised by means of channels. In
general, a dynamic pipeline is a data-driven unidimensional and unidirectional
chain of stages connected by means of data channels. This computational
structure stretches and shrinks depending on the spawning and the lifetime of its
stages. A dynamic pipeline is similar to an ordinary pipeline, except that the
number of stages that it contains is not xed but dynamically generated at
runtime. In fact, it is self-adaptive to the characteristics of a speci c query.
      </p>
      <p>Algorithms under this paradigm must specify four kind of stages: input,
output, generator and lter stages as well as the number and the type of the I/O
unidirectional channels. The input and output stages are the interface of the
pipeline, managing the input and output data respectively. Input data is fed
to the input stage and the output stage will produce results. The generator is
responsible to create the (parameterised) lter stages.</p>
      <p>We now describe two algorithms to solve range queries based on the dynamic
pipeline model: a nave algorithm equivalent to a linear scan of the whole dataset
followed by the algorithm that we propose, based on a preprocessing of the
dataset by means of data structures such as kd trees, quad trees or R trees. We
will describe both algorithms for a single range query since the same process is
applicable to a sequence of queries iterating on the process for a single one.
Nave Algorithm. We start by describing a nave algorithm equivalent to a
concurrent approach of the complete scan of the data set.</p>
      <p>To answer Q using the pipeline approach it is necessary to have a recursive
process that constructs a sequence of lters (processes). Every lter stands for
one of the s unidimensional ranges of Q, let us say j (1 j s), and it discards
from further consideration all the points of the data set that are outside range
(ij ; lj ; uj ), that is, all those points with ij -th coordinate smaller than lj or greater
than uj . Since the query has s ranges, the pipe will end up with s processes acting
concurrently.</p>
      <p>This nave algorithm starts by setting an initial pipeline consisting of 3 stages
{the input, the generator and the output stages, in this sequential order{ and
two channels {the rst carry the sequence of triplets of Q and the second the
sequence of points in F .</p>
      <p>The process starts by feeding (in sequential order) the input stage with the
triplets of Q carried by the rst channel. The con guration of the pipe evolves
(stretches) as follows. The input stage passes the data from the rst channel (a
triplet of the query at a time) to its successor neighbour. At the very beginning
the triplet (i1; l1; u1) is passed from the input stage to the generator stage.
Every time a triplet arrives to the generator a lter stage, standing for this
triplet, is created as the stage immediately previous to the generator stage. So,
at the very beginning, a lter f1 for the rst range of Q is created. The pipeline
consists now of four stages: input, f1, generator and output, in this order. When
triplet (ij ; lij ; uij ) passes through the input stage, it passes also through f1, since
ij 6= i1, it passes through f2, . . . , fj , up to arrive to the generator where lter
fj+1 is created. The process continues until the elements carried by the rst
channel are all treated and the channel is empty. The pipe now, regarding the
initial pipe, has s additional stages, one per each triplet of the query.</p>
      <p>The next step is to treat the data carried by the second channel, the points.
Every point of the data set passes through the pipe. At every lter fi, as we
already mentioned, if the i-th coordinate of the point is outside the range stored
at fi the point is discarded, otherwise it is passed to next stage. Therefore, all
the points that arrive to the output stage should be reported as part of Q.</p>
      <p>This nave algorithm will force to read and check every point in the
original set, having therefore complexity proportional to n, independently of the
con guration of Q.</p>
      <p>
        Proposed Algorithm. To improve the e ciency of the nave algorithm we
propose a preprocessing of the dataset by means of a hierarchical
multidimensional data structure. The data structure can be any of the classical ones [
        <xref ref-type="bibr" rid="ref2 ref4">2,
4</xref>
        ] (such as kd trees, quad trees, R trees, etc.) with the unique requirement
that it divides the domain D of the points into a partition of m k-dimensional
hyperrectagles that are called bounding boxes, where m 1 is the number of
elements in the partition and depends on the kind of tree used and the
number of levels of that tree. Each bounding box BB is de ned by a sequence of
k ranges, this is, BB = (1; l1; u1); : : : ; (k; lk; uk). In our preliminar experiments
we use quad tries [
        <xref ref-type="bibr" rid="ref2 ref4">2, 4</xref>
        ] to preprocess the data points and to end up with a
sequence S = BB1; : : : ; BBm of bounding boxes. It is worth noting that the
dynamic pipeline algorithm works identically with any other multidimensional
data structure that ts the previous requirement.
      </p>
      <p>Now, instead of directly ltering points, the pipe will lter, rst, the sequence
S of bounding boxes produced by the data structure (it will have then 3 channels
instead of two, as before). The bounding boxes will pass through the pipe by
their speci cation and not by the points that they contain. Every lter stage,
checking for the i-th range of the query, will discard from further consideration
all the bounding boxes whose i-th range does not intersect the i-th range of the
query and will pass the intersecting bounding boxes to next stage. Additionally,
the ltering of bounding boxes divides them into two groups: BBC (the group
of bounding boxes which are completely contained into Q) and BBP (the group
of bounding boxes that intersect Q but are not contained in it).</p>
      <p>The algorithm will output all points that are inside of BBC bounding boxes
(since they are all in Q) and it will look and lter all the points in BBP bounding
boxes to decide whether they are in Q.</p>
      <p>The total number of treated points corresponds to the number of points
contained in the BBC and BBP bounding boxes, which can be considerably less than
the total number of points in F (but this highly depends on the con guration of
the queries, data points, and chosen data structure). Additionally, the algorithm
incurs in the cost of checking the m bounding boxes of S. Our proposal is to
maintain this cost negligible compared to the number of points that have to be
checked by choosing correctly the number of levels of the tree data structure
during the preprocessing of the data.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Ongoing Work</title>
      <p>
        We have implemented quad tries in the C++ programming language
producing with this program the sequence of m les that containing the points inside
the corresponding bounding box in sequence S. Besides, we have implemented
the pipeline in the Go programming language (because of its mechanisms of
go-routines and channels). Our preliminar experiments show that our proposed
algorithm beats the nave one treating systematically half the points of the data
set for queries containing up to a 25% of the points of F . We plan to conduct
further experiments according to the following guidelines: (a) Considering huge
datasets and allocating their corresponding (tree-like) hierarchical
representations in the RAM, we envision that the performance of our algorithm overcomes
the results presented in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] under similar conditions and thus, it overcomes the
complexity of linear scanning. We will study, then, the incidence of stressing the
population of the memory in order to nd insights regarding the percentage of
memory that can be used for storage purposes without a ecting the performance
of the schedule and the memory management of the Go system; (b) Under the
premise that the set of points is uniformly distributed, we plan to measure the
incidence of the chosen level of the data structure (and thus of the number m
of bounding boxes to be ltered) on the performance of our algorithm; (c) The
dimensionality of the data increases the parallelism of our algorithm {which
depends on the query{ so we are interested in studying how, eventually, our
algorithm is more suitable than other proposals in high dimensional settings; (d)
Finally, in order to study the scalability and real applicability of our model, we
plan to conduct our experiments with big real datasets and benchmarks.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>J.</given-names>
            <surname>Araoz</surname>
          </string-name>
          and
          <string-name>
            <given-names>C.</given-names>
            <surname>Zoltan</surname>
          </string-name>
          .
          <article-title>Parallel triangles counting using pipelining</article-title>
          .
          <source>CoRR, abs/1510.03354</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>V.</given-names>
            <surname>Gaede</surname>
          </string-name>
          and
          <string-name>
            <given-names>O.</given-names>
            <surname>Gu</surname>
          </string-name>
          <article-title>nther. Multidimensional access methods</article-title>
          .
          <source>ACM Computing Surveys</source>
          ,
          <volume>30</volume>
          (
          <issue>2</issue>
          ):
          <volume>170</volume>
          {
          <fpage>231</fpage>
          ,
          <year>1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>E.</given-names>
            <surname>Pasarella</surname>
          </string-name>
          ,
          <string-name>
            <surname>M-E. Vidal</surname>
            , and
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Zoltan</surname>
          </string-name>
          .
          <article-title>Comparing mapreduce and pipeline implementations for counting triangles</article-title>
          .
          <source>Electronic proceedings in theoretical computer science</source>
          ,
          <volume>237</volume>
          :
          <fpage>20</fpage>
          {
          <fpage>33</fpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>H.</given-names>
            <surname>Samet</surname>
          </string-name>
          .
          <article-title>Foundations of Multidimensional and Metric Data Structures</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>S.</given-names>
            <surname>Sprenger</surname>
          </string-name>
          , P. Schafer, and
          <string-name>
            <given-names>U.</given-names>
            <surname>Leser</surname>
          </string-name>
          .
          <article-title>Multidimensional range queries on modern hardware</article-title>
          .
          <source>In Proceedings of the 30th International Conference on Scienti c and Statistical Database Management</source>
          ,
          <string-name>
            <surname>SSDBM</surname>
          </string-name>
          <year>2018</year>
          ,
          <article-title>Bozen-</article-title>
          <string-name>
            <surname>Bolzano</surname>
          </string-name>
          , Italy,
          <source>July 09-11</source>
          ,
          <year>2018</year>
          , pages
          <issue>4:1</issue>
          {4:
          <fpage>12</fpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>