Closed Bug 1311150 Opened 8 years ago Closed 7 years ago

Prevent multiple highlights appearing from the same domain

Categories

(Firefox for iOS :: Home screen, defect, P2)

All
iOS
defect

Tracking

()

RESOLVED FIXED
Iteration:
1.14

People

(Reporter: sleroux, Assigned: bmunar)

References

Details

(Whiteboard: [MobileAS])

Attachments

(1 file)

55 bytes, text/x-github-pull-request
sleroux
: review+
Details | Review
Instead of displaying potentially many sites from the same domain, we should GROUP BY domain to produce unique domain results to give some more variety to the highlights algorithm.

Desktop: https://github.com/mozilla/activity-stream/blob/master/addon/PlacesProvider.js#L462
See Also: → 1298785
Priority: -- → P2
Whiteboard: [MobileAS]
This is your regularly scheduled reminder that GROUP BY in SQL is tricksy (e.g., individual values in a non-grouped column don't necessarily come from the same row!), and so careful review is worthwhile.
Hardware: Other → All
Iteration: --- → 1.13
Assignee: nobody → bmunar
Let's assume data like this:

CREATE TABLE peeps (
  age INTEGER,
  name TEXT,
  candy TEXT,
  shoesize INTEGER
);

INSERT INTO peeps VALUES
  (15, 'Alice', 'Gobstoppers', 7),
  (15, 'Barbara', 'Gummy worms', 6),
  (16, 'Carly', 'Red vines', 8),
  (16, 'Davina', 'Candy corn', 6);

Let's say you want a representative of each age: GROUP BY leaps to mind, just as it might when you're implementing this bug. So you write:

SELECT age, name, candy, shoesize
FROM peeps
GROUP BY age;

What you expect is this:

age         name        candy        shoesize
----------  ----------  -----------  ----------
15          Barbara     Gummy worms  6
16          Davina      Candy corn   6

What a compliant SQL engine can give you is this:

age         name        candy        shoesize
----------  ----------  -----------  ----------
15          Alice       Gummy worms  6
16          Davina      Candy corn   8

That is: there is no rule to say that values produced by grouping must come from the same contributing row. Alice is 15, yes, but she doesn't like gummy worms. Another member of the set of 15-year-olds does.

SQLite will almost always do what you expect, but when you throw joins, virtual tables, assorted index walks, aggregate operators, etc., you cannot rely on it, and that behavior might change in the future.
Attached file PR
Attachment #8825969 - Flags: review?(sleroux)
Iteration: 1.13 → 1.14
Attachment #8825969 - Flags: review?(sleroux) → review+
https://github.com/mozilla-mobile/firefox-ios/pull/2317/commits/cfd97ff94715d78857e3627b78515f36a59a3324
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: