hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Sichi <>
Subject Re: insert data into a column of complex type
Date Fri, 24 Sep 2010 17:53:27 GMT
There are also undocumented "constructor" functions named map, struct, and array.  These instantiate
complex types directly:

hive> describe function map;
map(key0, value0, key1, value1...) - Creates a map with the given key/value pairs
hive> describe function struct;
struct(col1, col2, col3, ...) - Creates a struct with the given field values
Time taken: 0.072 seconds
hive> describe function array;
array(n0, n1...) - Creates an array with the given elements
Time taken: 0.071 seconds

I'll add them to the wiki.


On Sep 24, 2010, at 10:10 AM, Ning Zhang wrote:

Ping, you cannot insert complex type column by manually input the data. You'll need to have
the complex typed data stored in some file first (e.g., using Thrift serialization or Protocol
Buffers), and then load into the table.

Another option you have is to use JSON/XML to represent map. Hive has UDF/UDTF to support
extracting data from JSON/XML (json_object, json_tuple, xpath_string, xpath_int ...). hive>
show functions; and hive> desc <func_name> will give you more info about these UDFs.

On Sep 23, 2010, at 5:12 PM, Ping Zhu wrote:


  Can we insert data into a column of complex type (eg map type) through hive command line?
The only related article I can find is at
"The tables with columns that are an instance of a complex type can only be created programmatically
and NOT through hive command line at this time'''. We will be adding ability to add such tables
through the hive command line in the future. "

  Any new progress on this feature?

  Thanks for your information and help.


View raw message