int resourceSnapshotId = getSnapshotIdFor(resource);
// Order of columns is important - see code below!
- String sql = "SELECT to_blocks.hash, res.kee, to_blocks.index_in_file, to_blocks.start_line, to_blocks.end_line" +
+ String sql = "SELECT DISTINCT to_blocks.hash, res.kee, to_blocks.index_in_file, to_blocks.start_line, to_blocks.end_line" +
" FROM duplications_index to_blocks, duplications_index from_blocks, snapshots snapshot, projects res" +
" WHERE from_blocks.snapshot_id = :resource_snapshot_id" +
" AND to_blocks.hash = from_blocks.hash" +
<!-- foo -->
<duplications_index id="5" project_snapshot_id="9" snapshot_id="10" hash="aa" index_in_file="0" start_line="0" end_line="0" />
+ <!-- Note that there is two blocks with same hash for current analysis to verify that we use "SELECT DISTINCT", -->
+ <!-- without "DISTINCT" we will select block from "bar-last" two times. -->
+ <duplications_index id="6" project_snapshot_id="9" snapshot_id="10" hash="aa" index_in_file="1" start_line="1" end_line="1" />
+
</dataset>