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

Method Open

runtime/exec/environment.go:106–126  ·  view source on GitHub ↗
(ctx context.Context, sctx *super.Context, path, format string, pushdown sbuf.Pushdown)

Source from the content-addressed store, hash-verified

104}
105
106func (e *Environment) Open(ctx context.Context, sctx *super.Context, path, format string, pushdown sbuf.Pushdown) (sbuf.Puller, error) {
107 if path == "-" {
108 path = "stdio:stdin"
109 }
110 var fields []field.Path
111 if pushdown != nil {
112 if proj := pushdown.Projection(); proj != nil {
113 fields = proj.Paths()
114 }
115 }
116 file, err := anyio.Open(ctx, sctx, e.engine, path, e.readerOpts(fields, format))
117 if err != nil {
118 return nil, fmt.Errorf("%s: %w", path, err)
119 }
120 scanner, err := sbuf.NewScanner(ctx, file, pushdown)
121 if err != nil {
122 file.Close()
123 return nil, err
124 }
125 return &closePuller{scanner, file}, nil
126}
127
128func (e *Environment) readerOpts(fields []field.Path, format string) anyio.ReaderOpts {
129 o := e.ReaderOpts

Callers 3

VectorOpenMethod · 0.95
openNextMethod · 0.45
openMethod · 0.45

Calls 6

readerOptsMethod · 0.95
OpenFunction · 0.92
NewScannerFunction · 0.92
PathsMethod · 0.80
ProjectionMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected