I have a simple Mongo database (further simplified as below), that I am querying with Apache Drill.
{"_id":{"$oid":"56a784b76952647b7b51c562"},"provenance":{"image": {"case_id":"TCGA-TS2","subject_id":"TCGA"}}}
mongoimport --db users --collection contacts --type small.json
SELECT camic.provenance.image.case_id caseid
FROM mongo.users.
contacts
camic+-----------+
| caseid |
+-----------+
| TCGA-TS2 |
+-----------+
1 row selected (1,26 seconds)
However, the query fails, when a "WHERE" is involved with a nested element, as below.
SELECT camic.provenance.image.case_id caseid FROM mongo.users.
contacts
camic WHERE caseid = 'TCGA-TS2';
(The expected outcome is the same as above without the WHERE clause).
This probably is a bug, and I have reported it: https://issues.apache.org/jira/browse/DRILL-4855
Is there any workaround to get the outcome involving nested elements in Mongo using Apache Drill?
SELECT camic.provenance.image.case_id caseid
FROM mongo.users.contacts camic
WHERE camic.provenance.image.case_id = 'TCGA-TS2';
We cannot reference column aliases in the following clauses: