private static TypeDescription typeDescriptionFromResultSet(ResultSet resultSet) throws SQLException {
        TypeDescription schema = TypeDescription.createStruct();

        ResultSetMetaData rsmd = resultSet.getMetaData();
        int columnCount = rsmd.getColumnCount();

        for (int i = 1; i <= columnCount; i++) {
            //LOG.info("columnName: {}, columnTypeName: {}, CassName: {}, sql.Type:{}", rsmd.getColumnName(i), rsmd.getColumnTypeName(i),rsmd.getColumnClassName(i), rsmd.getColumnType(i) );
            switch (rsmd.getColumnType(i)) {
                case Types.CHAR:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createChar().withMaxLength(rsmd.getPrecision(i)));
                    break;
                case Types.VARCHAR:
                case Types.LONGVARCHAR:
                case Types.CLOB:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createString());
                    break;
                case Types.INTEGER:
                case Types.TINYINT:
                case Types.SMALLINT:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createInt());
                    break;
                case Types.BIGINT:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createLong());
                    break;
                case Types.NUMERIC:
                case Types.DECIMAL:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createDecimal());
                    break;
                case Types.DOUBLE:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createDouble());
                    break;
                case Types.FLOAT:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createFloat());
                    break;
                case Types.DATE:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createDate());
                    break;
                case Types.TIMESTAMP:
                case Types.TIMESTAMP_WITH_TIMEZONE:
                case -101:
                case -102:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createTimestamp());
                    break;
                case Types.BINARY:
                case Types.BLOB:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createBinary());
                    break;
                case Types.BOOLEAN:
                case -7: //postgres boolean
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createBoolean());
                    break;
                case Types.ARRAY:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createList(TypeDescription.createString()));
                    break;
//                case Types.STRUCT:
//                    schema.addField(rsmd.getColumnName(i), TypeDescription.createStruct());
//                    break;
                default:
                    schema.addField(rsmd.getColumnName(i), TypeDescription.createString());
                    break;
            }
        }
        return schema;
    }
Creates new TypeDescription (ORC schema) from JDBC ResultSet

@param resultSet
@return
src/main/java/org/replicadb/manager/file/OrcFileManager.java