-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[front] fix(csv) - csv parsing #9121
Changes from 6 commits
f7aec55
10961ff
129f936
9419f9a
eac6335
6022300
825cf7f
83c6b89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -369,14 +369,14 @@ export async function rowsFromCsv({ | |
|
||
let i = 0; | ||
const parser = parse(csv, { delimiter }); | ||
const valuesByCol: Record<string, string[]> = {}; | ||
const valuesByCol: Record<string, string[]> = Object.create(null); | ||
for await (const anyRecord of parser) { | ||
if (i++ >= rowIndex) { | ||
const record = anyRecord as string[]; | ||
for (const [i, h] of header.entries()) { | ||
try { | ||
valuesByCol[h] ??= []; | ||
(valuesByCol[h] as string[]).push(record[i] || ""); | ||
(valuesByCol[h] as string[]).push(record[i] ?? ""); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What types of value are we going to get that we didn't get? Are they desirable? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change is preemptive and not related to the fix, here if we get a value of 0 in |
||
} catch (e) { | ||
logger.error( | ||
// temporary log to fix the valuesByCol[h].push is not a function error | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain a bit more? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb completely forgot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it was
{}["constructor"]
that caused the issueThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://app.datadoghq.eu/logs?query=%22Error%20uploading%20table%20to%20Dust.%22&agg_m=count&agg_m_source=base&agg_t=count&cols=host%2Cservice&fromUser=true&messageDisplay=inline&refresh_mode=paused&storage=hot&stream_sort=desc&viz=stream&from_ts=1733319867925&to_ts=1733319925679&live=false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spolu added a comment in code to explain the
Object.create(null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍