public static String getPartitionName(String basePath, String partitionPath) {
        String basePathWithSlash = getPathWithSlash(basePath);
        String partitionPathWithSlash = getPathWithSlash(partitionPath);

        if (basePathWithSlash.equals(partitionPathWithSlash)) {
            return "";
        }

        Preconditions.checkState(partitionPath.startsWith(basePathWithSlash),
                "Can't infer partition name. base path: %s, partition path: %s", basePath, partitionPath);

        partitionPath = partitionPath.endsWith("/") ? partitionPath.substring(0, partitionPath.length() - 1) : partitionPath;
        return partitionPath.substring(basePathWithSlash.length());
    }
@Test
    public void testGetPartition() {
        String base = "hdfs://hadoop01:9000/mytable";
        String tableLocation = "hdfs://hadoop01:9000/mytable/";
        Assert.assertTrue(getPartitionName(base, tableLocation).isEmpty());

        String errorPath = "hdfs://aaa/bbb";
        ExceptionChecker.expectThrowsWithMsg(
                IllegalStateException.class,
                "Can't infer partition name. base path",
                () -> PartitionUtil.getPartitionName(base, errorPath));

        String partitionPath = "hdfs://hadoop01:9000/mytable/year=2023/month=12/day=30";
        Assert.assertEquals("year=2023/month=12/day=30", PartitionUtil.getPartitionName(base, partitionPath));
    }