You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a list of candidate filesets for glk engines that can be merged
2079
-
"""
2080
-
withconn.cursor() ascursor:
2081
-
# Returns those filesets which have all detection files matching in the set fileset filtered by engine, file name and file size(if not -1) sorted in descending order of matches
2082
-
fileset_count+=1
2083
-
console_log_candidate_filtering(fileset_count)
2084
-
query="""
2085
-
WITH candidate_fileset AS (
2086
-
SELECT fs.id AS fileset_id, f.size
2087
-
FROM file f
2088
-
JOIN fileset fs ON f.fileset = fs.id
2089
-
JOIN game g ON g.id = fs.game
2090
-
JOIN engine e ON e.id = g.engine
2091
-
JOIN transactions t ON t.fileset = fs.id
2092
-
WHERE fs.id != %s
2093
-
AND e.engineid = %s
2094
-
AND f.detection = 1
2095
-
AND t.transaction != %s
2096
-
AND (g.gameid = %s OR (g.gameid != %s AND g.gameid LIKE %s))
2097
-
),
2098
-
total_detection_files AS (
2099
-
SELECT cf.fileset_id, COUNT(*) AS detection_files_found
2100
-
FROM candidate_fileset cf
2101
-
GROUP BY fileset_id
2102
-
),
2103
-
set_fileset AS (
2104
-
SELECT size FROM file
2105
-
WHERE fileset = %s
2106
-
),
2107
-
matched_detection_files AS (
2108
-
SELECT cf.fileset_id, COUNT(*) AS match_files_count
2109
-
FROM candidate_fileset cf
2110
-
JOIN set_fileset sf ON
2111
-
cf.size = sf.size OR cf.size = 0
2112
-
GROUP BY cf.fileset_id
2113
-
),
2114
-
valid_matched_detection_files AS (
2115
-
SELECT mdf.fileset_id, mdf.match_files_count AS valid_match_files_count
2116
-
FROM matched_detection_files mdf
2117
-
JOIN total_detection_files tdf ON tdf.fileset_id = mdf.fileset_id
2118
-
WHERE tdf.detection_files_found <= mdf.match_files_count
2119
-
),
2120
-
max_match_count AS (
2121
-
SELECT MAX(valid_match_files_count) AS max_count FROM valid_matched_detection_files
2122
-
)
2123
-
SELECT vmdf.fileset_id
2124
-
FROM valid_matched_detection_files vmdf
2125
-
JOIN total_detection_files tdf ON vmdf.fileset_id = tdf.fileset_id
2126
-
JOIN max_match_count mmc ON vmdf.valid_match_files_count = mmc.max_count
0 commit comments