Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. SELECT `t0`.`__measure__0` AS `Calculation_1361031105746580`,
  2. COUNT(DISTINCT `t0`.`c_custkey`) AS `ctd_c_custkey_ok`
  3. FROM (
  4. SELECT `mongo_customer`.`c_custkey` AS `c_custkey`,
  5. COUNT((CASE
  6. WHEN (NOT ((LOCATE('special',`mongo_orders`.`o_comment`) > 0) AND (IF(ISNULL(LOCATE('special',`mongo_orders`.`o_comment`)), NULL, LOCATE('requests',`mongo_orders`.`o_comment`,GREATEST(1,FLOOR(LOCATE('special',`mongo_orders`.`o_comment`))))) > 0))) THEN `mongo_orders`.`o_orderkey`
  7. ELSE NULL
  8. END)) AS `__measure__0`
  9. FROM `mongo_customer`
  10. LEFT JOIN `mongo_orders` ON (`mongo_customer`.`c_custkey` = `mongo_orders`.`o_custkey`)
  11. GROUP BY 1
  12. ) `t0`
  13. GROUP BY 1;
  14.  
  15. ↳ Project(Calculation_1361031105746580, ctd_c_custkey_ok):
  16. ↳ GroupBy(t0.__measure__0):
  17. ↳ Subquery(t0):
  18. ↳ Project(c_custkey, __measure__0):
  19. ↳ GroupBy(mongo_customer.c_custkey):
  20. ↳ Join:
  21. ↳ MongoSource: '[mongo_customer]' (db: 'tpch', collection: '[mongo_customer]') as '[mongo_customer]' left join
  22. ↳ MongoSource: '[mongo_orders]' (db: 'tpch', collection: '[mongo_orders]') as '[mongo_orders]' on mongo_customer.c_custkey = mongo_orders.o_custkey
  23.  
  24.  
  25. ↳ Project(Calculation_1361031105746580, ctd_c_custkey_ok):
  26. ↳ GroupBy(t0.__measure__0):
  27. ↳ Subquery(t0):
  28. ↳ Project(c_custkey, __measure__0):
  29. ↳ GroupBy(mongo_customer.c_custkey):
  30. ↳ Project(c_custkey, count(case when (not locate(special,mongo_orders.o_comment)>0 and if(isnull(locate(special,mongo_orders.o_comment)),null,locate(requests,mongo_orders.o_comment,greatest(1,floor(locate(special,mongo_orders.o_comment)))))>0) then mongo_orders.o_orderkey else null end), o_comment, o_orderkey):
  31. ↳ MongoSource: '[mongo_customer mongo_orders]' (db: 'tpch', collection: '[mongo_customer mongo_orders]') as '[mongo_customer mongo_orders]':
  32. {"$lookup":{"as":"__joined_mongo_orders","foreignField":"o_custkey","from":"mongo_orders","localField":"_id"}},
  33. {"$project":{"__joined_mongo_orders":{"$cond":[{"$eq":[{"$ifNull":["$_id",null]},null]},{"$literal":[]},"$__joined_mongo_orders"]},"_id":1,"c_acctbal":1,"c_address":1,"c_comment":1,"c_mktsegment":1,"c_n_name":1,"c_name":1,"c_nationkey":1,"c_phone":1,"c_r_name":1,"c_regionkey":1}},
  34. {"$unwind":{"path":"$__joined_mongo_orders","preserveNullAndEmptyArrays":true}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement