<?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 Re: Getting Null after extracting data from HDFS in Hive? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226030#M63655</link>
    <description>&lt;P&gt;Thank you &lt;A rel="user" href="https://community.cloudera.com/users/15382/andreskoitmae.html" nodeid="15382"&gt;@Andres Koitmäe&lt;/A&gt; for your quick reply.&lt;/P&gt;&lt;P&gt;I updated my query with the regex you mentioned, but still, I'm getting it as &lt;STRONG&gt;null. &lt;/STRONG&gt;Is that the normal behavior when I search in with a &lt;STRONG&gt;SELECT &lt;/STRONG&gt;query after executing the hive query?&lt;/P&gt;&lt;P&gt;To make sure that I've made the correct changes I'm pasting the hive query here again:&lt;/P&gt;&lt;PRE&gt;CREATE EXTERNAL TABLE LogParserSample(
logtype STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' 
WITH SERDEPROPERTIES (
 'input.regex' = '^[^0-9]+'
) 
STORED AS TEXTFILE
LOCATION '/mypath/';&lt;/PRE&gt;&lt;P&gt;Thanks again. &lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2017 11:32:40 GMT</pubDate>
    <dc:creator>kulasangar91</dc:creator>
    <dc:date>2017-06-27T11:32:40Z</dc:date>
    <item>
      <title>Getting Null after extracting data from HDFS in Hive?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226028#M63653</link>
      <description>&lt;P&gt;I'm still a noob in this world, so bare with me if there are any misconceptions.&lt;/P&gt;&lt;P&gt;What have I done so far is, I've setup Hadoop and Hive in my linux enviroment and I'm trying to extract data from an HDFS file into my Hive table.&lt;/P&gt;&lt;P&gt;This is how the log line looks like:&lt;/P&gt;&lt;PRE&gt; apache2013-10-09T14:04:32Zphp129.124.201.110/EKEE.php20019705910Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24&lt;/PRE&gt;&lt;P&gt;This my Hive query:&lt;/P&gt;&lt;PRE&gt;CREATE EXTERNAL TABLE LogParserSample(
logtype STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' 
WITH SERDEPROPERTIES (
 'input.regex' = '^([\w\-]+)'
) 
STORED AS TEXTFILE
LOCATION '/mypath/';&lt;/PRE&gt;&lt;P&gt;When I did execute the above the table got created successfully. But then when I tried to query the data from that table using a &lt;STRONG&gt;SELECT  &lt;/STRONG&gt;statement, I'm getting &lt;STRONG&gt;null &lt;/STRONG&gt;instead of the word &lt;STRONG&gt;apache. &lt;/STRONG&gt;For this instance, I'm trying to extract the word apache from the above log line. But then I tried executing the same &lt;STRONG&gt;regex &lt;/STRONG&gt;in &lt;A href="http://rubular.com/"&gt;rubular&lt;/A&gt;, the outcome was correct as I expected. I'm unable to figure out why!&lt;/P&gt;&lt;P&gt;Have I missed anything trivial above? Any help could be appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 20:37:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226028#M63653</guid>
      <dc:creator>kulasangar91</dc:creator>
      <dc:date>2017-06-26T20:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Null after extracting data from HDFS in Hive?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226029#M63654</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/19203/kulasangar91.html" nodeid="19203"&gt;@Kulasangar Gowrisangar&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It seems that you regexp pattern is not correct. Try this one ^[^0-9]+&lt;/P&gt;&lt;P&gt;If you need more help with regular expressions I recommend this site &lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This pattern starts from the beginning of the string and then is looking for any character except numbers. With your example row the result is string "apache".&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 21:34:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226029#M63654</guid>
      <dc:creator>andres_koitmae</dc:creator>
      <dc:date>2017-06-26T21:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Null after extracting data from HDFS in Hive?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226030#M63655</link>
      <description>&lt;P&gt;Thank you &lt;A rel="user" href="https://community.cloudera.com/users/15382/andreskoitmae.html" nodeid="15382"&gt;@Andres Koitmäe&lt;/A&gt; for your quick reply.&lt;/P&gt;&lt;P&gt;I updated my query with the regex you mentioned, but still, I'm getting it as &lt;STRONG&gt;null. &lt;/STRONG&gt;Is that the normal behavior when I search in with a &lt;STRONG&gt;SELECT &lt;/STRONG&gt;query after executing the hive query?&lt;/P&gt;&lt;P&gt;To make sure that I've made the correct changes I'm pasting the hive query here again:&lt;/P&gt;&lt;PRE&gt;CREATE EXTERNAL TABLE LogParserSample(
logtype STRING)
ROW FORMAT SERDE 'org.apache.hadoop.hive.contrib.serde2.RegexSerDe' 
WITH SERDEPROPERTIES (
 'input.regex' = '^[^0-9]+'
) 
STORED AS TEXTFILE
LOCATION '/mypath/';&lt;/PRE&gt;&lt;P&gt;Thanks again. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 11:32:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226030#M63655</guid>
      <dc:creator>kulasangar91</dc:creator>
      <dc:date>2017-06-27T11:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Null after extracting data from HDFS in Hive?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226031#M63656</link>
      <description>&lt;P&gt;Changing the regex to below worked for me:&lt;/P&gt;&lt;PRE&gt;^([^0-9]+).*&lt;/PRE&gt;&lt;P&gt;Hope it helps! &lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 13:48:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-Null-after-extracting-data-from-HDFS-in-Hive/m-p/226031#M63656</guid>
      <dc:creator>kulasangar91</dc:creator>
      <dc:date>2017-06-27T13:48:09Z</dc:date>
    </item>
  </channel>
</rss>

