This commit is contained in:
Adria Navarro 2024-11-04 10:48:14 +01:00
parent 36bbed35e3
commit e41315fb72
1 changed files with 18 additions and 37 deletions

View File

@ -420,6 +420,7 @@ export async function coreOutputProcessing(
rows = await processFormulas(table, rows, { dynamic: true })
// remove null properties to match internal API
const isExternal = isExternalTableID(table._id!)
for (const row of rows) {
for (const key of Object.keys(row)) {
if (row[key] === null) {
@ -434,6 +435,7 @@ export async function coreOutputProcessing(
}
}
}
}
if (sdk.views.isView(source)) {
// We ensure calculation fields are returned as numbers. During the
@ -460,28 +462,7 @@ export async function coreOutputProcessing(
}
}
}
}
if (sdk.views.isView(source)) {
const calculationFields = Object.keys(
helpers.views.calculationFields(source)
)
// We ensure all calculation fields are returned as numbers. During the
// testing of this feature it was discovered that the COUNT operation
// returns a string for MySQL, MariaDB, and Postgres. But given that all
// calculation fields should be numbers, we blanket make sure of that
// here.
for (const key of calculationFields) {
for (const row of rows) {
if (typeof row[key] === "string") {
row[key] = parseFloat(row[key])
}
}
}
}
const isExternal = isExternalTableID(table._id!)
if (!isUserMetadataTable(table._id!)) {
const protectedColumns = isExternal
? PROTECTED_EXTERNAL_COLUMNS