@Override
  public org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter getHiveRecordWriter(
      JobConf jc, Path finalOutPath, Class<? extends Writable> valueClass,
      boolean isCompressed, Properties tableProperties, Progressable progress) throws IOException {

    String[] cols = null;
    String columns = tableProperties.getProperty(serdeConstants.LIST_COLUMNS);
    if (columns == null || columns.trim().equals("")) {
      cols = new String[0];
    } else {
      cols = StringUtils.split(columns, ",");
    }

    RCFileOutputFormat.setColumnNumber(jc, cols.length);
    final RCFile.Writer outWriter = Utilities.createRCFileWriter(jc,
    finalOutPath.getFileSystem(jc), finalOutPath, isCompressed, progress);

    return new org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter() {
      @Override
      public void write(Writable r) throws IOException {
        outWriter.append(r);
      }

      @Override
      public void close(boolean abort) throws IOException {
        outWriter.close();
      }
    };
  }
create the final out file.

@param jc
         the job configuration file
@param finalOutPath
         the final output file to be created
@param valueClass
         the value class used for create
@param isCompressed
         whether the content is compressed or not
@param tableProperties
         the tableInfo of this file's corresponding table
@param progress
         progress used for status report
@throws IOException
ql/src/java/org/apache/hadoop/hive/ql/io/RCFileOutputFormat.java