Skip to content

Commit

Permalink
Revert "Add where to log context requests"
Browse files Browse the repository at this point in the history
This reverts commit 2153ef7.
  • Loading branch information
lunaticusgreen committed Jan 19, 2025
1 parent 2153ef7 commit 0da1a3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/datasource/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class CHDataSource

const originalQuery = this.createQuery(requestOptions, query);
let scanner = new Scanner(originalQuery.stmt.replace(/\r\n|\r|\n/g, ' '));
let { select, where } = scanner.toAST();
let { select } = scanner.toAST();

const generateQueryForTraceID = (traceId, select) => {
return `SELECT ${select.join(',')} FROM $table WHERE $timeFilter AND trace_id=${traceId}`;
Expand All @@ -204,7 +204,7 @@ export class CHDataSource
} PRECEDING AND CURRENT ROW) AS timestamp
FROM $table
ORDER BY ${inputTimestampColumn}
) WHERE ${where?.length ? where.join(' ') + ' AND' : ''} ${inputTimestampColumn} = ${inputTimestampValue}`;
) WHERE ${inputTimestampColumn} = ${inputTimestampValue}`;
};

const generateQueryForTimestampForward = (inputTimestampColumn, inputTimestampValue, contextWindowSize) => {
Expand All @@ -216,19 +216,19 @@ export class CHDataSource
} FOLLOWING) AS timestamp
FROM $table
ORDER BY ${inputTimestampColumn}
) WHERE ${where?.length ? where.join(' ') + ' AND' : ''} ${inputTimestampColumn} = ${inputTimestampValue}`;
) WHERE ${inputTimestampColumn} = ${inputTimestampValue}`;
};

const generateRequestForTimestampForward = (timestampField, timestamp, currentRowTimestamp, select) => {
return `SELECT ${select.join(
','
)} FROM $table WHERE ${where?.length ? where.join(' ') + ' AND' : ''} ${timestampField} <'${timestamp}' AND ${timestampField} > '${currentRowTimestamp}'`;
)} FROM $table WHERE ${timestampField} <'${timestamp}' AND ${timestampField} > '${currentRowTimestamp}'`;
};

const generateRequestForTimestampBackward = (timestampField, timestamp, currentRowTimestamp, select) => {
return `SELECT ${select.join(
','
)} FROM $table WHERE ${where?.length ? where.join(' ') + ' AND' : ''} ${timestampField} > '${timestamp}' AND ${timestampField} < '${currentRowTimestamp}'`;
)} FROM $table WHERE ${timestampField} > '${timestamp}' AND ${timestampField} < '${currentRowTimestamp}'`;
};

if (traceId) {
Expand Down

0 comments on commit 0da1a3c

Please sign in to comment.