Skip to content

Commit df14f72

Browse files
committed
fix: none configed columns
1 parent 204a99c commit df14f72

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/greptimedb/index.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,6 @@ export function transformGreptimeDBLogs(sqlResponse: GreptimeResponse, query: CH
297297
}
298298
});
299299
}
300-
301-
302-
// if (timestampColumnIndex === -1 || bodyColumnIndex === -1) {
303-
// console.error('Timestamp or body column not found in GreptimeDB response.');
304-
// return null;
305-
// }
306300

307301
const timestamps: number[] = [];
308302
const bodies: string[] = [];
@@ -318,9 +312,13 @@ export function transformGreptimeDBLogs(sqlResponse: GreptimeResponse, query: CH
318312
? new Date(timestampValue).getTime()
319313
: timestampValue
320314
);
321-
bodies.push(String(row[bodyColumnIndex]));
322-
severities.push(severityColumnIndex !== -1 ? String(row[severityColumnIndex]) : '');
323-
ids.push(idColumnIndex !== -1 ? String(row[idColumnIndex]) : '');
315+
if (bodyColumnIndex !== -1) {
316+
bodies.push(String(row[bodyColumnIndex]));
317+
}
318+
if (severityColumnIndex !== -1) {
319+
severities.push(String(row[severityColumnIndex]));
320+
}
321+
324322

325323
const labels: Record<string, any> = {};
326324
for (const labelName in labelColumnIndices) {

0 commit comments

Comments
 (0)