Skip to content

Support location output parsed as CSV#49

Merged
josevalim merged 1 commit intolivebook-dev:mainfrom
jjcarstens:support-newer-req
Nov 12, 2025
Merged

Support location output parsed as CSV#49
josevalim merged 1 commit intolivebook-dev:mainfrom
jjcarstens:support-newer-req

Conversation

@jjcarstens
Copy link
Contributor

Newer versions of Req will attempt to decode the body based on the path name if the content-type is application/octet-stream. Since this is being hardcoded to *-manifest.csv, that means it will be decoded and fail the String function calls that were previously used in ReqAthena.S3.get_locations/2.

This forces decode_body: false for this specific request since it is expected to only be a newline delineated string

** (FunctionClauseError) no function clause matching in String.trim/1    
    
    The following arguments were given to String.trim/1:
    
        # 1
        [
          ["s3://aws-athena-query-results-123456789-us-east-1/livebook-2025-11-11T23:22:22.360496Z/results/20251111_232223_00039_nn6z5_2c4ed47b-ac2b-49f2-bb95-09b610cad7e6"],
          ["s3://aws-athena-query-results-123456789-us-east-1/livebook-2025-11-11T23:22:22.360496Z/results/20251111_232223_00039_nn6z5_bc04f78f-c397-4cf8-a2f0-cc51a6b20337"]
        ]
    
    Attempted function clauses (showing 1 out of 1):
    
        def trim(string) when is_binary(string)
    
    (elixir 1.18.4) lib/string.ex:1321: String.trim/1
    (req_athena 0.3.0) lib/req_athena/s3.ex:12: ReqAthena.S3.get_locations/2
    (req_athena 0.3.0) lib/req_athena.ex:402: ReqAthena.fetch_and_build_dataframe/3
    (req_athena 0.3.0) lib/req_athena.ex:387: ReqAthena.get_explorer_result/2
    (req 0.5.16) lib/req/request.ex:1135: anonymous fn/2 in Req.Request.run_response/2
    (elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3
    (elixir 1.18.4) lib/enum.ex:2600: Enum.reduce_while/3
    iex:2: (file)

Newer versions of Req will attempt to decode the body based on the
path name if the content-type is `application/octet-stream`. Since
this is being hardcoded to `*-manifest.csv`, that means it will
be decoded and fail the `String` function calls that were previously
used in `ReqAthena.S3.get_locations/2`.

This forces `decode_body: false` for this specific request since it
is expected to only be a newline delineated string
@josevalim josevalim merged commit b2366ce into livebook-dev:main Nov 12, 2025
2 checks passed
@josevalim
Copy link
Contributor

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants