提交 4195c470 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract updateCollecting() from Aggregate.updateAggregate()

上级 ba63ffc6
......@@ -315,21 +315,22 @@ public class Aggregate extends Expression {
Value v = on == null ? null : on.getValue(session);
if (type == AggregateType.GROUP_CONCAT) {
if (v != ValueNull.INSTANCE) {
v = v.convertTo(Value.STRING);
if (orderByList != null) {
int size = orderByList.size();
Value[] array = new Value[1 + size];
array[0] = v;
for (int i = 0; i < size; i++) {
SelectOrderBy o = orderByList.get(i);
array[i + 1] = o.expression.getValue(session);
v = updateCollecting(session, v.convertTo(Value.STRING));
}
v = ValueArray.get(array);
} else if (type == AggregateType.ARRAY_AGG) {
if (v != ValueNull.INSTANCE) {
v = updateCollecting(session, v);
}
}
if (filterCondition != null) {
if (!filterCondition.getBooleanValue(session)) {
return;
}
if (type == AggregateType.ARRAY_AGG) {
if (v != ValueNull.INSTANCE) {
}
data.add(session.getDatabase(), dataType, distinct, v);
}
private Value updateCollecting(Session session, Value v) {
if (orderByList != null) {
int size = orderByList.size();
Value[] array = new Value[1 + size];
......@@ -340,14 +341,7 @@ public class Aggregate extends Expression {
}
v = ValueArray.get(array);
}
}
}
if (filterCondition != null) {
if (!filterCondition.getBooleanValue(session)) {
return;
}
}
data.add(session.getDatabase(), dataType, distinct, v);
return v;
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论