You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have multiple tables that I want to concatenate, if the first table is empty, then the final concatenated table is also empty.
Code:
export async function fetchArrowFilesAndConcat(fetches: Parameters<typeof fetch>[0][]) {
let table: ColumnTable | undefined = undefined
for (const f of fetches) {
const response = await fetch(f)
const responseData = await response.arrayBuffer()
const newTable = aq.fromArrow(responseData)
table = table === undefined ? newTable : table.concat(newTable)
}
assertDefined(table, `table must be defined`)
return table // table is empty here if the first table was empty
}
And this is a fixed version - I skip the first empty table:
export async function fetchArrowFilesAndConcat(fetches: Parameters<typeof fetch>[0][]) {
let table: ColumnTable | undefined = undefined
let emptyTableSkipped = false
for (const f of fetches) {
const response = await fetch(f)
const responseData = await response.arrayBuffer()
const newTable = aq.fromArrow(responseData)
const numRows = newTable.numRows()
if (numRows === 0 && emptyTableSkipped === false) {
emptyTableSkipped = true
continue // skip first empty table, because it's causing the final table to be empty as well
}
table = table === undefined ? newTable : table.concat(newTable)
}
assertDefined(table, `table must be defined`)
return table
}
The text was updated successfully, but these errors were encountered:
If I have multiple tables that I want to concatenate, if the first table is empty, then the final concatenated table is also empty.
Code:
And this is a fixed version - I skip the first empty table:
The text was updated successfully, but these errors were encountered: