private static void toOrcVectorized(VectorizedRowBatch batch, int rowInBatch, ResultSet resultSet) throws SQLException, IOException {
        ResultSetMetaData rsmd = resultSet.getMetaData();
        int columnCount = rsmd.getColumnCount();

        for (int i = 1; i <= columnCount; i++) {
            // VectorizedRowBatch index starts at 0
            int batchColIndex = i - 1;

            // Get data and check for null field
            Object field = resultSet.getObject(i);
            if (field == null) {
                batch.cols[batchColIndex].noNulls = false;
                batch.cols[batchColIndex].isNull[rowInBatch] = true;
            } else {

                switch (rsmd.getColumnType(i)) {
                    case Types.CHAR:
                    case Types.VARCHAR:
                    case Types.LONGVARCHAR:
                        setValueToBytesColumnVector(batch.cols[batchColIndex], rowInBatch, field);
                        break;
                    case Types.INTEGER:
                    case Types.TINYINT:
                    case Types.SMALLINT:
                        ((LongColumnVector) batch.cols[batchColIndex]).vector[rowInBatch] = (int) field;
                        break;
                    case Types.BIGINT:
                        ((LongColumnVector) batch.cols[batchColIndex]).vector[rowInBatch] = (long) field;
                        break;
                    case Types.NUMERIC:
                    case Types.DECIMAL:
                        BigDecimal decimalData = (BigDecimal) field;
                        ((DecimalColumnVector) batch.cols[batchColIndex]).vector[rowInBatch] = new HiveDecimalWritable(HiveDecimal.create(decimalData));
                        break;
                    case Types.DOUBLE:
                    case Types.FLOAT:
                        ((DoubleColumnVector) batch.cols[batchColIndex]).vector[rowInBatch] = (Double) field;
                        break;
                    case Types.DATE:
                        ((DateColumnVector) batch.cols[batchColIndex]).vector[rowInBatch] = ((Date) field).toLocalDate().toEpochDay();
                        break;
                    case Types.TIMESTAMP:
                    case Types.TIMESTAMP_WITH_TIMEZONE:
                    case -101:
                    case -102:
                        ((TimestampColumnVector) batch.cols[batchColIndex]).set(rowInBatch, resultSet.getTimestamp(i));
                        break;
                    case Types.BINARY:
                        setValueToBytesColumnVector(batch.cols[batchColIndex], rowInBatch, resultSet.getBytes(i));
                        break;
                    case Types.BLOB:
                        Blob blobData = resultSet.getBlob(i);
                        setValueToBytesColumnVector(batch.cols[batchColIndex], rowInBatch, IOUtils.toByteArray(blobData.getBinaryStream()));
                        blobData.free();
                        break;
                    case Types.CLOB:
                        Clob clobData = resultSet.getClob(i);
                        setValueToBytesColumnVector(batch.cols[batchColIndex], rowInBatch, IOUtils.toByteArray(clobData.getCharacterStream(), UTF_8));
                        clobData.free();
                        break;
                    case Types.BOOLEAN:
                    case Types.BIT: //postgres boolean
                        ((LongColumnVector) batch.cols[batchColIndex]).vector[rowInBatch] = resultSet.getBoolean(i) ? 1 : 0;
                        break;
                    case Types.SQLXML:
                        SQLXML sqlxmlData = resultSet.getSQLXML(i);
                        setValueToBytesColumnVector(batch.cols[batchColIndex], rowInBatch, IOUtils.toByteArray(sqlxmlData.getCharacterStream(), UTF_8));
                        sqlxmlData.free();
                        break;
                    case Types.ARRAY:
                        // Map Array to ListColumnVector
                        Array arrayData = resultSet.getArray(i);
                        ListColumnVector lcv = (ListColumnVector) batch.cols[batchColIndex];
                        // All arrays will be converted to String[] ["1837.3471930087544","1376.46154384128749"]
                        // Even multidimensional arrays ["[2168, 2174]","[3946, 1271]"] // Only in postgres
                        Object[] values = (Object[]) arrayData.getArray();
                        lcv.lengths[rowInBatch] = values.length;
                        lcv.offsets[rowInBatch] = lcv.childCount;
                        lcv.childCount = Math.toIntExact(lcv.lengths[rowInBatch]) ;
                        lcv.child.ensureSize(lcv.childCount, true);
                        for (int j = 0; j < values.length; j++) {
                            setValueToBytesColumnVector(lcv.child, (int) lcv.offsets[rowInBatch] + j, values[j]);
                        }
                        arrayData.free();
                        break;
//                case Types.STRUCT:
//                    schema.addField(rsmd.getColumnName(i), TypeDescription.createStruct());
//                    break;
                    default:
                        setValueToBytesColumnVector(batch.cols[batchColIndex], rowInBatch, resultSet.getString(i));
                        break;
                }
            }
        }

    }
Bind ResultSet values to the Orc VectorizedRowBatch

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