HIVE: cannot recognize input near 'distinct' '('
<p>I am trying to execute the below query in Hive:</p>

<pre><code>SELECT
  regexp_replace('2016-08-05_11:29:46', '\\_', ' ') as tmstmp,
  distinct(P.name)
FROM table P;
</code></pre>

<p>It throws an exception saying cannot recognize input near 'distinct' '(' 'P' in selection target.</p>

<p>where as when I run the query interchanging the columns like:</p>

<pre><code>SELECT
  distinct(P.name),
  regexp_replace('2016-08-05_11:29:46', '\\_', ' ') as tmstmp
FROM table P;
</code></pre>

<p>It works fine. Any idea on the issue ?</p>