{"publisher":"WESWOO","id":"catalog-image-pairing","title":{"zh":"查看样例与复核查询","en":"View the records and verification query"},"setup_sql":"CREATE TABLE expected(handle TEXT,pos INT,file TEXT,PRIMARY KEY(handle,pos));\nINSERT INTO expected VALUES\n('ocean-blue-shirt',1,'young-man-in-bright-fashion_925x.jpg'),\n('classic-varsity-top',1,'casual-fashion-woman_925x.jpg'),\n('yellow-wool-jumper',1,'autumn-photographer-taking-picture_925x.jpg'),\n('floral-white-top',1,'city-woman-fashion_925x@2x.jpg'),\n('striped-silk-blouse',1,'striped-blouse-fashion_925x.jpg'),\n('classic-leather-jacket',1,'leather-jacket-and-tea_925x.jpg'),\n('dark-denim-top',1,'young-female-models-denim_925x.jpg'),\n('navy-sport-jacket',1,'mens-fall-fashion-jacket_925x.jpg'),\n('dark-winter-jacket',1,'smiling-woman-on-snowy-afternoon_925x.jpg'),\n('black-leather-bag',1,'black-bag-over-the-shoulder_925x.jpg'),\n('zipped-jacket',1,'menswear-blue-zip-up-jacket_925x.jpg'),\n('silk-summer-top',1,'young-hip-woman-at-carnival_925x.jpg'),\n('longsleeve-cotton-top',1,'woman-outside-brownstone_925x.jpg'),\n('chequered-red-shirt',1,'red-plaid-shirt_925x.jpg'),\n('white-cotton-shirt',1,'smiling-woman-poses_925x.jpg'),\n('olive-green-jacket',1,'urban-fashion_925x.jpg'),\n('blue-silk-tuxedo',1,'man-adjusts-blue-tuxedo-bowtie_925x.jpg'),\n('red-sports-tee',1,'womens-red-t-shirt_925x.jpg'),\n('striped-skirt-and-top',1,'woman-in-the-city_925x.jpg'),\n('led-high-tops',1,'putting-on-your-shoes_925x.jpg');\nCREATE TABLE draft AS SELECT * FROM expected;","query_sql":"WITH slots AS (\n SELECT handle,pos FROM expected UNION SELECT handle,pos FROM draft\n), audit AS (\n SELECT s.handle,s.pos,CASE WHEN e.file IS NULL THEN 'unexpected' WHEN COUNT(d.file)=0 THEN 'missing'\n WHEN COUNT(d.file)>1 THEN 'collision' WHEN MIN(d.file)=e.file THEN 'ok' ELSE 'wrong' END AS status\n FROM slots s LEFT JOIN expected e USING(handle,pos) LEFT JOIN draft d USING(handle,pos) GROUP BY s.handle,s.pos,e.file\n) SELECT status,COUNT(*) AS image_slots FROM audit GROUP BY status ORDER BY status;","checks":[{"condition":"Approved shot list and file delivery agree","change_sql":"","expected":[["ok",20]],"observed":[["ok",20]]},{"condition":"Handles and filenames sorted independently","change_sql":"DELETE FROM draft;\nINSERT INTO draft WITH handles AS (SELECT handle,pos,ROW_NUMBER() OVER(ORDER BY handle,pos) n FROM expected),\n files AS (SELECT file,ROW_NUMBER() OVER(ORDER BY file) n FROM expected)\n SELECT handle,pos,file FROM handles JOIN files USING(n);","expected":[["ok",1],["wrong",19]],"observed":[["ok",1],["wrong",19]]},{"condition":"Two photos claim one position, one photo missing, one unexpected view","change_sql":"INSERT INTO draft VALUES ('ocean-blue-shirt',1,'alternate.jpg');\nDELETE FROM draft WHERE handle='black-leather-bag';\nINSERT INTO draft VALUES ('ocean-blue-shirt',2,'back.jpg');","expected":[["collision",1],["missing",1],["ok",18],["unexpected",1]],"observed":[["collision",1],["missing",1],["ok",18],["unexpected",1]]}],"source":{"url":"https://github.com/shopifypartners/product-csvs/blob/045fb432d85dc59d558717208399176d62bf106d/apparel.csv","sha256":"90291acf9147ab2eeccb7ead518bb5b3dd8900f7285b8cea918403e732c451b3","csv_rows":22,"image_rows":20}}