docs: public Result runIndexOrPartitionScanQueryOnOwnedPartitions(Query query) {
          int migrationStamp = getMigrationStamp();
          PartitionIdSet initialPartitions = mapServiceContext.getOwnedPartitions();
          MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
  
          // to optimize the query we need to get any index instance
          Indexes indexes = mapContainer.getIndexes();
          if (indexes == null) {
              indexes = mapContainer.getIndexes(initialPartitions.iterator().next());
          }
          // first we optimize the query
          Predicate predicate = queryOptimizer.optimize(query.getPredicate(), indexes);
  
          // then we try to run using an index, but if that doesn't work, we'll try a full table scan
          Collection<QueryableEntry> entries = runUsingGlobalIndexSafely(predicate, mapContainer, migrationStamp);
  
          Result result;
          if (entries == null) {
              result = runUsingPartitionScanSafely(query, predicate, initialPartitions, migrationStamp);
              if (result == null) {
                  // full scan didn't work, returning empty result
                  result = populateEmptyResult(query, initialPartitions);
              }
          } else {
              result = populateNonEmptyResult(query, entries, initialPartitions);
          }
  
          return result;
      }