zddr commented on code in PR #45659:
URL: https://github.com/apache/doris/pull/45659#discussion_r1895490611


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalTable.java:
##########
@@ -195,46 +189,39 @@ public void beforeMTMVRefresh(MTMV mtmv) throws 
DdlException {
 
     @Override
     public Map<String, PartitionItem> 
getAndCopyPartitionItems(Optional<MvccSnapshot> snapshot) {
-        return 
Maps.newHashMap(getPartitionInfoFromCache().getNameToPartitionItem());
+        return 
Maps.newHashMap(getOrFetchSnapshotCacheValue(snapshot).getPartitionInfo().getNameToPartitionItem());
     }
 
-    private IcebergPartitionInfo getPartitionInfoFromCache() {
-        makeSureInitialized();
-        Optional<SchemaCacheValue> schemaCacheValue = getSchemaCacheValue();
-        if (!schemaCacheValue.isPresent()) {
-            return new IcebergPartitionInfo();
-        }
-        return ((IcebergSchemaCacheValue) 
schemaCacheValue.get()).getPartitionInfo();
+    @Override
+    public Map<String, PartitionItem> 
getNameToPartitionItems(Optional<MvccSnapshot> snapshot) {
+        return 
getOrFetchSnapshotCacheValue(snapshot).getPartitionInfo().getNameToPartitionItem();
     }
 
     @Override
     public PartitionType getPartitionType(Optional<MvccSnapshot> snapshot) {
-        makeSureInitialized();
         return isValidRelatedTable() ? PartitionType.RANGE : 
PartitionType.UNPARTITIONED;
     }
 
     @Override
     public Set<String> getPartitionColumnNames(Optional<MvccSnapshot> 
snapshot) throws DdlException {
-        return 
getPartitionColumnsFromCache().stream().map(Column::getName).collect(Collectors.toSet());
+        IcebergSnapshotCacheValue snapshotValue = 
getOrFetchSnapshotCacheValue(snapshot);

Review Comment:
   repeat code with `getPartitionColumns`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to