Joins from and to. from becomes the current entity.
335477
public SelectBuilder join(Class<?> from, Class<?> to) {
    currentTable = rootTable.join(from, to);

    return this;
  }
1115492
private DataContainer innerJoin(DataContainer left, DataContainer right, Optional<BooleanExpression> joinCondition) {
        return crossJoin(left, right, joinCondition, JoinType.INNER);
    }
818682
def _joinOnAsPriv(self, model, onIndex, whatAs):
        
        if self._join:
            raise Exception("Already joined with a table!")

        self._join = model
        self._joinedField = whatAs
        table = model.table
        self._query = self._query.eq_join(onIndex, r.table(table))
        return self
149182
function merge(prev, current, next) {
  return prev
    .concat()
    .reverse()
    .concat([current], next)
}
90674
function join($relation, $expr = null, $mode = Join::INNER)
    {
        if (null !== $expr) {
            $expr = new On(new AndX(array($expr)));
        }

        $join = new Join($relation, $expr);
        $join->mode = $mode;

        $this->nodes->source->right[] = $join;
        return $this;
    }
310715
function(into, from) {
  for (var key in from) {
    if (into[key] instanceof Object &&
        !(into[key] instanceof Array) &&
        !(into[key] instanceof Function)) {
      merge_(into[key], from[key]);
    } else {
      into[key] = from[key];
    }
  }
  return into;
}
557814
protected function doJoins($source, $joins, &$dest, $from, $contextAlias, $buildImpactIndex=true)
    {
        // expand sequences before doing any joins...
        $this->expandSequence($joins,$source);

        foreach ($joins as $predicate=>$ruleset) {
            if ($predicate=='followSequence') {
                continue;
            }

            if (isset($source[$predicate]))
            {
                // todo: perhaps we can get better performance by detecting whether or not
                // the uri to join on is already in the impact index, and if so not attempting
                // to join on it. However, we need to think about different combinations of
                // nested joins in different points of the view spec and see if this would
                // complicate things. Needs a unit test or two.
                $joinUris = [];
                if (isset($source[$predicate][VALUE_URI]))
                {
                    // single value for join
                    $joinUris[] = array(_ID_RESOURCE=>$source[$predicate][VALUE_URI],_ID_CONTEXT=>$contextAlias);
                }
                else
                {
                    // multiple values for join
                    $joinsPushed = 0;
                    foreach ($source[$predicate] as $v)
                    {
                        if (isset($ruleset['maxJoins']) && !$joinsPushed<$ruleset['maxJoins'])
                        {
                            break; // maxJoins reached
                        }
                        $joinUris[] = array(_ID_RESOURCE=>$v[VALUE_URI],_ID_CONTEXT=>$contextAlias);
                        $joinsPushed++;
                    }
                }

                $recursiveJoins = [];
                $collection = (
                isset($ruleset['from'])
                    ? $this->config->getCollectionForCBD($this->storeName, $ruleset['from'])
                    : $this->config->getCollectionForCBD($this->storeName, $from)
                );

                $cursor = $collection->find(array('_id'=>array('$in'=>$joinUris)), array(
                    'maxTimeMS' => $this->getConfigInstance()->getMongoCursorTimeout()
                ));

                $this->addIdToImpactIndex($joinUris, $dest, $buildImpactIndex);
                foreach($cursor as $linkMatch) {
                    // if there is a condition, check it...
                    if (isset($ruleset['condition']))
                    {
                        $ruleset['condition']['._id'] = $linkMatch['_id'];
                    }
                    if (!(isset($ruleset['condition']) && $collection->count($ruleset['condition'])==0))
                    {
                        // make sure any sequences are expanded before extracting properties
                        if (isset($ruleset['joins'])) $this->expandSequence($ruleset['joins'],$linkMatch);
                        if (isset($ruleset['filter']))
                        {
                            foreach($ruleset['filter'] as $filterPredicate => $filter)
                            {
                                foreach($filter as $filterType => $filterMatch)
                                {
                                    if (isset($linkMatch[$filterPredicate]))
                                    {
                                        foreach($linkMatch[$filterPredicate] as $linkMatchType => $linkMatchValues)
                                        {
                                            if (is_array($linkMatchValues) == false)
                                            {
                                                $linkMatchValues = array($linkMatchType => $linkMatchValues);
                                            }
                                            foreach($linkMatchValues as $linkMatchType => $linkMatchValue)
                                            {
                                                if ($this->matchesFilter($linkMatchType, $linkMatchValue, $filterType, $filterMatch))
                                                {
                                                    $dest[_GRAPHS][] = $this->extractProperties($linkMatch,$ruleset,$from);
                                                }
                                            }

                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            $dest[_GRAPHS][] = $this->extractProperties($linkMatch,$ruleset,$from);
                        }

                        if (isset($ruleset['joins']))
                        {
                            // recursive joins must be done after this cursor has completed, otherwise things get messy
                            $recursiveJoins[] = array('data'=>$linkMatch, 'ruleset'=>$ruleset['joins']);
                        }
                    }
                }
                if (count($recursiveJoins)>0)
                {
                    foreach ($recursiveJoins as $r)
                    {
                        $this->doJoins($r['data'],$r['ruleset'],$dest,$from,$contextAlias,$buildImpactIndex);
                    }
                }
            }
        }
        return;
    }
1039572
public function joinLeftUsing(string $to, string $as, string $using, $usingParams = null): self
    {
        return $this->joinUsing($to, $as, $using, $usingParams, 'LEFT');
    }
123323
def _set_join(self, query=None):
        
        if not query:
            query = self._query

        foreign_key = '%s.%s' % (self._related.get_table(), self._second_key)

        query.join(self._parent.get_table(), self.get_qualified_parent_key_name(), '=', foreign_key)
207001
def _build_join(t):
    
    t.source.name = t.source.parsed_name
    t.source.alias = t.source.parsed_alias[0] if t.source.parsed_alias else ''

    return t
321623
function(from, to, op) {
    if (op) this.iterN(from - this.first, to - from, op)
    else this.iterN(this.first, this.first + this.size, from)
  }
812774
def join_all(joinables, timeout):
    
    started, elapsed = current_millis(), 0
    for ob in joinables:
        ob.join(timeout=timeout / 1000)
        elapsed = current_millis() - started
        timeout = max(0, timeout - elapsed)
996508
public function from($from = null) {
        if ($from === null) {
            return $this->from;
        }

        $this->from = (int) $from;

        return $this;
    }
252653
public M joinsWith(String separator, Object... join) {
		this.delegate = Optional.of(joinWith(separator, join));
		return THIS();
	}
44365
public void toLeftJoin() {
        assert((m_leftNode != null && m_rightNode != null) || (m_leftNode == null && m_rightNode == null));
        if (m_leftNode == null && m_rightNode == null) {
            // End of recursion
            return;
        }
        // recursive calls
        if (m_leftNode instanceof BranchNode) {
            ((BranchNode)m_leftNode).toLeftJoin();
        }
        if (m_rightNode instanceof BranchNode) {
            ((BranchNode)m_rightNode).toLeftJoin();
        }

        // Swap own children
        if (m_joinType == JoinType.RIGHT) {
            JoinNode node = m_rightNode;
            m_rightNode = m_leftNode;
            m_leftNode = node;
            m_joinType = JoinType.LEFT;
        }
    }
1015528
function buildJoinRelations () {
    // if no joins specified then do nothing
    if (!defined(this.args.join)) {
        return
    }
    // get join as array
    var joins = Array.isArray(this.args.join) ? this.args.join : [this.args.join]
    // add each join
    _.each(joins, join => {
        // join may be passed as string that is name of relation to join on
        if (typeof join === 'string') {
            join = {
                relation: join,
            }
        }
        // require join to be object
        assert.ok(join && typeof join === 'object', 'left join must be string or object')
        // add join to query
        this.buildJoinRelation(join)
    })
}
1337429
def joins(self, table):
        

        def do_join(table, model):
            while model is not associations.model_from_name(table):
                # ex) Category -> Forum -> Thread -> Post
                # Category: {"posts": "forums"}
                # Forum: {"posts": "threads"}
                # Thread: {"posts": None}
                # >>> Category.joins("posts")
                # => [
                #       {'table': 'forums', 'on': ['category_id', 'id']}
                #       {'table': 'threads', 'on': ['forum_id', 'id']}
                #       {'table': 'posts', 'on': ['thread_id', 'id']}
                #    ]
                if table in associations.associations_for(model):
                    # This to next: one-many (they have the fk)
                    # If associations.associations_for(model)[table] is None, then this is
                    # terminal (i.e. table is the FINAL association in the
                    # chain)
                    next_level = associations.associations_for(model)[table] or table
                    next_model = associations.model_from_name(next_level)
                    foreign_key = associations.foreign_keys_for(model).get(
                        next_level,
                        inflector.foreignKey(model.__name__))
                    yield {'table': next_level, 'on': [foreign_key, 'id']}
                else:
                    # One-One or Many-One
                    # singular table had better be in associations.associations_for(model)
                    singular = inflector.singularize(table)
                    next_level = associations.associations_for(model)[singular] or singular
                    next_model = associations.model_from_name(next_level)
                    this_table_name = Repo.table_name(model)
                    foreign_key = associations.foreign_keys_for(model).get(
                        next_level,
                        inflector.foreignKey(model.__name__))
                    if associations.model_has_foreign_key_for_table(table,
                                                                    model):
                        # we have the foreign key
                        order = ['id', foreign_key]
                    else:
                        # They have the foreign key
                        order = [foreign_key, 'id']
                    yield {'table': inflector.pluralize(next_level), 'on': order}
                model = next_model

        self.join_args = list(do_join(table, self.model))
        return self