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

Function CompileWithSortKey

compiler/package.go:145–164  ·  view source on GitHub ↗

XXX currently used only by aggregate test, need to deprecate

(rctx *runtime.Context, ast *parser.AST, r sio.Reader, sortKey order.SortKey)

Source from the content-addressed store, hash-verified

143
144// XXX currently used only by aggregate test, need to deprecate
145func CompileWithSortKey(rctx *runtime.Context, ast *parser.AST, r sio.Reader, sortKey order.SortKey) (*exec.Query, error) {
146 env := exec.NewEnvironment(nil, nil)
147 main, err := Analyze(rctx, ast, env, true)
148 if err != nil {
149 return nil, err
150 }
151 scan, ok := main.Body[0].(*dag.DefaultScan)
152 if !ok {
153 return nil, errors.New("CompileWithSortKey: expected a reader")
154 }
155 scan.SortKeys = order.SortKeys{sortKey}
156 if err := Optimize(rctx, main, env, 0); err != nil {
157 return nil, err
158 }
159 outputs, debugs, meter, err := Build(rctx, main, env, []sio.Reader{r})
160 if err != nil {
161 return nil, err
162 }
163 return exec.NewQuery(rctx, bundleOutputs(rctx, outputs, debugs), meter), nil
164}

Callers 1

newQueryOnOrderedReaderFunction · 0.92

Calls 7

NewEnvironmentFunction · 0.92
NewQueryFunction · 0.92
OptimizeFunction · 0.85
bundleOutputsFunction · 0.85
NewMethod · 0.80
AnalyzeFunction · 0.70
BuildFunction · 0.70

Tested by 1

newQueryOnOrderedReaderFunction · 0.74