Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 30b8d61

Browse files
authored
fix: removing OFFSET during SQL sanitisation (#367)
1 parent 39c147b commit 30b8d61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pages/Stream/components/EventTimeLineGraph.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ function extractWhereClause(sql: string) {
2727
return '(1 = 1)';
2828
}
2929

30+
function removeOffsetFromQuery(query: string): string {
31+
const offsetRegex = /\sOFFSET\s+\d+/i;
32+
return query.replace(offsetRegex, '');
33+
}
34+
3035
const getCompactType = (interval: number): CompactInterval => {
3136
const totalMinutes = interval / (1000 * 60);
3237
if (totalMinutes <= 60) {
@@ -283,10 +288,11 @@ const EventTimeLineGraph = () => {
283288
? extractWhereClause(custSearchQuery)
284289
: parseQuery(queryEngine, appliedQuery, localStream).where;
285290
const query = generateCountQuery(localStream, modifiedStartTime, modifiedEndTime, compactType, whereClause);
291+
const graphQuery = removeOffsetFromQuery(query);
286292
fetchQueryMutation.mutate({
287293
queryEngine: 'Parseable', // query for graph should always hit the endpoint for parseable query
288294
logsQuery,
289-
query,
295+
query: graphQuery,
290296
});
291297
}, [localStream, startTime.toISOString(), endTime.toISOString(), custSearchQuery]);
292298

0 commit comments

Comments
 (0)