adrpar / paqu

A parallel query engine for MySQL + Spider Engine built on a fork of shard-query
GNU General Public License v2.0
10 stars 0 forks source link

Condition not applied correctly #35

Open kristinriebe opened 9 years ago

kristinriebe commented 9 years ago

The condition sprng_dbl(123) < 0.01 should be applied at the end, not just for the first subquery. This is probably related to some of the other issues. Maybe it's also somethign that PaQu cannot know and must be stated more explicitely using a nested subquery. In any case it shouldn't just assign the sprng-condition to the very first subquery it does (this will return wrong results).

Query

SELECT f.fofId, f.x,f.y,f.z,f.size, p.x,p.y,p.z 
FROM Bolshoi.FOF f, Bolshoi.Particles416 p 
WHERE f.fofId=416000400000 
AND SQRT( POWER(p.x-f.x,2) + POWER(p.y-f.y,2) + POWER(p.z-f.z,2) ) <= f.size 
AND sprng_dbl(123) < 0.01

Query plan

-- CALL paquExec('SELECT `f`.`fofId` AS `f.fofId`,`f`.`x` AS `f.x`,`f`.`y` AS `f.y`,`f`.`z` AS `f.z`,`f`.`size` AS `f.size` FROM Bolshoi.FOF AS `f` WHERE ( `f`.`fofId` = 416000400000 ) AND ( sprng_dbl( 123 ) < 0.01 ) ', 'aggregation_tmp_28695038')
-- CALL paquExec('SELECT `p`.`x` AS `p.x`,`p`.`y` AS `p.y`,`p`.`z` AS `p.z`,`f`.`f.fofId` AS `f.fofId`,`f`.`f.x` AS `f.x`,`f`.`f.y` AS `f.y`,`f`.`f.z` AS `f.z`,`f`.`f.size` AS `f.size` FROM Bolshoi.Particles416 AS `p` JOIN ( SELECT `f.fofId`,`f.x`,`f.y`,`f.z`,`f.size` FROM `aggregation_tmp_28695038` ) AS `f` WHERE ( SQRT( POWER( `p`.`x` - `f`.`f.x`, 2 ) + POWER( `p`.`y` - `f`.`f.y`, 2 ) + POWER( `p`.`z` - `f`.`f.z`, 2 ) ) <= `f`.`f.size` ) ', 'aggregation_tmp_112926')-- CALL paquDropTmp('aggregation_tmp_28695038')
-- USE spider_tmp_shard
-- SET @i=0
-- CREATE TABLE cosmosim_user_kristin.`2014-12-12-13-29-50-1907` ENGINE=MyISAM SELECT @i:=@i+1 AS `row_id`, `p.x`,`p.y`,`p.z`,`f.fofId`,`f.x`,`f.y`,`f.z`,`f.size` FROM `aggregation_tmp_112926` -- CALL paquDropTmp('aggregation_tmp_112926')