提交 33cde2d9 authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting, remove unnecessary constructors

上级 3ec97321
...@@ -301,7 +301,7 @@ public class Aggregate extends Expression { ...@@ -301,7 +301,7 @@ public class Aggregate extends Expression {
} }
Value v = data.getValue(session.getDatabase(), dataType, distinct); Value v = data.getValue(session.getDatabase(), dataType, distinct);
if (type == GROUP_CONCAT) { if (type == GROUP_CONCAT) {
ArrayList<Value> list = ((AggregateDataGroupConcat)data).getList(); ArrayList<Value> list = ((AggregateDataGroupConcat) data).getList();
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
return ValueNull.INSTANCE; return ValueNull.INSTANCE;
} }
......
...@@ -13,17 +13,18 @@ import org.h2.value.Value; ...@@ -13,17 +13,18 @@ import org.h2.value.Value;
* Abstract class for the computation of an aggregate. * Abstract class for the computation of an aggregate.
*/ */
abstract class AggregateData { abstract class AggregateData {
/** /**
* Create an AggregateData object of the correct subtype. * Create an AggregateData object of the correct sub-type.
* *
* @param aggregateType the type of the aggregate operation * @param aggregateType the type of the aggregate operation
* @return the aggregate data object of the specified type
*/ */
static AggregateData create(int aggregateType) { static AggregateData create(int aggregateType) {
if (aggregateType == Aggregate.SELECTIVITY) { if (aggregateType == Aggregate.SELECTIVITY) {
return new AggregateDataSelectivity(); return new AggregateDataSelectivity();
} else if (aggregateType == Aggregate.GROUP_CONCAT) { } else if (aggregateType == Aggregate.GROUP_CONCAT) {
return new AggregateDataGroupConcat(); return new AggregateDataGroupConcat();
} else if (aggregateType == Aggregate.COUNT_ALL) { } else if (aggregateType == Aggregate.COUNT_ALL) {
return new AggregateDataCountAll(); return new AggregateDataCountAll();
} else if (aggregateType == Aggregate.COUNT) { } else if (aggregateType == Aggregate.COUNT) {
...@@ -44,7 +45,7 @@ abstract class AggregateData { ...@@ -44,7 +45,7 @@ abstract class AggregateData {
* @param v the value * @param v the value
*/ */
abstract void add(Database database, int dataType, boolean distinct, Value v); abstract void add(Database database, int dataType, boolean distinct, Value v);
/** /**
* Get the aggregate result. * Get the aggregate result.
* *
......
...@@ -18,8 +18,6 @@ class AggregateDataCount extends AggregateData { ...@@ -18,8 +18,6 @@ class AggregateDataCount extends AggregateData {
private long count; private long count;
private ValueHashMap<AggregateDataCount> distinctValues; private ValueHashMap<AggregateDataCount> distinctValues;
AggregateDataCount() {}
@Override @Override
void add(Database database, int dataType, boolean distinct, Value v) { void add(Database database, int dataType, boolean distinct, Value v) {
if (v == ValueNull.INSTANCE) { if (v == ValueNull.INSTANCE) {
......
...@@ -17,8 +17,6 @@ import org.h2.value.ValueNull; ...@@ -17,8 +17,6 @@ import org.h2.value.ValueNull;
class AggregateDataCountAll extends AggregateData { class AggregateDataCountAll extends AggregateData {
private long count; private long count;
AggregateDataCountAll() {}
@Override @Override
void add(Database database, int dataType, boolean distinct, Value v) { void add(Database database, int dataType, boolean distinct, Value v) {
if (distinct) { if (distinct) {
......
...@@ -32,7 +32,7 @@ class AggregateDataDefault extends AggregateData { ...@@ -32,7 +32,7 @@ class AggregateDataDefault extends AggregateData {
AggregateDataDefault(int aggregateType) { AggregateDataDefault(int aggregateType) {
this.aggregateType = aggregateType; this.aggregateType = aggregateType;
} }
@Override @Override
void add(Database database, int dataType, boolean distinct, Value v) { void add(Database database, int dataType, boolean distinct, Value v) {
if (v == ValueNull.INSTANCE) { if (v == ValueNull.INSTANCE) {
......
...@@ -19,8 +19,6 @@ class AggregateDataGroupConcat extends AggregateData { ...@@ -19,8 +19,6 @@ class AggregateDataGroupConcat extends AggregateData {
private ArrayList<Value> list; private ArrayList<Value> list;
private ValueHashMap<AggregateDataGroupConcat> distinctValues; private ValueHashMap<AggregateDataGroupConcat> distinctValues;
AggregateDataGroupConcat() {}
@Override @Override
void add(Database database, int dataType, boolean distinct, Value v) { void add(Database database, int dataType, boolean distinct, Value v) {
if (v == ValueNull.INSTANCE) { if (v == ValueNull.INSTANCE) {
......
...@@ -22,8 +22,6 @@ class AggregateDataHistogram extends AggregateData { ...@@ -22,8 +22,6 @@ class AggregateDataHistogram extends AggregateData {
private long count; private long count;
private ValueHashMap<AggregateDataHistogram> distinctValues; private ValueHashMap<AggregateDataHistogram> distinctValues;
AggregateDataHistogram() {}
@Override @Override
void add(Database database, int dataType, boolean distinct, Value v) { void add(Database database, int dataType, boolean distinct, Value v) {
if (distinctValues == null) { if (distinctValues == null) {
......
...@@ -20,8 +20,6 @@ class AggregateDataSelectivity extends AggregateData { ...@@ -20,8 +20,6 @@ class AggregateDataSelectivity extends AggregateData {
private IntIntHashMap distinctHashes; private IntIntHashMap distinctHashes;
private double m2; private double m2;
AggregateDataSelectivity() {}
@Override @Override
void add(Database database, int dataType, boolean distinct, Value v) { void add(Database database, int dataType, boolean distinct, Value v) {
count++; count++;
...@@ -37,7 +35,7 @@ class AggregateDataSelectivity extends AggregateData { ...@@ -37,7 +35,7 @@ class AggregateDataSelectivity extends AggregateData {
// the value -1 is not supported // the value -1 is not supported
distinctHashes.put(hash, 1); distinctHashes.put(hash, 1);
} }
@Override @Override
Value getValue(Database database, int dataType, boolean distinct) { Value getValue(Database database, int dataType, boolean distinct) {
if (distinct) { if (distinct) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论