{"action":"opened","issue":{"url":"https://api.github.com/repos/beatrichartz/csv/issues/14","labels_url":"https://api.github.com/repos/beatrichartz/csv/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/beatrichartz/csv/issues/14/comments","events_url":"https://api.github.com/repos/beatrichartz/csv/issues/14/events","html_url":"https://github.com/beatrichartz/csv/issues/14","id":104501321,"number":14,"title":"Calling `decode` with `num_pipes: 1` multiple times on the same stream yields different orderings each time","user":{"login":"adamesque","id":134433,"avatar_url":"https://avatars.githubusercontent.com/u/134433?v=3","gravatar_id":"","url":"https://api.github.com/users/adamesque","html_url":"https://github.com/adamesque","followers_url":"https://api.github.com/users/adamesque/followers","following_url":"https://api.github.com/users/adamesque/following{/other_user}","gists_url":"https://api.github.com/users/adamesque/gists{/gist_id}","starred_url":"https://api.github.com/users/adamesque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamesque/subscriptions","organizations_url":"https://api.github.com/users/adamesque/orgs","repos_url":"https://api.github.com/users/adamesque/repos","events_url":"https://api.github.com/users/adamesque/events{/privacy}","received_events_url":"https://api.github.com/users/adamesque/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-02T15:03:34Z","updated_at":"2015-09-02T15:03:34Z","closed_at":null,"body":"I'm noticing some weird stuff happening with the decoder when I call it multiple times in an IEx session.\r\n\r\nGiven a file `my_file.csv` with ~200 lines, doing\r\n```elixir\r\nFile.stream!(\"my_file.csv\") |> CSV.Decoder.decode(num_pipes: 1) |> Enum.take(2)\r\n```\r\nyields the first 2 lines of the file the first time I run it, but subsequent invocations yield seemingly random / out-of-order lines.\r\n\r\nI also get strange behavior when working with a simple stream (although I'm not able to reproduce the ordering issue):\r\n```elixir\r\niex(1)> stream = ~w(1,2,3,4 5,6,7,8 9,10,11,12 13,14,15,16) |> Stream.map(&(&1))\r\n#Stream<[enum: [\"1,2,3,4\", \"5,6,7,8\"],\r\n funs: [#Function<45.113986093/1 in Stream.map/2>]]>\r\niex(2)> stream |> Enum.take(2)\r\n[\"1,2,3,4\", \"5,6,7,8\"]\r\niex(3)> stream |> Enum.take(2)\r\n[\"1,2,3,4\", \"5,6,7,8\"]\r\niex(4)> CSV.Decoder.decode(stream, num_pipes: 1) |> Enum.take(2)\r\n#Function<25.113986093/2 in Stream.resource/3>\r\niex(5)> CSV.Decoder.decode(stream, num_pipes: 1) |> Enum.take(2)\r\n[[\"1\", \"2\", \"3\", \"4\"], [\"5\", \"6\", \"7\", \"8\"]]\r\niex(6)> CSV.Decoder.decode(stream, num_pipes: 1) |> Enum.take(2)\r\n[]\r\niex(7)> CSV.Decoder.decode(stream, num_pipes: 1) |> Enum.take(2)\r\n[[\"1\", \"2\", \"3\", \"4\"], [\"5\", \"6\", \"7\", \"8\"]]\r\niex(8)> CSV.Decoder.decode(stream, num_pipes: 1) |> Enum.take(2)\r\n[]\r\n```"}}