{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/19345","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/19345/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/19345/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/19345/events","html_url":"https://github.com/JuliaLang/julia/issues/19345","id":189878439,"number":19345,"title":"Unique is not removing duplicate elements - hashing issue?","user":{"login":"maximsch2","id":464680,"avatar_url":"https://avatars.githubusercontent.com/u/464680?v=3","gravatar_id":"","url":"https://api.github.com/users/maximsch2","html_url":"https://github.com/maximsch2","followers_url":"https://api.github.com/users/maximsch2/followers","following_url":"https://api.github.com/users/maximsch2/following{/other_user}","gists_url":"https://api.github.com/users/maximsch2/gists{/gist_id}","starred_url":"https://api.github.com/users/maximsch2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maximsch2/subscriptions","organizations_url":"https://api.github.com/users/maximsch2/orgs","repos_url":"https://api.github.com/users/maximsch2/repos","events_url":"https://api.github.com/users/maximsch2/events{/privacy}","received_events_url":"https://api.github.com/users/maximsch2/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-11-16T23:08:51Z","updated_at":"2016-11-21T17:01:42Z","closed_at":"2016-11-16T23:11:47Z","body":"I'm running a code similar to following (data: https://homes.cs.washington.edu/~grechkin/bugreport1.jld)\r\n```julia\r\nusing JLD\r\n\r\ntype A1\r\n    v1::String\r\n    v2::String\r\nend\r\ntype B1\r\n    val::A1\r\n    tag::String    \r\nend\r\n\r\n@load \"bugreport1.jld\" tmp_data2\r\nBase.hash(x::A1) = hash((x.v1, x.v2))\r\nBase.hash(x::B1) = hash((hash(x.tag), hash(x.val)))\r\nimport Base.==\r\n==(x::B1, y::B1) = x.tag == y.tag && x.val.v1 == y.val.v1 && x.val.v2 == y.val.v2\r\n\r\n@show tmp_data2 # 12 items in the array with last two duplicated\r\n\r\n@show unique(tmp_data2[1:12]) # expect here that one of the last two entries will be removed\r\n\r\n@show unique(tmp_data2[6:12]) # when I call it like this, last two items are actually deduplicated\r\n\r\n# yet:\r\n@show hash(tmp_data2[11]) == hash(tmp_data2[12]) # true\r\n@show tmp_data2[11] == tmp_data2[12] # true\r\n```\r\nOn Julia 0.5 and it looks like `unique` is not removing elements even though they are equal to each other and hash to the same value."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/261999509","html_url":"https://github.com/JuliaLang/julia/issues/19345#issuecomment-261999509","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/19345","id":261999509,"user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"created_at":"2016-11-21T17:01:42Z","updated_at":"2016-11-21T17:01:42Z","body":"@maximsch2, I believe that scheme has the problem that each value is hashed once as an object and then again as an integer, doubling the amount of work done to hash large objects. The user who overloads two-argument `hash` isn't expected to do anything all that clever: they're just supposed to use two-argument `hash` recursively on each essential component of a value."}}
{"actor":{"display_login":"StefanKarpinski"}}