MCPcopy Create free account
hub / github.com/antvis/AVA / execute

Method execute

src/interpreter/python/engine.ts:95–116  ·  view source on GitHub ↗
(
    code: string,
    options?: ExecutionOptions,
    caller?: AbortSignal
  )

Source from the content-addressed store, hash-verified

93 }
94
95 async execute<T = Record<string, unknown>>(
96 code: string,
97 options?: ExecutionOptions,
98 caller?: AbortSignal
99 ): Promise<ExecutionResult<T>> {
100 const source = this.source;
101 if (!source) throw new Error('No data loaded. Please call source() first.');
102
103 const signal = this.operationSignal(caller);
104 throwIfAborted(signal);
105 const validated = await this.dialect.validateDSL(code, signal);
106 const limits = {
107 maxRows: z.number().int().positive().parse(maxRows(options)),
108 maxResultBytes: maxResultBytes(options),
109 };
110
111 const maxBuffer = limits.maxResultBytes + 1024 * 1024;
112 const response = await this.runScript(executionCode(validated, source, limits), maxBuffer, 'execution', signal);
113 const result = resultSchema.parse(response);
114 // Row fields are chosen by the caller's query; the envelope is runtime-validated above.
115 return executionResult(result.data as T[], result.schema, limits, result.truncatedBy);
116 }
117
118 private operationSignal(signal?: AbortSignal): AbortSignal {
119 return signal ? AbortSignal.any([signal, this.lifetime.signal]) : this.lifetime.signal;

Callers 1

metadataMethod · 0.95

Calls 8

operationSignalMethod · 0.95
runScriptMethod · 0.95
throwIfAbortedFunction · 0.90
maxRowsFunction · 0.90
maxResultBytesFunction · 0.90
executionCodeFunction · 0.90
executionResultFunction · 0.90
validateDSLMethod · 0.65

Tested by

no test coverage detected