Source:
<code>private List<Map<String, String>> readPartitionsAndPrune( RexBuilder rexBuilder, FlinkContext context, TableSourceTable tableSourceTable, Function<List<Map<String, String>>, List<Map<String, String>>> pruner, Seq<RexNode> partitionPredicate, List<String> inputFieldNames) { Optional<Catalog> catalogOptional = context.getCatalogManager().getCatalog(tableSourceTable.tableIdentifier().getCatalogName()); <START> List<Map<String, String>> remainingPartitions; <END> DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); ObjectIdentifier identifier = tableSourceTable.tableIdentifier(); Optional<List<Map<String, String>>> optionalPartitions = ((SupportsPartitionPushDown) dynamicTableSource).listPartitions(); if (optionalPartitions.isPresent()) { return pruner.apply(optionalPartitions.get()); } else { if (!catalogOptional.isPresent()) { throw new TableException( String.format("Table %s must from a catalog, but %s is not a catalog", identifier.asSummaryString(), identifier.getCatalogName())); } try { return readPartitionFromCatalogAndPrune( rexBuilder, context, catalogOptional.get(), identifier, inputFieldNames, partitionPredicate, pruner); } catch (TableNotExistException tableNotExistException) { throw new TableException(String.format("Table %s is not found in catalog.", identifier.asSummaryString())); } catch (TableNotPartitionedException tableNotPartitionedException) { throw new TableException( String.format("Table %s is not a partitionable source. Validator should have checked it.", identifier.asSummaryString()), tableNotPartitionedException); } } }</code><technical_language>Unused field remainingPartitions</technical_language>

Target:
private List<Map<String, String>> readPartitionsAndPrune( RexBuilder rexBuilder, FlinkContext context, TableSourceTable tableSourceTable, Function<List<Map<String, String>>, List<Map<String, String>>> pruner, Seq<RexNode> partitionPredicate, List<String> inputFieldNames) { Optional<Catalog> catalogOptional = context.getCatalogManager().getCatalog(tableSourceTable.tableIdentifier().getCatalogName()); DynamicTableSource dynamicTableSource = tableSourceTable.tableSource(); ObjectIdentifier identifier = tableSourceTable.tableIdentifier(); Optional<List<Map<String, String>>> optionalPartitions = ((SupportsPartitionPushDown) dynamicTableSource).listPartitions(); if (optionalPartitions.isPresent()) { return pruner.apply(optionalPartitions.get()); } else { if (!catalogOptional.isPresent()) { throw new TableException( String.format("Table %s must from a catalog, but %s is not a catalog", identifier.asSummaryString(), identifier.getCatalogName())); } try { return readPartitionFromCatalogAndPrune( rexBuilder, context, catalogOptional.get(), identifier, inputFieldNames, partitionPredicate, pruner); } catch (TableNotExistException tableNotExistException) { throw new TableException(String.format("Table %s is not found in catalog.", identifier.asSummaryString())); } catch (TableNotPartitionedException tableNotPartitionedException) { throw new TableException( String.format("Table %s is not a partitionable source. Validator should have checked it.", identifier.asSummaryString()), tableNotPartitionedException); } } }