You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Dilip Joseph <di...@gmail.com> on 2010/03/20 02:07:46 UTC
delimiters for nested structures
Hello,
What are the delimiters for data to be loaded into a table with nested
arrays, structs, maps etc? For example:
CREATE TABLE nested ( s1 STRUCT<name:STRING, age: INT>,
a1 ARRAY<STRUCT<x:INT, y:INT>>,
b1 MAP<STRING, ARRAY<INT>>
)
Should I write a custom SerDe for this?
Thank you,
Dilip
Re: delimiters for nested structures
Posted by Zheng Shao <zs...@gmail.com>.
Multiple-level of delimiters works as the following by default:
The first level (fields delimiters) will be \001 (^A, ascii code 1).
Each level of struct and array take an additional field delimitor
following (\002, etc). Each level of map takes 2 levels of additional
field deimitor.
So it will be:
s1.name ^B s1.age ^A a1[0].x ^C a2[0].y ^B a1[1].x ^C a2[1].y ^A
b1.key1 ^C b1.value1[0] ^D b1.value1[1] ^B b1.key2 ^C b1.value2[0] ^D
b1.value2[1]
Zheng
On Fri, Mar 19, 2010 at 6:07 PM, Dilip Joseph
<di...@gmail.com> wrote:
> Hello,
>
> What are the delimiters for data to be loaded into a table with nested
> arrays, structs, maps etc? For example:
>
> CREATE TABLE nested ( s1 STRUCT<name:STRING, age: INT>,
> a1 ARRAY<STRUCT<x:INT, y:INT>>,
> b1 MAP<STRING, ARRAY<INT>>
> )
>
> Should I write a custom SerDe for this?
>
> Thank you,
>
> Dilip
>
--
Yours,
Zheng