code: def _gather_maps(self, left_cols, right_cols):
      # Produce gather maps for the join, optionally reordering to
      # match pandas-order in compat mode.
      maps = self._joiner(
          left_cols,
          right_cols,
          how=self.how,
      )
      if not self.preserve_key_order:
          return maps
      # We should only get here if we're in a join on which
      # pandas-compat places some ordering obligation (which
      # precludes a semi-join)
      # We must perform this reordering even if sort=True since the
      # obligation to ensure tiebreaks appear in input table order
      # means that the gather maps must be permuted into an original
      # order.
      assert self.how in {"inner", "outer", "left", "right"}
      # And hence both maps returned from the libcudf join should be
      # non-None.
      assert all(m is not None for m in maps)
      lengths = [len(left_cols[0]), len(right_cols[0])]
      # Only nullify those maps that need it.
      nullify = [
          self.how not in {"inner", "left"},
          self.how not in {"inner", "right"},
      ]
      # To reorder maps so that they are in order of the input
      # tables, we gather from iota on both right and left, and then
      # sort the gather maps with those two columns as key.
      key_order = list(
          itertools.chain.from_iterable(
              libcudf.copying.gather(
                  [
                      cudf.core.column.as_column(
                          range(n), dtype=size_type_dtype
                      )
                  ],
                  map_,
                  nullify=null,
              )
              for map_, n, null in zip(maps, lengths, nullify)
          )
      )
      return libcudf.sort.sort_by_key(
          list(maps),
          # If how is right, right map is primary sort key.
          key_order[:: -1 if self.how == "right" else 1],
          [True] * len(key_order),
          ["last"] * len(key_order),
          stable=True,
      )
  
file_path: cudf/python/cudf/cudf/core/join/join.py
imports: from __future__ import annotations
  import itertools
  import warnings
  from typing import Any, ClassVar, List, Optional
  import cudf
  from cudf import _lib
  from cudf._lib.types import size_type_dtype
  from cudf.core.copy_types import GatherMap
  from cudf.core.join._join_helpers import _coerce_to_tuple, _ColumnIndexer, _IndexIndexer, _match_join_keys
label_desc: Use image node_id 2 for calling the Merge obj's underlying member method code with example usage: obj._gather_maps(left_cols, right_cols) and returns: libcudf, maps