<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>I'm currently working on a query engine based on LLVM and looking
      for the "best" approach to map our own generic "data model" within
      the infrastructure.<br>
      <br>
      When I do a query, lets say I have athletes and wish to apply a
      query like this :<br>
      <br>
          age > 18 && result.speed > 15<br>
      <br>
      Here is my data model, it is generic data model and a data schema
      that describe the 'form' of the data. Here are some pseudo-code :<br>
      <br>
          struct Data<br>
          {<br>
            vector<double> doubleValues;<br>
            vector<double> intValues;<br>
            vector<double> stringValues;<br>
            <br>
            vector<Data>   children;<br>
          };<br>
          <br>
          enum class DataPropertyType<br>
          {<br>
            DPT_DOUBLE,<br>
            DPT_INT,<br>
            DPT_TEXT,<br>
            DPT_CHILDREN,<br>
          };<br>
          <br>
          struct DataProperty<br>
          {<br>
            DataPropertyType type;<br>
            string name;<br>
            int index;<br>
            DataSchema* children = nullptr;<br>
          };<br>
          <br>
          struct DataSchema<br>
          {<br>
            vector<DataProperty> properties;<br>
          };<br>
          <br>
          //------------------------------<br>
          // Construct the schema<br>
          //------------------------------<br>
          <br>
          DataSchema schPerformance;<br>
          schPerformance.push_back( DataProperty {DPT_DOUBLE, "speed",
      0} );<br>
          <br>
          DataSchema schPerson;<br>
          schPerson.push_back( DataProperty {DPT_INT, "age", 0} );<br>
          schPerson.push_back( DataProperty {DPT_CHILDREN, "result", 1,
      schPerformance}     );<br>
          <br>
          //------------------------------<br>
          // Construct one item<br>
          //------------------------------<br>
          Data performance;<br>
          performance.doubleValues[0] = 20; // speed<br>
          <br>
          Data person;<br>
          person.intValues[0] = 20; // age<br>
          person.children[0] = performance; // performance<br>
      <br>
      What I wish, is to use the existing 'data schema', predefined
      before the query execution, to allow LLVM to 'map' its JIT
      directly to my structure, it is all about performance.<br>
      I wish to avoid dynamic schema lookup and introspection.<br>
      <br>
      The idea is to use the DataSchema and the 'indexes' information +
      type information during code generation.<br>
      <br>
      Then, I have a list of 'Data' I which to filter, lets say :<br>
      <br>
          //------------------------------<br>
          // Example of use<br>
          //------------------------------<br>
          vector<Data> datas;<br>
          <br>
          ... populate the datas <br>
      <br>
          vector<Data> result;    <br>
          foreach(Data& data : datas)<br>
          {<br>
            if ( query.filter(data) ) result.push_back(data);<br>
          }<br>
      <br>
      Do you know a way, or the best way to apply such strategy ?<br>
      <br>
      Thx<br>
      <br>
      <br>
    </p>
    <div class="moz-signature">-- <br>
      <meta charset="utf-8">
      <title>Luciad Email Signature</title>
      <span class="name" style="font-family: Arial, Helvetica,
        sans-serif;font-size: 10pt;color: #6B7D82;text-transform:
        uppercase;"><strong>
          Christophe Demez
        </strong></span><br>
      <span class="title" style="font-family: Arial, Helvetica,
        sans-serif;font-size: 9pt;color: #6B7D82;text-transform:
        uppercase;">
        PROJECT LEADER
      </span> <span class="half-line" style="line-height:2px;">  <br>
        <br>
      </span> <span class="links" style="color: #6B7D82;font-family:
        Arial, Helvetica, sans-serif;font-size: 9pt;"><a
          href="http://www.luciad.com/" target="_blank" style="color:
          #6B7D82;font-family: Arial, Helvetica, sans-serif;font-size:
          10pt;font-weight: 400;text-decoration: none;"><strong>LUCIAD</strong></a></span><span
        class="normal" style="font-family: Arial, Helvetica,
        sans-serif;font-size: 9pt;font-weight: 400;color: #6B7D82;">
         CONNECT  <span class="normal" style="font-family: Arial,
          Helvetica, sans-serif;font-size:
          9pt;font-weight: 400;color: #6B7D82;">•  VISUALIZE  <span
            class="normal" style="font-family: Arial, Helvetica,
            sans-serif;font-size: 9pt;font-weight: 400;color: #6B7D82;">•</span>
           ANALYZE  <span class="normal" style="font-family: Arial,
            Helvetica, sans-serif;font-size: 9pt;font-weight: 400;color:
            #6B7D82;">•</span>
           ACT</span></span> <span class="half-line"
        style="line-height:2px;">  <br>
        <br>
      </span> <span class="links" style="color: #6B7D82;font-family:
        Arial, Helvetica, sans-serif;font-size: 9pt;font-weight: 400;">
        <a href="mailto:christophe.demez@luciad.com" style="color:
          #6B7D82;font-family: Arial, Helvetica, sans-serif;font-size:
          9pt;font-weight: 400;text-decoration: none;">
          christophe.demez@luciad.com
        </a> </span> <span class="normal" style="font-family: Arial,
        Helvetica, sans-serif;font-size: 9pt;font-weight: 400;color:
        #6B7D82;">• </span><span class="normal" style="font-family:
        Arial, Helvetica, sans-serif;font-size: 9pt;font-weight:
        400;color: #6B7D82;"> T </span><span class="number"
        style="font-family: Tahoma, Arial sans-serif;font-size:
        9pt;font-weight: 200;color: #6B7D82;">
        +32 16 23 95 91
      </span><br>
      <span class="normal" style="font-family: Arial, Helvetica,
        sans-serif;font-size: 9pt;font-weight: 400;color: #6B7D82;">Follow
        us on </span><span class="links" style="color:
        #6B7D82;font-family: Arial, Helvetica, sans-serif;font-size:
        9pt;font-weight: 400;"><a
          href="https://www.linkedin.com/company/luciad" style="color:
          #6B7D82;font-family: Arial, Helvetica, sans-serif;font-size:
          9pt;font-weight: 400;text-decoration: none;">LinkedIn</a></span><span
        class="normal" style="font-family: Arial, Helvetica,
        sans-serif;font-size:
        9pt;font-weight: 400;color: #6B7D82;"> or </span><span
        class="links" style="color: #6B7D82;font-family: Arial,
        Helvetica, sans-serif;font-size: 9pt;font-weight: 400;"><a
          href="http://www.twitter.com/LUCIADconnect" style="color:
          #6B7D82;font-family: Arial, Helvetica, sans-serif;font-size:
          9pt;font-weight: 400;text-decoration: none;">@LUCIADconnect</a></span>
      <span class="half-line" style="line-height:2px;">   <br>
        <br>
      </span> <img
        src="http://www.luciad.com/files/images/luciad-logo.png"
        alt="Luciad"> </div>
  </body>
</html>