(seq dag.Seq, replicas int)
| 89 | } |
| 90 | |
| 91 | func (o *Optimizer) parallelizeSeqScan(seq dag.Seq, replicas int) (dag.Seq, error) { |
| 92 | scan := seq[0].(*dag.SeqScan) |
| 93 | if len(seq) == 1 && scan.Filter == nil { |
| 94 | // We don't try to parallelize the path if it's simply scanning and does no |
| 95 | // other work. We might want to revisit this down the road if |
| 96 | // the system would benefit for parallel reading and merging. |
| 97 | return nil, nil |
| 98 | } |
| 99 | srcSortKeys, err := o.sortKeysOfSource(scan) |
| 100 | if err != nil { |
| 101 | return nil, err |
| 102 | } |
| 103 | if len(srcSortKeys) > 1 { |
| 104 | // XXX Don't yet support multi-key ordering. See Issue #2657. |
| 105 | return nil, nil |
| 106 | } |
| 107 | // concurrentPath will check that the path consisting of the original source |
| 108 | // sequence and any lifted sequence is still parallelizable. |
| 109 | n, sortExprs, _, err := o.concurrentPath(seq[1:], srcSortKeys) |
| 110 | if err != nil { |
| 111 | return nil, err |
| 112 | } |
| 113 | return parallelizeHead(seq, n+1, sortExprs, replicas), nil |
| 114 | } |
| 115 | |
| 116 | func parallelizeHead(seq dag.Seq, n int, sortExprs []dag.SortExpr, replicas int) dag.Seq { |
| 117 | head := seq[:n] |
no test coverage detected