IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19601


Ignore:
Timestamp:
Sep 18, 2008, 1:03:35 PM (18 years ago)
Author:
Paul Price
Message:

Fixing difftool -todiffskyfile query. The old query didn't support
stack-stack subtractions, nor did it check that the templates and
inputs actually exist. This new query is a little complicated, since
it contains multiple self-joins. This is because of the options
involved: both templates and inputs can be either warps or stacks.
All of the templates and inputs need to exist, so we query against all
of them. I hope it's not a performance killer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/share/difftool_todiffskyfile.sql

    r19558 r19601  
     1-- This query is a little complicated, since it contains multiple self-joins.
     2-- This is because of the options involved: both templates and inputs can be either warps or stacks.
     3-- All of the templates and inputs need to exist, so we query against all of them.
    14SELECT DISTINCT
    25    diffRun.diff_id,
     
    58    diffRun.tess_id,
    69    diffRun.label,
    7     diffRun.state,
    8     rawExp.camera
     10    diffRun.state
    911FROM diffRun
     12-- Get list of templates for each diffRun
     13JOIN diffInputSkyfile AS diffTemplateSkyfile
     14    ON diffRun.diff_id = diffTemplateSkyfile.diff_id
     15    AND diffRun.skycell_id = diffTemplateSkyfile.skycell_id
     16    AND diffTemplateSkyfile.template = 1
     17-- Get list of inputs for each diffRun
    1018JOIN diffInputSkyfile
    11     USING(diff_id)
    12 JOIN warpSkyfile
    13     ON  diffInputSkyfile.warp_id    = warpSkyfile.warp_id
    14     AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id
    15     AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id
    16 JOIN warpRun
    17     ON warpRun.warp_id = warpSkyfile.warp_id
    18 JOIN fakeRun
    19     USING(fake_id)
    20 JOIN camRun
    21     USING(cam_id)
    22 JOIN chipRun
    23     USING(chip_id)
    24 JOIN rawExp
    25     USING(exp_id)
     19    ON diffRun.diff_id = diffInputSkyfile.diff_id
     20    AND diffRun.skycell_id = diffInputSkyfile.skycell_id
     21    AND diffInputSkyfile.template = 0
     22-- Get warp templates
     23LEFT JOIN warpRun AS warpTemplateRun
     24    ON warpTemplateRun.warp_id = diffTemplateSkyfile.warp_id
     25    AND diffTemplateSkyfile.stack_id IS NULL
     26LEFT JOIN warpSkyfile AS warpTemplateSkyfile
     27    ON warpTemplateSkyfile.warp_id = diffTemplateSkyfile.warp_id
     28    AND warpTemplateSkyfile.skycell_Id = diffTemplateSkyfile.skycell_id
     29    AND diffTemplateSkyfile.stack_id IS NULL
     30-- Get warp inputs
     31LEFT JOIN warpRun
     32    ON warpRun.warp_id = diffTemplateSkyfile.warp_id
     33    AND diffInputSkyfile.stack_id IS NULL
     34LEFT JOIN warpSkyfile
     35    ON warpSkyfile.warp_id = diffInputSkyfile.warp_id
     36    AND warpSkyfile.skycell_id = diffInputSkyfile.warp_id
     37    AND diffInputSkyfile.stack_id IS NULL
     38-- Get stack templates
     39LEFT JOIN stackRun AS stackTemplateRun
     40    ON stackTemplateRun.stack_id = diffTemplateSkyfile.stack_id
     41    AND diffTemplateSkyfile.warp_id IS NULL
     42LEFT JOIN stackSumSkyfile AS stackTemplateSkyfile
     43    ON stackTemplateSkyfile.stack_id = diffTemplateSkyfile.stack_id
     44    AND diffTemplateSkyfile.warp_id IS NULL
     45-- Get stack inputs
     46LEFT JOIN stackRun
     47    ON stackRun.stack_id = diffInputSkyfile.stack_id
     48    AND diffInputSkyfile.warp_id IS NULL
     49LEFT JOIN stackSumSkyfile
     50    ON stackSumSkyfile.stack_id = diffInputSkyfile.stack_id
     51    AND diffInputSkyfile.warp_id IS NULL
     52-- Get what's already been processed
    2653LEFT JOIN diffSkyfile
    2754    ON diffInputSkyfile.diff_id = diffSkyfile.diff_id
    2855WHERE
    29   ((diffRun.state = 'new'
    30       AND warpRun.state = 'full'
    31       AND fakeRun.state = 'full'
    32       AND camRun.state = 'full'
    33       AND chipRun.state = 'full'
    34       AND diffSkyfile.diff_id IS NULL)
    35   OR (diffRun.state = 'update'
    36       AND diffSkyfile.data_state = 'cleaned')
    37   )
     56-- Ready to be processed
     57    ((diffRun.state = 'new'
     58    AND diffSkyfile.diff_id IS NULL)
     59    OR (diffRun.state = 'update'
     60    AND diffSkyfile.data_state = 'cleaned')
     61    )
     62-- Ensure input warps are available
     63    AND (diffInputSkyfile.warp_id IS NULL
     64    OR (warpRun.state = 'full'
     65    AND warpSkyfile.fault = 0
     66    AND warpSkyfile.ignored = 0))
     67-- Ensure input stacks are available
     68    AND (diffInputSkyfile.stack_id IS NULL
     69    OR (stackRun.state = 'full'
     70    AND stackSumSkyfile.fault = 0))
     71-- Ensure template warps are available
     72    AND (diffTemplateSkyfile.warp_id IS NULL
     73    OR (warpTemplateRun.state = 'full'
     74    AND warpTemplateSkyfile.fault = 0
     75    AND warpTemplateSkyfile.ignored = 0))
     76-- Ensure template stacks are available
     77    AND (diffTemplateSkyfile.stack_id IS NULL
     78    OR (stackTemplateRun.state = 'full'
     79    AND stackTemplateSkyfile.fault = 0))
     80
Note: See TracChangeset for help on using the changeset viewer.