title: Hive - Join on map data type column
body: <pre><code> table 1 - 
  
      name bal map&lt;String,String&gt; year   
  
      abc 24000   {car : honda, company : boa} 2015
      ac 21000  { car:honda} 2015
      def 23000 {car:honda, company: boa} 2015
      abc 21000   {car : honda, company : boa} 2014
      ac 20000  { car:honda} 2014
      def 22000 {car:honda, company: boa} 2014
  
          Required Output after self join -  
  
          name bal-difference map&lt;String,String&gt; 
          abc 3000 {car : honda, company : boa} 
          ac 1000 { car:honda} 
          def 1000 {car:honda, company: boa} 
  
  
  
      select 
      t1.name,t1.mapColumn,(t1.bal-t2.bal)
      FROM  table1 t1 JOIN table1 t2 
      ON t1.mapColumn = t2.mapColumn and t1.name = t2.name
  </code></pre>
  
  <p>I want to perform self join on table on map column and name in hive. So that i can perform difference of balance as seen in example output.</p>
  
  <p>I tried join but it is not giving required columns. I want to understand how join works on complex datatypes(in my case map).</p>