You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dataset_join.go
    path of file: ./repos/gleam/flow
    
    the code of the file until where you have to start completion: package flow

import (
	"github.com/chrislusf/gleam/instruction"
)

// Join joins two datasets by the key.
func (d *Dataset) Join(name string, other *Dataset, sortOption *SortOption) *Dataset {
	return d.DoJoin(name, other, false, false, sortOption)
}

// TODO use actual key fields instead of Field
    
func (d *Dataset) DoJoin(name string, other *Dataset, leftOuter, rightOuter bool, sortOption *SortOption) *Dataset {
	sorted_d := d.Partition(name+".left", len(d.Shards), sortOption).LocalSort(name+".left", sortOption)
	var sorted_other *Dataset
	if d == other {
		sorted_other = sorted_d
	} else {
		sorted_other = other.Partition(name+".right", len(d.Shards), sortOption).LocalSort(name+".right", sortOption)
	}
	return sorted_d.JoinPartitionedSorted(name, sorted_other, sortOption, leftOuter, rightOuter)
}