title: Write from a resultset to ORC file
body: <p>I am trying to write to an orc file from a resultset. Getting an error 
  java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.hadoop.hive.common.type.HiveVarchar
  I am trying to write without a map reduce job. </p>
  
  <pre><code>    final static OrcSerde serde = new OrcSerde();
      final Writer writer = OrcFile.createWriter(hdfs, OrcPath, conf, oi, stripeSize, CompressionKind.SNAPPY, compressBufferSize, rowIndexStride);
  
              final List&lt;Object&gt; record = new LinkedList&lt;&gt;();
              while (resultSet.next()) {
                  for (int column = 1; column &lt;= columnCount; ++column) {
                      switch (columnTypes[column]) {
                      case Types.BOOLEAN:
                          record.add(resultSet.getBoolean(column));
                          break;
                      case Types.CHAR:
                      case Types.VARCHAR:
                          record.add(resultSet.getString(column));
                          break;
                      case Types.SMALLINT:
                      case Types.INTEGER:
                          record.add(resultSet.getInt(column));
                          break;
                      case Types.BIGINT:
                          record.add(resultSet.getString(column));
                          break;
                      case Types.FLOAT:
                      case Types.DECIMAL:
                      case Types.DOUBLE:
                          record.add(resultSet.getDouble(column));
                          break;
                      default:
                          throw new RuntimeException
                      }
                      if (resultSet.wasNull()) {
                          record.remove(record.size());
                          record.add(null);
                      }
                  }
  
                  writer.addRow(record);
                }
              writer.close();
          }
  }
  </code></pre>