title: How do you insert data into complex data type “Struct” in Hive 2
body: <p>This is the structure of the table</p>
  
  <pre><code>CREATE TABLE warehouse (
   time timestamp, 
   person struct&lt;id : int, name: string, organization : string&gt;, 
   activity struct&lt;id : int, name: string&gt;, 
   case struct&lt;id : int, name: string, organization : string&gt;
  );
  </code></pre>
  
  <p>The table is created without problems, the problem is how to insert data into that table. I was trying something like this but it does not work</p>
  
  <pre><code>INSERT INTO TABLE warehouse VALUES('2018-05-31'),
  SELECT NAMED_STRUCT('id', 1, 'name', 'Alex', 'organization', 'CITI') AS person,
  SELECT NAMED_STRUCT('id', 1, 'name', 'Buy') AS activity,
  SELECT NAMED_STRUCT('id', 1, 'name', 'Gold', 'organization', 'London') AS case
  FROM case 
  </code></pre>
  
  <p>The case, activity and person tables already exist and have the structure shown in the select. </p>