danielcweeks commented on code in PR #13997: URL: https://github.com/apache/iceberg/pull/13997#discussion_r2342297838
########## api/src/main/java/org/apache/iceberg/util/VectoredReadUtils.java: ########## @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.iceberg.util; + +import java.io.EOFException; +import java.util.Comparator; +import java.util.List; +import org.apache.iceberg.io.FileRange; +import org.apache.iceberg.relocated.com.google.common.base.Preconditions; +import org.apache.iceberg.relocated.com.google.common.collect.Lists; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utils class for vectoredReads, to help with things like range validation. Most of the code in + * this class is written by @mukundthakur, and taken from + * /hadoop-common/src/main/java/org/apache/hadoop/fs/VectoredReadUtils.java (thank you!). + */ +public final class VectoredReadUtils { Review Comment: I don't feel like we need this class. There are three things this does, but it should probalby be just one. The `validateRangeRequest` should just be handled in the constructor of the FileRange (we currently don't have any validation there). The `sortRangeList` is a subset of `validateAndSortRanges` which seems duplicative. I'd suggest moving `validateAndSort` to the RangeReadable interface as a static utility that can be used by implementors and avoid creating this util class. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
