hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Swagatika Tripathy <swagatikat...@gmail.com>
Subject Re: Cannot convert column 2 from string to map<string,string> error
Date Thu, 03 Mar 2016 13:07:18 GMT
Hi Buntu,
Since the attribute attrs is of type MAP,So, you need to do it something
like:
 insert into tmp_table values ( 'src1', 'uid1',map("NULL","NULL").

Let me know if it works.



On Tue, Mar 1, 2016 at 5:06 AM, Buntu Dev <buntudev@gmail.com> wrote:

> When attempting to insert null value into a map<string,string> column
> type, I run into this error:
>
> Cannot convert column 2 from string to map<string,string>
>
>
> Here is my Avro schema and the table definition:
>
> ~~~~~~~~~~~~~~~~
> "fields": [
>         {"name": "src", "type": ["null", "string"], "default": null},
>         {"name": "uid", "type": ["null", "string"], "default": null},
>         {"name": "attrs", "type": {"type": "map", "values": ["null",
> "string"]}, "default": null},
> ...
> ]
>
>
> > desc tmp_table;
>
> +--------------------------+-----------------------+-----------------------+--+
> |         col_name         |       data_type       |        comment
>  |
>
> +--------------------------+-----------------------+-----------------------+--+
> | src                | bigint                | from deserializer     |
> | uid                  | int                   | from deserializer     |
> | attrs                | map<string,string>    | from deserializer   |
> ....
> ...
> ~~~~~~~~~~~~~~~~
>
> If I run this INSERT INTO, I get the error message mentioned:
>
>  insert into tmp_table values ( 'src1', 'uid1', null);
>
> Is there some way I can fix this issue?
>
>
>
> Thanks!
>
>
>
>
>

Mime
View raw message