public static Map<String, Range<PartitionKey>> getPartitionKeyRange(Table table, Column partitionColumn, Expr partitionExpr)
            throws UserException {
        return ConnectorPartitionTraits.build(table).getPartitionKeyRange(partitionColumn, partitionExpr);
    }
@Test
    public void testGetPartitionRange(@Mocked HiveTable table) throws UserException {
        Column partitionColumn = new Column("date", Type.DATE);
        List<String> partitionNames = ImmutableList.of("date=2022-08-02", "date=2022-08-19", "date=2022-08-21",
                "date=2022-09-01", "date=2022-10-01", "date=2022-12-02");

        new MockUp<PartitionUtil>() {
            @Mock
            public List<Column> getPartitionColumns(Table table) {
                return ImmutableList.of(partitionColumn);
            }
        };
        new MockUp<MetadataMgr>() {
            @Mock
            public List<String> listPartitionNames(String catalogName, String dbName, String tableName) {
                return partitionNames;
            }
        };
        new Expectations() {
            {
                table.getType();
                result = Table.TableType.HIVE;
                minTimes = 0;

                table.isHiveTable();
                result = true;
                minTimes = 0;
            }
        };

        Map<String, Range<PartitionKey>> partitionMap = PartitionUtil.getPartitionKeyRange(table, partitionColumn, null);
        Assert.assertEquals(partitionMap.size(), partitionNames.size());
        Assert.assertTrue(partitionMap.containsKey("p20221202"));
        PartitionKey upperBound = new PartitionKey();
        upperBound.pushColumn(new DateLiteral(2022, 12, 03), PrimitiveType.DATE);
        Assert.assertTrue(partitionMap.get("p20221202").upperEndpoint().equals(upperBound));
    }