title: Impala - First date of Month from string date
body: <p>I have column data_as_of_daily_date (Data type String) in my source table (staging) and I need to find out First date of Month based on source table column in Impala and load it into target table having column FIRST_DAY_OF_MONTH (String type).</p>
  
  <p>Source table:</p>
  
  <pre><code>+--------------------+
  data_as_of_daily_date
  +--------------------+
  +20181217            +
  +20181115            +
  </code></pre>
  
  <p>I am running below query:</p>
  
  <pre><code>SELECT 
        DATE_ADD(FROM_UNIXTIME(UNIX_TIMESTAMP(DATA_AS_OF_DAILY_DATE, 'yyyyMMdd')), 1 - DAY(FROM_UNIXTIME(UNIX_TIMESTAMP(DATA_AS_OF_DAILY_DATE, 'yyyyMMdd')))) AS FIRST_DAY_OF_MONTH
  FROM TABLE;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>+--------------------+
  AS FIRST_DAY_OF_MONTH
  +--------------------+
  +2018-12-01 00:00:00 +
  +2018-11-01 00:00:00 +
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>+--------------------+
  AS FIRST_DAY_OF_MONTH
  +--------------------+
  +20181201            +
  +20181101            +
  </code></pre>