public static PrestoSparkRowBatchBuilder builder(int partitionCount, int targetAverageRowSizeInBytes)
    {
        checkArgument(partitionCount > 0, "partitionCount must be greater then zero: %s", partitionCount);
        int targetSizeInBytes = partitionCount * targetAverageRowSizeInBytes;
        targetSizeInBytes = max(targetSizeInBytes, MIN_TARGET_SIZE_IN_BYTES);
        targetSizeInBytes = min(targetSizeInBytes, MAX_TARGET_SIZE_IN_BYTES);
        targetAverageRowSizeInBytes = min(targetSizeInBytes / partitionCount, targetAverageRowSizeInBytes);
        return builder(
                partitionCount,
                targetSizeInBytes,
                DEFAULT_EXPECTED_ROWS_COUNT,
                targetAverageRowSizeInBytes,
                MULTI_ROW_ENTRY_MAX_SIZE_IN_BYTES,
                MULTI_ROW_ENTRY_MAX_ROW_COUNT);
    }
@Test
    public void testBuilderFull()
    {
        PrestoSparkRowBatchBuilder builder = PrestoSparkRowBatch.builder(
                10,
                5,
                10,
                NO_TARGET_ENTRY_SIZE_REQUIREMENT,
                UNLIMITED_MAX_ENTRY_SIZE,
                UNLIMITED_MAX_ENTRY_ROW_COUNT);
        assertFalse(builder.isFull());
        assertTrue(builder.isEmpty());
        addRow(builder, createRow(1, "12345"));
        assertTrue(builder.isFull());
        assertFalse(builder.isEmpty());
    }