MCPcopy Create free account
hub / github.com/brimdata/super / parallelizeSeqScan

Method parallelizeSeqScan

compiler/optimizer/parallelize.go:91–114  ·  view source on GitHub ↗
(seq dag.Seq, replicas int)

Source from the content-addressed store, hash-verified

89}
90
91func (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
116func parallelizeHead(seq dag.Seq, n int, sortExprs []dag.SortExpr, replicas int) dag.Seq {
117 head := seq[:n]

Callers 1

ParallelizeMethod · 0.95

Calls 3

sortKeysOfSourceMethod · 0.95
concurrentPathMethod · 0.95
parallelizeHeadFunction · 0.85

Tested by

no test coverage detected