Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Question regarding nested complex data type


Copy link to this message
-
Question regarding nested complex data type
Hi All,

I have 2 questions about complex data types in nested composition.

1 >> I did not find a way to provide delimiter information in DDL if one or
more column has nested array/struct. In this case, default delimiter has to
be used for complex type column.
Please let me know if this is a limitation as of now or I am missing
something.

e.g.:
*DDL*:
hive> create table example(col1 int, col2
array<struct<st1:int,st2:string>>) row format delimited fields terminated
by ',';
OK
Time taken: 0.226 seconds

*Sample data loaded:*
1,1^Cstring1^B2^Cstring2

*O/P:*
hive> select * from example;
OK
1    [{"st1":1,"st2":"string1"},{"st1":2,"st2":"string2"}]
Time taken: 0.288 seconds

2 >> For the same DDL given above, if we provide clause* collection items
terminated by '|' *and still use default delimiters (since there is no way
to use given delimiter '|') then the select query shows incorrect data.
Please let me know if this is something expected.

e.g.
*DDL*:
hive> create table example(col1 int, col2
array<struct<st1:int,st2:string>>) row format delimited fields terminated
by ',' collection items terminated by '|';
OK
Time taken: 0.175 seconds

*Sample data loaded:*
1,1^Cstring1^B2^Cstring2

*O/P:
*hive> select * from
example;

OK
1    [{"st1":1,"st2":"string1\u00022"}]
Time taken: 0.141 seconds
**
Thanks & Regards.
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB