Skip to content

Commit 085ba38

Browse files
author
Marco
committed
latest
1 parent ddaba31 commit 085ba38

File tree

4 files changed

+16
-3
lines changed
  • components/webui

4 files changed

+16
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import type {PrestoRowObject} from "../../../../../../../../common/index.js";
2+
3+
14
/**
25
* Structure of dynamic Presto search results data.
36
*/
4-
interface PrestoSearchResult {
7+
interface PrestoSearchResult extends PrestoRowObject {
58
_id: string;
6-
row: Record<string, unknown>;
79
}
810

911
export type {PrestoSearchResult};

components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {TableProps} from "antd";
2+
23
import {PrestoSearchResult} from "./typings";
34

45

components/webui/common/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,21 @@ interface SearchResultsMetadataDocument {
129129
numTotalResults?: number;
130130
queryEngine: CLP_QUERY_ENGINES;
131131
}
132+
133+
/**
134+
* Presto row wrapped in a `row` property to prevent conflicts with MongoDB's `_id` field.
135+
*/
136+
interface PrestoRowObject {
137+
row: Record<string, unknown>;
138+
}
139+
132140
export {
133141
CLP_QUERY_ENGINES,
134142
SEARCH_SIGNAL,
135143
};
136144
export type {
137145
PRESTO_SEARCH_SIGNAL,
146+
PrestoRowObject,
138147
SearchResultsMetadataDocument,
139148
ClientToServerEvents,
140149
Err,

components/webui/server/src/routes/api/presto-search/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {
33
InsertManyResult,
44
} from "mongodb";
55

6+
import type {PrestoRowObject} from "../../../../../common/index.js";
67

78
/**
89
* Converts a Presto result row (array of values) into an object, using the provided column
@@ -15,7 +16,7 @@ import type {
1516
const prestoRowToObject = (
1617
row: unknown[],
1718
columns: {name: string}[]
18-
): Record<string, unknown> => {
19+
): PrestoRowObject => {
1920
const obj: Record<string, unknown> = {};
2021
columns.forEach((col, idx) => {
2122
obj[col.name] = row[idx];

0 commit comments

Comments
 (0)