sid-viadots commented on issue #2440:
URL: https://github.com/apache/drill/issues/2440#issuecomment-1350513703

   Query is something like this.
   SELECT count(*) AS `count`
   FROM
     (WITH drs as
        (SELECT d.10.1.1 as 1011,
                d.1,
                2,
                d.2,
                d.4 as 4,
                d.5,
                d.6 as 6,
                d.7 as 7,
                d.8,
                d.9.1 as 91,
                d.9.2 as 92,
                d.date
         FROM `mongo`.`db`.`drs` d
         where d.6 is not null
           and d.7 is not null ),
           znes as
        (SELECT flatten(kvgen(z._id)) as _id,
                z.zn
         FROM `mongo`.`db`.`z` z),
           ctes as
        (SELECT flatten(kvgen(c._id)) as _id,
                c.cn
         FROM `mongo`.`db`.`c` c),
           drsWithId as
        (select flatten(kvgen(`dr`.`6`))as 6,
                flatten(kvgen(`dr`.`7`))as 7,
                dr.*
         from dr) 
         select drsWithId.*,
                              znes.zn as zn,
                              ctes.cn as cn
      from drsWithId
      left join znes on znes._id.value=drsWithId.6.value
      left join ctes on ctes._id.value=drsWithId.7.value) AS virtual_table
   WHERE `cn` IN ('text')
   LIMIT 50000


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to