When I am using case when
to trans string to float data, it can not get a correct response.
The SQL is right here:
- input:
one_data
is a map where with key and value - output: get the right value into float value.
SQL:
select
case
when one_data["name1"] is not null
then cast(one_data["name1"] as float)
else 0.0
end as name1_value
When I run it, I get a negative value like this:
one_data["name1"]="123"
name1_value = -123
What is the right answer to use SQL