@Override public Scan open(){
  Scan src=p.open();
  List<TempTable> runs=splitIntoRuns(src);
  if (runs.size() == 0)   return src;
  src.close();
  while (runs.size() > 2)   runs=doAMergeIteration(runs);
  return new SortScan(runs,comp);
}

@ Override public Scan open ( ) { Scan src = p . open ( ) ; List < TempTable > runs = splitIntoRuns ( src ) ; if ( runs . size ( ) == 0 ) return src ; src . close ( ) ; while ( runs . size ( ) > 2 ) runs = doAMergeIteration ( runs ) ; return new SortScan ( runs , comp ) ; }
this method is where most of the action is . up to 2 sorted temporary tables are created , and are passed into sortscan for final merging .
