mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix: Set proper aggr value when 0 group
This commit is contained in:
parent
20f9437de2
commit
812f9a2c64
1 changed files with 10 additions and 3 deletions
|
|
@ -473,8 +473,8 @@ export function getObjectRowsFromCube(cube, schema, aggregatorColumns,
|
|||
const selectorSet = new Set()
|
||||
|
||||
const rows = keyNames.reduce((acc, key) => {
|
||||
const keyed = cube[key]
|
||||
const row = getObjectRow(schema, aggregatorColumns, keyed, groupNameSet, selectorSet)
|
||||
const obj = cube[key]
|
||||
const row = getObjectRow(schema, aggregatorColumns, obj, groupNameSet, selectorSet)
|
||||
|
||||
if (schema.key) { row[keyColumnName] = key }
|
||||
acc.push(row)
|
||||
|
|
@ -493,13 +493,20 @@ export function getObjectRow(schema, aggrColumns, obj, groupNameSet, selectorSet
|
|||
if (!schema.group) {
|
||||
for(let i = 0; i < aggrColumns.length; i++) {
|
||||
const aggrColumn = aggrColumns[i]
|
||||
const aggrName = aggrColumn.name
|
||||
|
||||
const selector = aggrColumn.name
|
||||
selectorSet.add(selector)
|
||||
|
||||
let value = null
|
||||
try {
|
||||
value = obj[selector].value;
|
||||
if (aggrColumn.aggr === Aggregator.AVG) {
|
||||
value = aggrColumn[aggrName].value / aggrColumn[aggrName].count
|
||||
} else if (aggrColumn.aggr === Aggregator.COUNT) {
|
||||
value = aggrColumn[aggrName].count
|
||||
} else {
|
||||
value = aggrColumn[aggrName].value
|
||||
}
|
||||
if (typeof value === 'undefined') { value = null }
|
||||
} catch (error) { /** iognore */ }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue