<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question How can i convert location field into 2 fields in Hive and how to store in hive Table   ? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216677#M178586</link>
    <description>&lt;P&gt;Hi ,&lt;BR /&gt;I need to convert the location fields into 2 fields based on "=" , Means folder location in one column and partition details in another column&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;current scenario :&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;
 
 &lt;TBODY&gt;&lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;&lt;/TD&gt;
  &lt;TD&gt;&lt;STRONG&gt;Partion Fields&lt;/STRONG&gt;&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;required scenario :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;
 
 &lt;TBODY&gt;&lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;&lt;/TD&gt;
  &lt;TD&gt;&lt;STRONG&gt;Partion Fields&lt;/STRONG&gt;&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;hdfs://servername/sds/sds/erg/&lt;/STRONG&gt;&lt;/TD&gt;
  &lt;TD&gt;&lt;STRONG&gt;rownum=123/columnnumber=456&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Can you please help on this..!!!&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance..!!&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jun 2018 17:02:54 GMT</pubDate>
    <dc:creator>nittala999</dc:creator>
    <dc:date>2018-06-07T17:02:54Z</dc:date>
    <item>
      <title>How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216677#M178586</link>
      <description>&lt;P&gt;Hi ,&lt;BR /&gt;I need to convert the location fields into 2 fields based on "=" , Means folder location in one column and partition details in another column&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;current scenario :&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;
 
 &lt;TBODY&gt;&lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;&lt;/TD&gt;
  &lt;TD&gt;&lt;STRONG&gt;Partion Fields&lt;/STRONG&gt;&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;required scenario :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;
 
 &lt;TBODY&gt;&lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;&lt;/TD&gt;
  &lt;TD&gt;&lt;STRONG&gt;Partion Fields&lt;/STRONG&gt;&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;&lt;STRONG&gt;hdfs://servername/sds/sds/erg/&lt;/STRONG&gt;&lt;/TD&gt;
  &lt;TD&gt;&lt;STRONG&gt;rownum=123/columnnumber=456&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Can you please help on this..!!!&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance..!!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:02:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216677#M178586</guid>
      <dc:creator>nittala999</dc:creator>
      <dc:date>2018-06-07T17:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216678#M178587</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/68258/nittala999.html" nodeid="68258"&gt;@Satya Nittala&lt;/A&gt;&lt;P&gt;Use hive &lt;STRONG&gt;Substr function&lt;/STRONG&gt; and specify &lt;STRONG&gt;start/end position&lt;/STRONG&gt; that you needed for each field &lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select substr('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',0,30) Location, substr('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',31) PartionFields;
+---------------------------------+------------------------------+--+
|            location             |        partionfields         |
+---------------------------------+------------------------------+--+
| hdfs://servername/sds/sds/erg/  | rownum=123/columnnumber=456  |
+---------------------------------+------------------------------+--+&lt;/PRE&gt;&lt;P&gt;Please refer to &lt;A href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-StringFunctions" target="_blank"&gt;this&lt;/A&gt; link for more details regarding hive string functions documentation.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;If the Answer helped to resolve your issue, &lt;STRONG&gt;Click on Accept button below to accept the answer,&lt;/STRONG&gt; That would be great help to Community users to find solution quickly for these kind of issues.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:22:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216678#M178587</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-07T17:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216679#M178588</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; Thanks for Quick response&lt;/P&gt;&lt;P&gt;I had total 10 Lakh records like that , with different data and different string length&lt;/P&gt;&lt;P&gt;Above mentioned code only satisfying with that one record only&lt;/P&gt;&lt;P&gt;I need a generic code for all data , It should satisfy with all records, &lt;/P&gt;&lt;P&gt;Can u please suggest..!!!&lt;/P&gt;&lt;P&gt;Thanks in advance..!!!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 18:52:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216679#M178588</guid>
      <dc:creator>nittala999</dc:creator>
      <dc:date>2018-06-07T18:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216680#M178589</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/68258/nittala999.html" nodeid="68258"&gt;@Satya Nittala&lt;/A&gt;&lt;P&gt;Please add some sample records with different string lengths, so that we can prepare the query that satisfies them.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 19:39:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216680#M178589</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-07T19:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216681#M178590</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Please find the below sample data&lt;/P&gt;&lt;TABLE&gt;
 &lt;TBODY&gt;&lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/meta/data/ccdp/rownum=123/columnnumber=456&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/calims/notes/ccdp/meta/mgntrownum=123/columnnumber=456&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/calims/notes/ccdp/meta/mgnt/lo/rownum=123/columnnumber=456&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/calims/notes/ccdp/meta/mgnt/lo/ap/rownum=123/columnnumber=456&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Length is getting increasing for location , so how can we convert based on "="  sign&lt;/P&gt;&lt;P&gt;Can u please suggest..!!!&lt;/P&gt;&lt;P&gt;Thanks in advance..!!!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 21:58:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216681#M178590</guid>
      <dc:creator>nittala999</dc:creator>
      <dc:date>2018-06-07T21:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216682#M178591</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/68258/nittala999.html" nodeid="68258"&gt;@Satya Nittala&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Thanks for the sample records..!! &lt;/P&gt;&lt;P&gt;One thing i commonly observed pattern is second from the last / after you need that to be in partitionfields column 
before second from last / needs to be in location column.
Split based on = will not give the desired results but split on rownum= will satisfies.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Using Regexp_extract function:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.using rownum= matching and extracting&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select regexp_extract('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',"(.*)(rownum=.*)",1) Location,regexp_extract('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',"(.*)(rownum=.*)",2) partitionfields;
+---------------------------------+------------------------------+--+
|            location             |       partitionfields        |
+---------------------------------+------------------------------+--+
| hdfs://servername/sds/sds/erg/  | rownum=123/columnnumber=456  |
+---------------------------------+------------------------------+--+
&amp;lt;br&amp;gt;&lt;/PRE&gt;&lt;P&gt;2.Using forward slashes and extracting&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select regexp_extract('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',"(.*(?:\\/))(.*(?:\\/).*)",1) Location,regexp_extract('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',"(.*(?:\\/))(.*(?:\\/).*)",2) partitionfields;
+---------------------------------+------------------------------+--+
|            location             |       partitionfields        |
+---------------------------------+------------------------------+--+
| hdfs://servername/sds/sds/erg/  | rownum=123/columnnumber=456  |
+---------------------------------+------------------------------+--+
&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Using Split Function:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1.Split the string based on rownum=&lt;/P&gt;&lt;P&gt;as we are doing &lt;STRONG&gt;split on rownum=&lt;/STRONG&gt; so we are going to miss the &lt;STRONG&gt;rownum= in partitionfields&lt;/STRONG&gt; data we need to &lt;STRONG&gt;concat rownum=&lt;/STRONG&gt; to get the correct data in partitionfields column.&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select split('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',"rownum=")[0] Location,concat('rownum=',split('hdfs://servername/sds/sds/erg/rownum=123/columnnumber=456',"rownum=")[1]) partitionfields;
+---------------------------------+------------------------------+--+
|            location             |       partitionfields        |
+---------------------------------+------------------------------+--+
| hdfs://servername/sds/sds/erg/  | rownum=123/columnnumber=456  |
+---------------------------------+------------------------------+--+
&lt;/PRE&gt;&lt;P&gt;Use the any of the above functions which best fits for your case if you still want to split on = then tweak the above regexp_extract (or) split functions to get the desired results. &lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 19:13:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216682#M178591</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-08T19:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216683#M178592</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; , Thanks for your quick Suggestions &lt;/P&gt;&lt;P&gt;Mentioned function is only work if location field is having "rownum="&lt;/P&gt;&lt;P&gt;i had a data without "rownum="&lt;/P&gt;&lt;TABLE&gt;
 &lt;TBODY&gt;&lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/tabledata=456/size=123/length=456&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/meta/data/ccdp/hive
  _table=test/size=123/length=456&lt;/TD&gt;
 &lt;/TR&gt;
 &lt;TR&gt;
  &lt;TD&gt;hdfs://servername/sds/sds/erg/calims/notes/ccdp/meta/mgnt/work_space=895/rownum=123/columnnumber=456&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG&gt;2.Using forward slashes and extracting  method &lt;/STRONG&gt;also not working if location fields changes with different data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Like this this records many or there with different variables using for partitioning , I need partitioning fields in the another column  , Starting  '=" fields in the partition columns&lt;/P&gt;&lt;P&gt;Can you please help on this ..!!!&lt;/P&gt;&lt;P&gt;Thanks in advance...!!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 11:40:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216683#M178592</guid>
      <dc:creator>nittala999</dc:creator>
      <dc:date>2018-06-12T11:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216684#M178593</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt; Please find the Sample data&lt;/P&gt;&lt;P&gt;hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt=20170303                               
 hdfs://eualty/lob/bi/publish/ccdp/v1/pub/gss_attribute_details_pub/load_dt=20170322                               
 hdfs://Test/lob/ebia/source/ebia/ccdp_genesys_fmr_router_core/load_date=2018-04-29                       
 hdfs://eualty/lob/bi/source/ebia/ccdp_genesys_fmr_router_core/load_date=2018-04-30                       
 hdfs://Test/lob/ebia/publish/ebia/interaction_fact_core/load_date=2017-12-16                             
 hdfs://Test/lob/ebia/publish/ccdp/v1/core/interaction_fact_core/load_date=2017-12-21                             
 hdfs://eualty/lob/bi/publish/ccdp/v1/pub/task_event_details_pub/load_date=2018-04-26/historical_intraday_record=I 
 hdfs://Test/lob/bi/publish/pi/v1/pub/task_event_details_pub/load_date=2018-05-22/historical_intraday_record=I 
 hdfs://eualty/lob/ebia/publish/bi/avaya_call_details_pub/year=2018/quarter=1/month=1                       
 hdfs://eualty/lob/bi/publish/ebia/avaya_call_details_pub/year=2017/quarter=4/month=11                     
 hdfs://Test/lob/ebia/project/pi/avaya_call_details_pub/year=2018/quarter=1/month=3                       
 hdfs://Test/lob/bi/project/bi/avaya_call_details_pub/year=2017/quarter=3/month=8                       
 hdfs://eualty/lob/ebia/project/ebia/avaya_call_details_pub/year=2018/quarter=2/month=5   &lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:13:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216684#M178593</guid>
      <dc:creator>nittala999</dc:creator>
      <dc:date>2018-06-13T20:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can i convert location field into 2 fields in Hive and how to store in hive Table   ?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216685#M178594</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/68258/nittala999.html" nodeid="68258"&gt;@Satya Nittala&lt;/A&gt;&lt;P&gt;As the data is not in the consistent format i have 2 step method to populate field values correctly.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Step1:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Create an temporary table to store this intermediate step data&lt;BR /&gt;Split the data on = character and populate the data&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select split('hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt=20170303',"=")[0] Location,split('hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt=20170303',"=")[1] partitionfields;
+-----------------------------------------------------------------+------------------+--+
|                            location                             | partitionfields  |
+-----------------------------------------------------------------+------------------+--+
| hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt  | 20170303         |
+-----------------------------------------------------------------+------------------+--+

&lt;/PRE&gt;&lt;P&gt;We are still missing load_dt in partitionfields column data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Step2:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;select from temporary table data and insert into final table&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select regexp_extract("hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt","(.*)\\/",1) location,concat_ws("=",reverse(split(reverse('hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt'), '/')[0]),"partitionfields") partitionfields;
+---------------------------------------------------------+--------------------------+--+
|                        location                         |     partitionfields      |
+---------------------------------------------------------+--------------------------+--+
| hdfs://Test/lob/ebia/publish/gss_attribute_details_pub  | load_dt=partitionfields  |
+---------------------------------------------------------+--------------------------+--+
&lt;/PRE&gt;&lt;P&gt;In step2 first i'm extracting only data before last / i.e after / the data needs to go to partitionfields column, and by using concat_ws i'm joining partitionfields column data and using reverse function with split on / then extracting [0] position value, concatenating with partitionfields value.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;By using two regular expression extracts to prepare the actual final data for the columns&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select regexp_extract("hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt","(.*)\\/",1) location,concat_ws("=",regexp_extract('hdfs://Test/lob/ebia/publish/gss_attribute_details_pub/load_dt', '(.*)\/(.*)',2),"partitionfields") partitionfields;
+---------------------------------------------------------+--------------------------+--+
|                        location                         |     partitionfields      |
+---------------------------------------------------------+--------------------------+--+
| hdfs://Test/lob/ebia/publish/gss_attribute_details_pub  | load_dt=partitionfields  |
+---------------------------------------------------------+--------------------------+--+&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I hope this will work for your case correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 10:11:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-can-i-convert-location-field-into-2-fields-in-Hive-and/m-p/216685#M178594</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-14T10:11:32Z</dc:date>
    </item>
  </channel>
</rss>

