@Test public void testReqQuery_forEach_arr_points_to_ref() throws Exception { GMD gmd = new GMD(projection("{'field':'obj1.c','include':1}"), null); CompositeMetadata md = CompositeMetadata.buildCompositeMetadata(getMd("composite/A.json"), gmd); AnalyzeQuery pq = new AnalyzeQuery(md, null); QueryExpression q = query("{'array' : 'obj1.c', 'elemMatch':{'field':'_id','op':'$eq','rfield':'$parent.c_ref'}}"); pq.iterate(q); List<QueryFieldInfo> list = pq.getFieldInfo(); RewriteQuery rw = new RewriteQuery(md, md.getChildMetadata(new Path("obj1.c"))); RewriteQuery.RewriteQueryResult result = rw.rewriteQuery(q, list); QueryExpression newq = result.query; List<BoundObject> bindings = result.bindings; Assert.assertEquals(1, bindings.size()); Assert.assertTrue(bindings.get(0) instanceof BoundValue); Assert.assertTrue(newq instanceof ValueComparisonExpression); rw = new RewriteQuery(md, md); result = rw.rewriteQuery(q, list); bindings = result.bindings; newq = result.query; Assert.assertEquals(1, bindings.size()); Assert.assertTrue(bindings.get(0) instanceof BoundValue); Assert.assertTrue(newq instanceof ValueComparisonExpression); }
public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } RewriteQuery(CompositeMetadata root,
                        CompositeMetadata currentEntity); }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } RewriteQuery(CompositeMetadata root,
                        CompositeMetadata currentEntity); RewriteQueryResult rewriteQuery(QueryExpression q, List<QueryFieldInfo> fieldInfo); }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } RewriteQuery(CompositeMetadata root,
                        CompositeMetadata currentEntity); RewriteQueryResult rewriteQuery(QueryExpression q, List<QueryFieldInfo> fieldInfo);  }