Flux - I can't aggregate responses using map() with condition if


I have an “action_type” column in which I have something like:
GET v1/service
GET v2/service
POST /service
POST /v2/messages
PUT v2/service

What I want is to create a pie chart that gives the % of action_type taking into account only the first word, that is, GET, POST and PUT. I’m using the map() function with an if condition but when I group it by action_type it gives the following error: invalid: runtime error @6:6-6:13: count: schema collision detected: column “_value” is both of type string and float

In the end, what I wanted was for only 60% GET, 30% POST and 10% PUT to appear, for example.

Here’s the query:
from(bucket: “my_db”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “${measurement}” and r[“environment”] =~ /^$environment$/)
|> map(fn: (r) => ({r with action_type: if r.action_type =~ /^GET/ then “GET” else if r.action_type =~ /^POST/ then “POST” else “PUT”}))
|> group(columns: [“action_type”])
|> count()
|> keep(columns: [“_value”, “action_type”])

Can anyone help me?