[linq] Use hashtable lookup instead of linear scan for groupby keys. Fixes #18673