@Override
    public Map<String, Optional<HivePartitionDataInfo>> getPartitionDataInfos() {
        Map<String, Optional<HivePartitionDataInfo>> partitionDataInfos = Maps.newHashMap();
        List<String> partitionNameToFetch = partitionNames;
        if (partitionLimit >= 0 && partitionLimit < partitionNames.size()) {
            partitionNameToFetch = partitionNames.subList(partitionNames.size() - partitionLimit, partitionNames.size());
        }
        GetRemoteFilesParams params =
                GetRemoteFilesParams.newBuilder().setPartitionNames(partitionNames).setCheckPartitionExistence(false).build();
        List<RemoteFileInfo> remoteFileInfos =
                GlobalStateMgr.getCurrentState().getMetadataMgr().getRemoteFiles(table, params);
        for (int i = 0; i < partitionNameToFetch.size(); i++) {
            RemoteFileInfo remoteFileInfo = remoteFileInfos.get(i);
            List<RemoteFileDesc> remoteFileDescs = remoteFileInfo.getFiles();
            if (remoteFileDescs != null) {
                long lastFileModifiedTime = Long.MIN_VALUE;
                int fileNumber = remoteFileDescs.size();
                Optional<RemoteFileDesc> maxLastModifiedTimeFile = remoteFileDescs.stream()
                        .max(Comparator.comparingLong(RemoteFileDesc::getModificationTime));
                if (maxLastModifiedTimeFile.isPresent()) {
                    lastFileModifiedTime = maxLastModifiedTimeFile.get().getModificationTime();
                }
                HivePartitionDataInfo hivePartitionDataInfo = new HivePartitionDataInfo(lastFileModifiedTime, fileNumber);
                partitionDataInfos.put(partitionNameToFetch.get(i), Optional.of(hivePartitionDataInfo));
            } else {
                partitionDataInfos.put(partitionNameToFetch.get(i), Optional.empty());
            }
        }
        return partitionDataInfos;
    }
@Test
    public void testGetPartitionDataInfosWithLimit(@Mocked MetadataMgr metadataMgr) {
        List<RemoteFileInfo> remoteFileInfos = createRemoteFileInfos(4);

        new Expectations() {
            {
                GlobalStateMgr.getCurrentState().getMetadataMgr();
                result = metadataMgr;
                minTimes = 0;

                metadataMgr.getRemoteFiles((Table) any, (GetRemoteFilesParams) any);
                result = remoteFileInfos;
                minTimes = 0;
            }
        };

        String location = "oss://bucket_name/lineorder_part";
        HiveTable hiveTable = createHiveTable(location);
        List<String> partitionNames = Lists.newArrayList(
                "date=20240501", "date=20240502", "date=20240503", "date=20240504");
        {
            TableUpdateArbitrator.UpdateContext updateContext =
                    new TableUpdateArbitrator.UpdateContext(hiveTable, 2, partitionNames);
            TableUpdateArbitrator arbitrator = TableUpdateArbitrator.create(updateContext);
            Assert.assertTrue(arbitrator instanceof ObjectBasedUpdateArbitrator);
            Map<String, Optional<HivePartitionDataInfo>> hivePartitionDataInfo = arbitrator.getPartitionDataInfos();
            Assert.assertEquals(2, hivePartitionDataInfo.size());
            Assert.assertTrue(hivePartitionDataInfo.containsKey("date=20240503"));
            Assert.assertFalse(hivePartitionDataInfo.get("date=20240503").isPresent());
            Assert.assertTrue(hivePartitionDataInfo.containsKey("date=20240504"));
            Assert.assertTrue(hivePartitionDataInfo.get("date=20240504").isPresent());
        }

        {
            TableUpdateArbitrator.UpdateContext updateContext =
                    new TableUpdateArbitrator.UpdateContext(hiveTable, 10, partitionNames);
            TableUpdateArbitrator arbitrator = TableUpdateArbitrator.create(updateContext);
            Assert.assertTrue(arbitrator instanceof ObjectBasedUpdateArbitrator);
            Map<String, Optional<HivePartitionDataInfo>> hivePartitionDataInfo = arbitrator.getPartitionDataInfos();
            Assert.assertEquals(4, hivePartitionDataInfo.size());
            Assert.assertTrue(hivePartitionDataInfo.containsKey("date=20240501"));
            Assert.assertFalse(hivePartitionDataInfo.get("date=20240501").isPresent());
            Assert.assertTrue(hivePartitionDataInfo.containsKey("date=20240502"));
            Assert.assertTrue(hivePartitionDataInfo.get("date=20240502").isPresent());
            Assert.assertTrue(hivePartitionDataInfo.containsKey("date=20240503"));
            Assert.assertTrue(hivePartitionDataInfo.get("date=20240503").isPresent());
            Assert.assertTrue(hivePartitionDataInfo.containsKey("date=20240504"));
            Assert.assertTrue(hivePartitionDataInfo.get("date=20240504").isPresent());
        }
    }