### Question:
ShardCompactor { @Inject public ShardCompactor(StorageManager storageManager, StorageManagerConfig config, TypeManager typeManager) { this(storageManager, requireNonNull(config, "config is null").toOrcReaderOptions(), requireNonNull(typeManager, "typeManager is null").getTypeOperators()); } @Inject  ShardCompactor(StorageManager storageManager, StorageManagerConfig config, TypeManager typeManager);  ShardCompactor(StorageManager storageManager, OrcReaderOptions orcReaderOptions, TypeOperators typeOperators); List<ShardInfo> compact(long transactionId, OptionalInt bucketNumber, Set<UUID> uuids, List<ColumnInfo> columns); List<ShardInfo> compactSorted(long transactionId, OptionalInt bucketNumber, Set<UUID> uuids, List<ColumnInfo> columns, List<Long> sortColumnIds, List<SortOrder> sortOrders); @Managed @Nested CounterStat getInputShards(); @Managed @Nested CounterStat getOutputShards(); @Managed @Nested DistributionStat getInputShardsPerCompaction(); @Managed @Nested DistributionStat getOutputShardsPerCompaction(); @Managed @Nested DistributionStat getCompactionLatencyMillis(); @Managed @Nested DistributionStat getSortedCompactionLatencyMillis();  }### Answer:
@Test public void testShardCompactor() throws Exception { List<Long> columnIds = ImmutableList.of(3L, 7L, 2L, 1L, 5L); List<Type> columnTypes = ImmutableList.of(BIGINT, createVarcharType(20), DOUBLE, DATE, TIMESTAMP_MILLIS); List<ShardInfo> inputShards = createShards(storageManager, columnIds, columnTypes, 3); assertEquals(inputShards.size(), 3); long totalRows = inputShards.stream() .mapToLong(ShardInfo::getRowCount) .sum(); long expectedOutputShards = computeExpectedOutputShards(totalRows); Set<UUID> inputUuids = inputShards.stream().map(ShardInfo::getShardUuid).collect(toSet()); long transactionId = 1; List<ShardInfo> outputShards = compactor.compact(transactionId, OptionalInt.empty(), inputUuids, getColumnInfo(columnIds, columnTypes)); assertEquals(outputShards.size(), expectedOutputShards); Set<UUID> outputUuids = outputShards.stream().map(ShardInfo::getShardUuid).collect(toSet()); assertShardEqualsIgnoreOrder(inputUuids, outputUuids, columnIds, columnTypes); }