How to implement optimization of INNER JOINS (push down) for Mongo Storage Plugin in Apache Drill? : <p>I would like to extend the <a href="https://drill.apache.org/docs/mongodb-storage-plugin/" rel="noreferrer">Apache Drill Mongo Storage Plugin</a> to push down INNER JOINs. Therefore I would like to rewrite <code>INNER JOIN</code> into the mongo aggregation pipeline.</p>

<p>How do we need to start to implement the rewrite in <a href="https://drill.apache.org/" rel="noreferrer">Apache Drill</a>.</p>

<p>Here is a SQL example:</p>

<pre><code>SELECT *
FROM `mymongo.db`.`test` `test`
  INNER JOIN `mymongo.db`.`test2` `test2`
  ON (`test`.`id` = `test2`.`fk`)
WHERE `test2`.`date` = '09.05.2017'
</code></pre>

<p>I have found the <a href="https://github.com/apache/drill/blob/master/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoPushDownFilterForScan.java" rel="noreferrer">push down</a> of <code>WHERE</code> clauses in the Mongo Storage Plugin. But I am still struggling to do the same for <code>INNER JOINS</code>. How would the constuctor of <code>public class MongoPushDownInnerJoinScan extends StoragePluginOptimizerRule</code> look like? Which equivalent of <code>MongoGroupScan</code> (<a href="https://github.com/apache/drill/blob/master/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoGroupScan.java" rel="noreferrer"><code>AbstractGroupScan</code></a>) would I have to implement? Any help would be very much appreciated.</p>
