StringBuilder label = new StringBuilder();
if (originalTable.containsColumn(column.getId())) {
label.append(originalTable.getColumnDescription(column.getId()).getLabel());
} else {
if (column instanceof AggregationColumn) {
AggregationColumn aggColumn = (AggregationColumn) column;
label.append(aggColumn.getAggregationType().getCode()).append(" ").
append(originalTable.getColumnDescription(
aggColumn.getAggregatedColumn().getId()).getLabel());
} else {
ScalarFunctionColumn scalarFunctionColumn = (ScalarFunctionColumn) column;
List<AbstractColumn> columns = scalarFunctionColumn.getColumns();
label.append(scalarFunctionColumn.getFunction().getFunctionName()).append("(");
for (AbstractColumn abstractColumn : columns) {