function calculateCartesianProduct(keyRangeSets) {
  goog.asserts.assert(
      keyRangeSets.length > 1,
      'Should only be called for cross-column indices.');

  var keyRangeSetsAsArrays = keyRangeSets.map(
      function(keyRangeSet) {
        return keyRangeSet.getValues();
      });

  var it = goog.iter.product.apply(null, keyRangeSetsAsArrays);
  var combinations = [];
  goog.iter.forEach(it, function(value) {
    combinations.push(value);
  });
  return combinations;
}
Finds the cartesian product of a collection of SingleKeyRangeSets.
@param {!Array<!lf.index.SingleKeyRangeSet>} keyRangeSets A SingleKeyRangeSet
    at position i in the input array corresponds to all possible values for
    the ith dimension in the N-dimensional space (where N is the number of
    columns in the cross-column index).
@return {!Array<!lf.index.KeyRange>} The cross-column key range combinations.