Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT `t0`.`__measure__0` AS `Calculation_1361031105746580`,
- COUNT(DISTINCT `t0`.`c_custkey`) AS `ctd_c_custkey_ok`
- FROM (
- SELECT `mongo_customer`.`c_custkey` AS `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)) AS `__measure__0`
- FROM `mongo_customer`
- LEFT JOIN `mongo_orders` ON (`mongo_customer`.`c_custkey` = `mongo_orders`.`o_custkey`)
- GROUP BY 1
- ) `t0`
- GROUP BY 1;
- ↳ Project(Calculation_1361031105746580, ctd_c_custkey_ok):
- ↳ GroupBy(t0.__measure__0):
- ↳ Subquery(t0):
- ↳ Project(c_custkey, __measure__0):
- ↳ GroupBy(mongo_customer.c_custkey):
- ↳ Join:
- ↳ MongoSource: '[mongo_customer]' (db: 'tpch', collection: '[mongo_customer]') as '[mongo_customer]' left join
- ↳ MongoSource: '[mongo_orders]' (db: 'tpch', collection: '[mongo_orders]') as '[mongo_orders]' on mongo_customer.c_custkey = mongo_orders.o_custkey
- ↳ Project(Calculation_1361031105746580, ctd_c_custkey_ok):
- ↳ GroupBy(t0.__measure__0):
- ↳ Subquery(t0):
- ↳ Project(c_custkey, __measure__0):
- ↳ GroupBy(mongo_customer.c_custkey):
- ↳ 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):
- ↳ MongoSource: '[mongo_customer mongo_orders]' (db: 'tpch', collection: '[mongo_customer mongo_orders]') as '[mongo_customer mongo_orders]':
- {"$lookup":{"as":"__joined_mongo_orders","foreignField":"o_custkey","from":"mongo_orders","localField":"_id"}},
- {"$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}},
- {"$unwind":{"path":"$__joined_mongo_orders","preserveNullAndEmptyArrays":true}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement