{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2743","repository_url":"https://api.github.com/repos/elixir-ecto/ecto","labels_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2743/labels{/name}","comments_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2743/comments","events_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2743/events","html_url":"https://github.com/elixir-ecto/ecto/issues/2743","id":369080239,"node_id":"MDU6SXNzdWUzNjkwODAyMzk=","number":2743,"title":"BadMapError compile error using Ecto.Query.join/5, as option and Ecto.Query.update/3","user":{"login":"Eiji7","id":10956022,"node_id":"MDQ6VXNlcjEwOTU2MDIy","avatar_url":"https://avatars2.githubusercontent.com/u/10956022?v=4","gravatar_id":"","url":"https://api.github.com/users/Eiji7","html_url":"https://github.com/Eiji7","followers_url":"https://api.github.com/users/Eiji7/followers","following_url":"https://api.github.com/users/Eiji7/following{/other_user}","gists_url":"https://api.github.com/users/Eiji7/gists{/gist_id}","starred_url":"https://api.github.com/users/Eiji7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eiji7/subscriptions","organizations_url":"https://api.github.com/users/Eiji7/orgs","repos_url":"https://api.github.com/users/Eiji7/repos","events_url":"https://api.github.com/users/Eiji7/events{/privacy}","received_events_url":"https://api.github.com/users/Eiji7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-11T11:40:39Z","updated_at":"2018-10-11T12:28:35Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I'm working for `Company` which is interested in `ecto` 3 and `phoenix` 1.4 new features which would help us a lot, so reporting possible issues have higher priority for me - we have even special branches for them on my local machine. :-)\r\n\r\nI wanted to tried write one migration using latest API, but got `BadMapError`. It's not critical for me now, because I can solve same problem in old way, but I would like to use this feature in more important parts of our code soon. I have hidden our naming, so there is `ModelA`, `b_assoc` etc. Please let me know if you will need more information or code example.\r\n\r\n### Environment\r\n\r\n```elixir\r\n$ asdf current\r\nelixir         1.7.3-otp-21 (set by …)\r\nerlang         21.1    (set by …)\r\npostgres       10.5    (set by …)\r\n…\r\n\r\n$ mix deps.get\r\n…\r\n* ecto 3.0.0-dev (https://github.com/elixir-ecto/ecto.git) (mix)\r\n  locked at 97a6350\r\n  ok\r\n…\r\n* postgrex 0.14.0-rc.0 (Hex package) (mix)\r\n  locked at 0.14.0-rc.0 (postgrex) 1529edba\r\n  ok\r\n…\r\n\r\n$ epro\r\n=== Enabled Profiles: ===\r\n\r\n        arch: x86-64bit\r\n       build: current\r\n     subarch: intel64-ivybridge\r\n      flavor: desktop\r\n     mix-ins: kde-plasma-5\r\n     mix-ins: no-systemd\r\n$ uname -a\r\nLinux funtoo 4.8.15-1 #3 SMP Sat Nov 11 23:20:19 CET 2017 x86_64 Intel(R) Core(TM) i7-3630QM CPU @ 2.40GHz GenuineIntel GNU/Linux\r\n…\r\n```\r\n\r\nThe distribution name is `Funtoo Linux` (`Gentoo`-based)\r\n\r\n### Not working code\r\n\r\n```elixir\r\nModelA\r\n|> Query.from(as: :a)\r\n|> Query.where([a: a], is_nil(a.field_name))\r\n|> Query.join(:inner, [a: a], assoc(a, :b_assoc), as: :b)\r\n|> Query.update([b: b], set: [field_name: value])\r\n```\r\n\r\n### Similar working code\r\n\r\n```elixir\r\nModelA\r\n|> Query.from(as: :a)\r\n|> Query.where([a], is_nil(a.field_name))\r\n|> Query.update([a: a], set: [field_name: value])\r\n```\r\n\r\n### Current behavior\r\n\r\nI got such compilation error:\r\n\r\n```elixir\r\n[info] == Running $MyApp$.Repo.Migrations.$MigrationName$.change/0 forward\r\n** (BadMapError) expected a map, got: {{:., [], [{:__aliases__, [alias: false], [:Ecto, :Query, :Builder, :Join]}, :apply_aliases]}, [], [{:%{}, [], [a: 0]}, :b, nil]}\r\n    (stdlib) :maps.find(:b, {{:., [], [{:__aliases__, [alias: false], [:Ecto, :Query, :Builder, :Join]}, :apply_aliases]}, [], [{:%{}, [], [a: 0]}, :b, nil]})\r\n    _build/dev/lib/$my_app$/priv/repo/migrations/$migration_number$_$migration_name$.exs:$line$: $MyApp$.Repo.Migrations.$MigrationName$.change/0\r\n    (stdlib) timer.erl:197: :timer.tc/3\r\n    (ecto_sql) lib/ecto/migration/runner.ex:26: Ecto.Migration.Runner.run/6\r\n    (ecto_sql) lib/ecto/migrator.ex:197: Ecto.Migrator.attempt/6\r\n    (ecto_sql) lib/ecto/migrator.ex:113: anonymous fn/3 in Ecto.Migrator.do_up/4                                                           \r\n    (ecto_sql) lib/ecto/adapters/sql.ex:776: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4                                 \r\n    (db_connection) lib/db_connection.ex:1341: DBConnection.run_transaction/4                                                              \r\n    (ecto_sql) lib/ecto/migrator.ex:185: Ecto.Migrator.do_run_maybe_in_transaction/3\r\n    (elixir) lib/task/supervised.ex:89: Task.Supervised.do_apply/2\r\n    (elixir) lib/task/supervised.ex:38: Task.Supervised.reply/5\r\n    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3\r\n```\r\n\r\n### Expected behavior\r\n\r\nAs far as I know both code examples (assuming that both models, relations etc. are valid) should compile and work without problem."},"comment":{"url":"https://api.github.com/repos/elixir-ecto/ecto/issues/comments/428936384","html_url":"https://github.com/elixir-ecto/ecto/issues/2743#issuecomment-428936384","issue_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2743","id":428936384,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODkzNjM4NA==","user":{"login":"josevalim","id":9582,"node_id":"MDQ6VXNlcjk1ODI=","avatar_url":"https://avatars0.githubusercontent.com/u/9582?v=4","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2018-10-11T12:28:35Z","updated_at":"2018-10-11T12:28:35Z","author_association":"MEMBER","body":"The snippet you sent is not enough to reproduce the error, so I need a bigger snippet. :) A bit more of exmaple code would be great then!"}}
{"actor":{"display_login":"josevalim"}}