public static String getPartitionNameFromPartitionType(MetadataPartitionType partitionType, HoodieTableMetaClient metaClient, String indexName) {
    if (MetadataPartitionType.FUNCTIONAL_INDEX.equals(partitionType)) {
      checkArgument(metaClient.getIndexMetadata().isPresent(), "Index definition is not present");
      return metaClient.getIndexMetadata().get().getIndexDefinitions().get(indexName).getIndexName();
    }
    return partitionType.getPartitionPath();
  }
@Test
  public void testExceptionForMissingFunctionalIndexMetadata() {
    MetadataPartitionType partitionType = MetadataPartitionType.FUNCTIONAL_INDEX;
    HoodieTableMetaClient metaClient = mock(HoodieTableMetaClient.class);
    when(metaClient.getIndexMetadata()).thenReturn(Option.empty());

    assertThrows(IllegalArgumentException.class,
        () -> HoodieIndexUtils.getPartitionNameFromPartitionType(partitionType, metaClient, "testIndex"));
  }