{"action":"created","issue":{"url":"https://api.github.com/repos/metabase/metabase/issues/2635","repository_url":"https://api.github.com/repos/metabase/metabase","labels_url":"https://api.github.com/repos/metabase/metabase/issues/2635/labels{/name}","comments_url":"https://api.github.com/repos/metabase/metabase/issues/2635/comments","events_url":"https://api.github.com/repos/metabase/metabase/issues/2635/events","html_url":"https://github.com/metabase/metabase/issues/2635","id":155932844,"number":2635,"title":"Filtering applied to wrong join table when filter and group by applied to same table via different foreign key fields","user":{"login":"mattdoran","id":577779,"avatar_url":"https://avatars.githubusercontent.com/u/577779?v=3","gravatar_id":"","url":"https://api.github.com/users/mattdoran","html_url":"https://github.com/mattdoran","followers_url":"https://api.github.com/users/mattdoran/followers","following_url":"https://api.github.com/users/mattdoran/following{/other_user}","gists_url":"https://api.github.com/users/mattdoran/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdoran/subscriptions","organizations_url":"https://api.github.com/users/mattdoran/orgs","repos_url":"https://api.github.com/users/mattdoran/repos","events_url":"https://api.github.com/users/mattdoran/events{/privacy}","received_events_url":"https://api.github.com/users/mattdoran/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/metabase/metabase/labels/Bug","name":"Bug","color":"CC333F"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-20T10:25:43Z","updated_at":"2016-05-23T20:06:15Z","closed_at":null,"body":"*  I am using the Chrome browser.\r\n*  My computer's OS is Mac El Cap\r\n*  I'm running Metabase on Google Cloud Kubernetes cluster\r\n*  My database is MySQL.\r\n*  My Metabase version is 0.17.1.\r\n\r\nLoving metabase. :)    But I've found an issue with the filtering being applied to the wrong foreign key relationship.   We're querying a table with 2 fields referencing the same foreign key table.   If I filter by field A, and group by field B, the filter is being applied to field B incorrectly.  \r\n\r\nHard to explain clearly ... so I've provided a replication.\r\n\r\nSee the attachments:\r\n* metabase-bug.sql.txt - this creates the table and test data\r\n* raw-data - shows the data we've inserted\r\n* filtering-dim-a-but-no-results - we're filtering results from \"dim_a\" containing \"L1\" that should return results, but get none.\r\n* filtering-dim-a-but-results-from-dim-b - we're filtering \"dim_a\" containing \"L2\" that should get nothing , but getting results matching dim_b incorrectly.\r\n\r\nraw-data\r\n![raw-data](https://cloud.githubusercontent.com/assets/577779/15424919/86a7cbfa-1ec8-11e6-9fb5-f2a9dc76fe60.png)\r\n\r\nfiltering-dim-a-but-no-results\r\n![filtering-dim-a-but-no-results](https://cloud.githubusercontent.com/assets/577779/15424820/015f1b42-1ec8-11e6-95b2-55722eddc0fe.png)\r\n\r\nfiltering-dim-a-but-results-from-dim-b\r\n![filtering-dim-a-but-results-from-dim-b](https://cloud.githubusercontent.com/assets/577779/15424821/0160a5d4-1ec8-11e6-955c-42d0aec8058e.png)\r\n\r\n[metabase-bug.sql.txt](https://github.com/metabase/metabase/files/274357/metabase-bug.sql.txt)\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/metabase/metabase/issues/comments/221080469","html_url":"https://github.com/metabase/metabase/issues/2635#issuecomment-221080469","issue_url":"https://api.github.com/repos/metabase/metabase/issues/2635","id":221080469,"user":{"login":"camsaul","id":1455846,"avatar_url":"https://avatars.githubusercontent.com/u/1455846?v=3","gravatar_id":"","url":"https://api.github.com/users/camsaul","html_url":"https://github.com/camsaul","followers_url":"https://api.github.com/users/camsaul/followers","following_url":"https://api.github.com/users/camsaul/following{/other_user}","gists_url":"https://api.github.com/users/camsaul/gists{/gist_id}","starred_url":"https://api.github.com/users/camsaul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camsaul/subscriptions","organizations_url":"https://api.github.com/users/camsaul/orgs","repos_url":"https://api.github.com/users/camsaul/repos","events_url":"https://api.github.com/users/camsaul/events{/privacy}","received_events_url":"https://api.github.com/users/camsaul/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T20:06:15Z","updated_at":"2016-05-23T20:06:15Z","body":"My guess is that what's happening here is the generated SQL just contains a single left join against the table. I'll have to look at this a bit more. "}}
{"actor":{"display_login":"camsaul"}}