Re: spark udf can not change a json string to a map

2016-05-18 Thread Ted Yu
Please take a look at JavaUtils#mapAsSerializableJavaMap FYI On Mon, May 16, 2016 at 3:24 AM, 喜之郎 <251922...@qq.com> wrote: > > hi, Ted. > I found a built-in function called str_to_map, which can transform string > to map. > But it can not meet my need. > > Because my string is maybe a map with

?????? spark udf can not change a json string to a map

2016-05-16 Thread ??????
hi, Ted. I found a built-in function called str_to_map, which can transform string to map. But it can not meet my need. Because my string is maybe a map with a array nested in its value. for example, map. I think it can not work fine in my situation. Cheers

?????? spark udf can not change a json string to a map

2016-05-15 Thread ??????
this is my usecase: Another system upload csv files to my system. In csv files, there are complicated data types such as map. In order to express complicated data types and ordinary string having special characters?? we put urlencoded string in csv files. So we use urlencoded json string to

Re: spark udf can not change a json string to a map

2016-05-15 Thread Ted Yu
Can you let us know more about your use case ? I wonder if you can structure your udf by not returning Map. Cheers On Sun, May 15, 2016 at 9:18 AM, 喜之郎 <251922...@qq.com> wrote: > Hi, all. I want to implement a udf which is used to change a json string > to a map. > But some

spark udf can not change a json string to a map

2016-05-15 Thread ??????
Hi, all. I want to implement a udf which is used to change a json string to a map. But some problem occurs. My spark version:1.5.1. my udf code: public Map evaluate(final String s) { if (s == null)