title: creating external table from compressed (gz format) files without selecting all fields
body: <p>I have gz files in a folder. I need only 3 columns from these files, but each line has over 100 of them. At the moment I create a view this way.</p>
  
  <pre><code>drop table MAK_CHARGE_RCR;
  create external table MAK_CHARGE_RCR
  (LINE string)
  STORED as SEQUENCEFILE
  LOCATION '/apps/hive/warehouse/mydb.db/file_rcr';
  
  drop view VW_MAK_CHARGE_RCR;
  create view VW_MAK_CHARGE_RCR as
  Select LINE[57] as CREATE_DATE, LINE[64] as SUBS_KEY, LINE[63] as RC_TERM_NAME 
  from
      (Select split(LINE, '\\|') as LINE
      from MAK_CHARGE_RCR) a;
  </code></pre>
  
  <p>The view has the fields I need. Now I have to do the same, but without CTAS and I am not sure how to go about it. What can I do?</p>
  
  <p>I was told the table must look like this </p>
  
  <pre><code>create external table MAK_CHARGE_RCR
  (CREATE_DATE string, SUBS_KEY string, RC_TERM_NAME etc)
  </code></pre>
  
  <p>I could split the line like this </p>
  
  <pre><code>ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '\\|'
  </code></pre>
  
  <p>but I'll need to list every column. I have another group of files with over 1000 columns. All of them I'll need to list. This just seems a bit excessive, so I wondered if it is possible to do</p>
  
  <pre><code>create external table arstel.MAK_CHARGE_RCR
  (split(LINE, '\\|')[57] string,
  split(LINE, '\\|')[64] string
  etc)
  </code></pre>
  
  <p>This doesn't work obviously, but maybe there are work arounds?</p>