public Map<Integer, Slice> toKeyMap(List<OrcType> types, List<HiveColumnHandle> physicalColumnHandles)
    {
        Map<String, Integer> columnIndexMap = physicalColumnHandles.stream()
                .collect(toImmutableMap(HiveColumnHandle::getName, HiveColumnHandle::getHiveColumnIndex));
        return toKeyMap(types, columnIndexMap);
    }
@Test
    public void testToKeyMap()
    {
        DwrfEncryptionMetadata dwrfEncryptionMetadata = new DwrfEncryptionMetadata(
                ImmutableMap.of("c1", "abcd".getBytes(),
                        "c3.d2.e1.f1", "def".getBytes(),
                        "c3.d2.e2", "ghi".getBytes()),
                ImmutableMap.of(),
                "test_algo",
                "test_provider");

        List<HiveColumnHandle> columnHandleList = ImmutableList.of(
                new HiveColumnHandle("c1", HIVE_INT, TypeSignature.parseTypeSignature(BIGINT), 0, HiveColumnHandle.ColumnType.REGULAR, Optional.empty(), Optional.empty()),
                new HiveColumnHandle("c3", HIVE_INT, TypeSignature.parseTypeSignature(BIGINT), 2, HiveColumnHandle.ColumnType.REGULAR, Optional.empty(), Optional.empty()));

        List<OrcType> orcTypes = ImmutableList.of(
                new OrcType(OrcType.OrcTypeKind.STRUCT, ImmutableList.of(1, 2, 4), ImmutableList.of("c1", "c2,", "c3"), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.INT, ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.STRUCT, ImmutableList.of(3), ImmutableList.of("d1"), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.INT, ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.STRUCT, ImmutableList.of(5, 6), ImmutableList.of("d1", "d2"), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.INT, ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.STRUCT, ImmutableList.of(7, 9), ImmutableList.of("e1", "e2"), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.STRUCT, ImmutableList.of(8), ImmutableList.of("f1"), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.INT, ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty()),
                new OrcType(OrcType.OrcTypeKind.INT, ImmutableList.of(), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty()));
        Map<Integer, Slice> actualKeyMap = dwrfEncryptionMetadata.toKeyMap(orcTypes, columnHandleList);
        Map<Integer, Slice> expectedKeyMap = ImmutableMap.of(
                1, Slices.wrappedBuffer("abcd".getBytes()),
                8, Slices.wrappedBuffer("def".getBytes()),
                9, Slices.wrappedBuffer("ghi".getBytes()));
        assertEquals(actualKeyMap, expectedKeyMap);
    }