How can you test annotation coverage without multiplying samples?
A correlated EXISTS tests whether the subquery returns any row. A qualifying outer sample is emitted once.
SQLite example and interpretation
Two annotations for one sample still cover one sample. The constant in SELECT 1 is sufficient because existence depends on rows.
WITH s(id) AS (VALUES(1),(2)), l(id) AS (VALUES(1),(1)) SELECT id FROM s WHERE EXISTS(SELECT 1 FROM l WHERE l.id=s.id);Result [[1]]
中文
如何判断样本是否被标注过而不放大行数?
相关 EXISTS 仅检查子查询是否至少返回一行,每个外层样本至多输出一次。
SQLite 示例与适用条件
一个样本有两条标注也只算一次已覆盖。EXISTS 的选择列表写 1 即可,判断依据是行的存在。
WITH s(id) AS (VALUES(1),(2)), l(id) AS (VALUES(1),(1)) SELECT id FROM s WHERE EXISTS(SELECT 1 FROM l WHERE l.id=s.id);结果 [[1]]