bobbai00 commented on code in PR #6009:
URL: https://github.com/apache/texera/pull/6009#discussion_r3564761861
##########
agent-service/src/api/execution-api.ts:
##########
@@ -36,3 +49,166 @@ export interface LogicalPlan {
opsToViewResult?: string[];
opsToReuseResult?: string[];
}
+
+const legacyConsoleMessageSchema = z.object({
+ msgType: z.nativeEnum(ConsoleMessageType),
+ title: z.string().default(""),
+ message: z.string(),
+});
+
+const legacyResultModeSchema = z.enum(["table", "visualization"]);
+type LegacyResultMode = z.output<typeof legacyResultModeSchema>;
+
+const legacyResultModeToWebOutputMode = {
+ table: { type: "PaginationMode" },
+ visualization: { type: "SetSnapshotMode" },
+} satisfies Record<LegacyResultMode, WebOutputMode>;
+
+const legacyOperatorInfoSchema = z
+ .object({
+ state: z.string(),
+ inputTuples: z.number(),
+ outputTuples: z.number(),
+ resultMode: legacyResultModeSchema,
+ result: z.array(z.record(z.unknown())).nullish(),
+ totalRowCount: z.number().int().nonnegative().nullish(),
+ displayedRows: z.number().int().nonnegative().nullish(),
+ truncated: z.boolean().nullish(),
+ consoleLogs: z.array(legacyConsoleMessageSchema).nullish(),
+ error: z.string().nullish(),
+ warnings: z.array(z.string()).nullish(),
+ })
+ .passthrough();
Review Comment:
For backend execution endpoints compatibility purpose. I added some comments
to explain why.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]