@@ -271,24 +271,20 @@ protected RowIndexEntry getPosition(PartitionPosition key, Operator op, boolean
271271 private RowIndexEntry getApproximatePosition (PartitionPosition key , Operator op , boolean isLeftBound )
272272 {
273273 assert op == GT || op == GE ;
274-
275- PartitionPosition searchKey ;
276- Operator searchOp ;
277-
278- if (filterLast () && last .compareTo (key ) < 0 )
279- return null ;
280- boolean filteredLeft = (filterFirst () && first .compareTo (key ) > 0 );
281- searchKey = filteredLeft ? first : key ;
282- searchOp = filteredLeft ? GE : op ;
274+ // We currently only need this method in contexts where neither early opening nor zero copy transfer are used,
275+ // which means we don't have to worry about `filterFirst`/`filterLast`. We could expand that method to support
276+ // those, but it's unclear it will ever be needed, and this would require proper testing, so leaving aside for now.
277+ assert openReason != OpenReason .MOVED_START : "Early opening is not supported with this method" ;
278+ assert !sstableMetadata .zeroCopyMetadata .exists () : "SSTables with zero copy metadata are not supported" ;
283279
284280 try (PartitionIndex .Reader reader = partitionIndex .openReader ())
285281 {
286- return reader .ceiling (searchKey , (pos , assumeNoMatch , compareKey ) -> {
282+ return reader .ceiling (key , (pos , assumeNoMatch , compareKey ) -> {
287283 // The goal of the overall method, compared to `getPosition`, is to avoid reading the data file. If
288284 // whatever partition we look at has a row index (`pos >= 0`), then `retrieveEntryIfAcceptable` may
289285 // read the row index file, but it will never read the data file, so we can use it like in `getPosition`.
290286 if (pos >= 0 )
291- return retrieveEntryIfAcceptable (searchOp , compareKey , pos , assumeNoMatch );
287+ return retrieveEntryIfAcceptable (op , compareKey , pos , assumeNoMatch );
292288
293289 // If `assumeNoMatch == false`, then it means we've matched a prefix of the searched key. This means
294290 // `pos` points to a key `K` in the sstable that is "the closest on" to `searchKey`, but it may be
0 commit comments