Code review comment: Here are my suggestions based on the given code:  1. Import Optimization: Try to avoid using * in imports, as specific import statements enhance code readability and maintainability helping others understand which classes are in use.  2. Simplicity and Efficiency: `partitionNames.contains(partitionName)` has been used twice within the same block that might impact efficiency when there's a large number of partitions. Consider storing result into variable if the collection is large or computation needed to find an element is complex.  3. Clarity: Add comments to your code to explain what you're trying to do - especially for non-obvious parts of the code. The current comment provided is in Chinese which may not be universally understood, consider translating it to English to make it more globally recognized.  4. Error Handling: There doesn't seem to be any error handling included for issues with schema resolution or database connectivity. Exceptions should be logged properly or handled accordingly, otherwise, in case of any exception event, it would be hard to debug where things went wrong.  5. Thread Safety: If this class could potentially be accessed by multiple threads concurrently, consider thread safety. Immutable data structures are normally a good way to go about this. It seems a good start is made with ImmutableList.builder() but ensure its well throughout across the application.  6. Usage of Guava libraries: You're using the Guava library, try to make full use of its capabilities. For instance, instead of calling `.contains()` (which takes O(n) time complexity per call), you can convert partitionNames into a HashSet (from Guava's Sets class), resulting in constant time lookups(O(1)), which is more efficient if you're doing multiple contains checks.  7. Closed Resources: In your code, you rely on an external resource, the connection. Make sure that connections are always closed regardless of whether the operation was successful. Using the `try-with-resource` statement can help automatically close resources.  8. Unit Testing: Ensure that the unit tests are written for this method to avoid any regression bugs in future code changes and also helps you confirm the correct behavior.    Remember, these suggestions may vary based on your project requirements and standards.

Code before review:
public List<PartitionInfo> getPartitions(Table table, List<String> partitionNames) {
try (Connection connection = getConnection()) {
List<Partition> partitions = schemaResolver.getPartitions(connection, table);
String minInt = IntLiteral.createMaxValue(Type.INT).getStringValue();
String minDate = DateLiteral.createMaxValue(Type.DATE).getStringValue();
ImmutableList.Builder<PartitionInfo> list = ImmutableList.builder();
if (!partitions.isEmpty()) {
for (Partition partition : partitions) {
String partitionName = partition.getPartitionName();
if (partitionNames.contains(partitionName)) {
list.add(partition);
}
if (partitionName.equalsIgnoreCase(PartitionUtil.MYSQL_PARTITION_MAXVALUE)) {
if (partitionNames.contains(minInt) || partitionNames.contains(minDate)) {
list.add(partition);
}
}
}
return list.build();
} else {
return Lists.newArrayList();
}
} catch (SQLException e) {
throw new StarRocksConnectorException(e.getMessage());
}
}

Line under review: } else {

Code after addressing the review:
public List<PartitionInfo> getPartitions(Table table, List<String> partitionNames) {
try (Connection connection = getConnection()) {
List<Partition> partitions = schemaResolver.getPartitions(connection, table);
String maxInt = IntLiteral.createMaxValue(Type.INT).getStringValue();
String maxDate = DateLiteral.createMaxValue(Type.DATE).getStringValue();
ImmutableList.Builder<PartitionInfo> list = ImmutableList.builder();
if (partitions.isEmpty()) {
return Lists.newArrayList();
}
for (Partition partition : partitions) {
String partitionName = partition.getPartitionName();
if (partitionNames.contains(partitionName)) {
list.add(partition);
}
if (partitionName.equalsIgnoreCase(PartitionUtil.MYSQL_PARTITION_MAXVALUE)) {
if (partitionNames.contains(maxInt) || partitionNames.contains(maxDate)) {
list.add(partition);
}
}
}
return list.build();
} catch (SQLException e) {
throw new StarRocksConnectorException(e.getMessage());
}
}