提交 f97e07da authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Split DataAnalysisOperation.getData()

上级 55cd7e22
......@@ -119,10 +119,14 @@ public abstract class AbstractAggregate extends DataAnalysisOperation {
protected void updateAggregate(Session session, SelectGroups groupData, int groupRowId) {
if (filterCondition == null || filterCondition.getBooleanValue(session)) {
ArrayList<SelectOrderBy> orderBy;
if (over != null && (orderBy = over.getOrderBy()) != null) {
if (over != null) {
if ((orderBy = over.getOrderBy()) != null) {
updateOrderedAggregate(session, groupData, groupRowId, orderBy);
} else {
updateAggregate(session, getData(session, groupData, false, false));
updateAggregate(session, getWindowData(session, groupData, false, false));
}
} else {
updateAggregate(session, getGroupData(groupData, false));
}
}
}
......
......@@ -182,9 +182,8 @@ public abstract class DataAnalysisOperation extends Expression {
*/
protected abstract void rememberExpressions(Session session, Value[] array);
protected Object getData(Session session, SelectGroups groupData, boolean ifExists, boolean forOrderBy) {
protected Object getWindowData(Session session, SelectGroups groupData, boolean ifExists, boolean forOrderBy) {
Object data;
if (over != null) {
ValueArray key = over.getCurrentKey(session);
PartitionData partition = groupData.getWindowExprData(this, key);
if (partition == null) {
......@@ -196,7 +195,11 @@ public abstract class DataAnalysisOperation extends Expression {
} else {
data = partition.getData();
}
} else {
return data;
}
protected Object getGroupData(SelectGroups groupData, boolean ifExists) {
Object data;
data = groupData.getCurrentGroupExprData(this);
if (data == null) {
if (ifExists) {
......@@ -205,7 +208,6 @@ public abstract class DataAnalysisOperation extends Expression {
data = createAggregateData();
groupData.setCurrentGroupExprData(this, data);
}
}
return data;
}
......@@ -241,7 +243,7 @@ public abstract class DataAnalysisOperation extends Expression {
if (groupData == null) {
throw DbException.get(ErrorCode.INVALID_USE_OF_AGGREGATE_FUNCTION_1, getSQL());
}
return over == null ? getAggregatedValue(session, getData(session, groupData, true, false))
return over == null ? getAggregatedValue(session, getGroupData(groupData, true))
: getWindowResult(session, groupData);
}
......@@ -293,7 +295,7 @@ public abstract class DataAnalysisOperation extends Expression {
}
array[ne] = ValueInt.get(groupRowId);
@SuppressWarnings("unchecked")
ArrayList<Value[]> data = (ArrayList<Value[]>) getData(session, groupData, false, true);
ArrayList<Value[]> data = (ArrayList<Value[]>) getWindowData(session, groupData, false, true);
data.add(array);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论