Code review comment: The most risky bug in this code is: Potential ClassCastException when casting `Table` to `IcebergTable`.  You can modify the code like this: ```java @@ -515,6 +516,17 @@ private IcebergSplitScanTask buildIcebergSplitScanTask(      @Override     public void refreshTable(String srDbName, Table table, List<String> partitionNames, boolean onlyCachedPartitions) { +        if (isResourceMappingCatalog(catalogName)) { +            refreshTableWithResource(table); +        } else { +            if (table instanceof IcebergTable) { // Added instance check +                IcebergTable icebergTable = (IcebergTable) table; +                String dbName = icebergTable.getRemoteDbName(); +                String tableName = icebergTable.getRemoteTableName(); +                icebergCatalog.refreshTable(dbName, tableName); +            } else { +                // Handle the case where the table is not an instance of IcebergTable +            } +        } +    } + +    private void refreshTableWithResource(Table table) {          if (table instanceof IcebergTable) { // Added instance check              IcebergTable icebergTable = (IcebergTable) table;              org.apache.iceberg.Table nativeTable = icebergTable.getNativeTable(); ```

Code under review:
private void refreshTableWithResource(Table table) {
        IcebergTable icebergTable = (IcebergTable) table;
        org.apache.iceberg.Table nativeTable = icebergTable.getNativeTable();
        try {
            if (nativeTable instanceof BaseTable) {
                BaseTable baseTable = (BaseTable) nativeTable;
                if (baseTable.operations().refresh() == null) {
                    
                    
                    
                    throw new NoSuchTableException("No such table: %s", nativeTable.name());
                }
            } else {
                
                throw new StarRocksConnectorException("Invalid table type of %s, it should be a BaseTable!", nativeTable.name());
            }
        } catch (NoSuchTableException e) {
            throw new StarRocksConnectorException("No such table  %s", nativeTable.name());
        } catch (IllegalStateException ei) {
            throw new StarRocksConnectorException("Refresh table %s with failure, the table under hood" +
                    " may have been dropped. You should re-create the external table. cause %s",
                    nativeTable.name(), ei.getMessage());
        }

        icebergTable.resetSnapshot();
    }

Line commented on: throw new StarRocksConnectorException("No such table  %s", nativeTable.name());

Revised code:
private void refreshTableWithResource(Table table) {
        IcebergTable icebergTable = (IcebergTable) table;
        org.apache.iceberg.Table nativeTable = icebergTable.getNativeTable();
        try {
            if (nativeTable instanceof BaseTable) {
                BaseTable baseTable = (BaseTable) nativeTable;
                if (baseTable.operations().refresh() == null) {
                    
                    
                    
                    throw new NoSuchTableException("No such table: %s", nativeTable.name());
                }
            } else {
                
                throw new StarRocksConnectorException("Invalid table type of %s, it should be a BaseTable!", nativeTable.name());
            }
        } catch (NoSuchTableException e) {
            throw new StarRocksConnectorException("No such table  %s", nativeTable.name());
        } catch (IllegalStateException ei) {
            throw new StarRocksConnectorException("Refresh table %s with failure, the table under hood" +
                    " may have been dropped. You should re-create the external table. cause %s",
                    nativeTable.name(), ei.getMessage());
        }

        icebergTable.resetSnapshot();
    }