mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
feat: Support transformer
This commit is contained in:
parent
94d837a4f7
commit
0dbc431e1c
2 changed files with 24 additions and 14 deletions
|
|
@ -381,12 +381,24 @@ export function getFlattenCube(cube, schema) {
|
|||
return { rows: rows, keyColumnName: keyColumnName, groupNameSet: groupNameSet, }
|
||||
}
|
||||
|
||||
export function getTransform(conf, cube, schema) {
|
||||
let transformer = undefined
|
||||
/** return function for lazy computation */
|
||||
export function getTransformer(conf, rows, keyColumns, groupColumns, aggregatorColumns) {
|
||||
let transformer = () => {
|
||||
/** default is flatten cube */
|
||||
const { cube, schema, } = getCubeWithSchema(rows, keyColumns, groupColumns, aggregatorColumns);
|
||||
return getFlattenCube(cube, schema)
|
||||
}
|
||||
|
||||
const transformSpec = getCurrentChartTransform(conf)
|
||||
if (transformSpec && transformSpec.method === 'flatten') {
|
||||
/** return function for lazy computation */
|
||||
transformer = () => getFlattenCube(cube, schema)
|
||||
if (!transformSpec) { return transformer; }
|
||||
|
||||
if (transformSpec.method === 'raw') {
|
||||
transformer = () => { return rows; }
|
||||
} else if (transformSpec.method === 'cube') {
|
||||
transformer = () => {
|
||||
const { cube, } = getCubeWithSchema(rows, keyColumns, groupColumns, aggregatorColumns);
|
||||
return cube
|
||||
}
|
||||
}
|
||||
|
||||
return transformer
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import {
|
|||
isAggregator, isGroup, isKey, isSingleDimension,
|
||||
clearConfig, initializeConfig,
|
||||
removeDuplicatedColumnsInMultiDimensionAxis, applyMaxAxisCount,
|
||||
getCubeWithSchema, getColumnsFromAxis,
|
||||
getTransform,
|
||||
getColumnsFromAxis,
|
||||
getTransformer,
|
||||
} from './advanced-transformation-util';
|
||||
|
||||
import {
|
||||
|
|
@ -27,7 +27,6 @@ import {
|
|||
getCurrentChartAxis,
|
||||
getCurrentChartAxisSpecs,
|
||||
getCurrentChartParam,
|
||||
getCurrentChartTransform,
|
||||
} from './advanced-transformation-api'
|
||||
|
||||
const SETTING_TEMPLATE = 'app/tabledata/advanced-transformation-setting.html';
|
||||
|
|
@ -155,19 +154,18 @@ class AdvancedTransformation extends Transformation {
|
|||
const keyColumns = columns.key;
|
||||
const groupColumns = columns.group;
|
||||
const aggregatorColumns = columns.aggregator;
|
||||
const otherColumns = columns.others
|
||||
|
||||
const { cube, schema, } =
|
||||
getCubeWithSchema(tableData.rows, keyColumns, groupColumns, aggregatorColumns);
|
||||
|
||||
let transformer = getTransform(conf, cube, schema)
|
||||
let transformer = getTransformer(conf, tableData.rows, keyColumns, groupColumns, aggregatorColumns)
|
||||
|
||||
return {
|
||||
chart: chart, /** current chart */
|
||||
axis: axis, /** persisted axis */
|
||||
parameter: param, /** persisted parameter */
|
||||
column: {
|
||||
key: keyColumns, group: groupColumns, aggregator: aggregatorColumns, other: otherColumns,
|
||||
},
|
||||
|
||||
cube: cube, /** multi-dimensional data cube */
|
||||
schema: schema, /** schema for key, group, aggr info */
|
||||
transformer: transformer, /** { rows, keyColumnName, groupNameSet, } */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue