Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b284e144
提交
b284e144
authored
1月 19, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass data type to constructor of aggregate data
上级
b86b2b26
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
20 行增加
和
17 行删除
+20
-17
Aggregate.java
h2/src/main/org/h2/expression/aggregate/Aggregate.java
+4
-4
AggregateData.java
h2/src/main/org/h2/expression/aggregate/AggregateData.java
+5
-5
AggregateDataCollecting.java
.../org/h2/expression/aggregate/AggregateDataCollecting.java
+1
-1
AggregateDataCount.java
.../main/org/h2/expression/aggregate/AggregateDataCount.java
+1
-1
AggregateDataDefault.java
...ain/org/h2/expression/aggregate/AggregateDataDefault.java
+5
-2
AggregateDataDistinctWithCounts.java
...expression/aggregate/AggregateDataDistinctWithCounts.java
+1
-1
AggregateDataEnvelope.java
...in/org/h2/expression/aggregate/AggregateDataEnvelope.java
+1
-1
AggregateDataSelectivity.java
...org/h2/expression/aggregate/AggregateDataSelectivity.java
+1
-1
JavaAggregate.java
h2/src/main/org/h2/expression/aggregate/JavaAggregate.java
+1
-1
没有找到文件。
h2/src/main/org/h2/expression/aggregate/Aggregate.java
浏览文件 @
b284e144
...
...
@@ -303,7 +303,7 @@ public class Aggregate extends AbstractAggregate {
v
=
updateCollecting
(
session
,
v
,
remembered
);
}
}
data
.
add
(
session
.
getDatabase
(),
type
.
getValueType
(),
v
);
data
.
add
(
session
.
getDatabase
(),
v
);
}
@Override
...
...
@@ -376,7 +376,7 @@ public class Aggregate extends AbstractAggregate {
@Override
protected
Object
createAggregateData
()
{
return
AggregateData
.
create
(
aggregateType
,
distinct
);
return
AggregateData
.
create
(
aggregateType
,
distinct
,
type
.
getValueType
()
);
}
@Override
...
...
@@ -440,11 +440,11 @@ public class Aggregate extends AbstractAggregate {
if
(
c
.
getCount
()
==
0
)
{
return
ValueNull
.
INSTANCE
;
}
AggregateDataDefault
d
=
new
AggregateDataDefault
(
aggregateType
);
AggregateDataDefault
d
=
new
AggregateDataDefault
(
aggregateType
,
type
.
getValueType
()
);
Database
db
=
session
.
getDatabase
();
int
dataType
=
type
.
getValueType
();
for
(
Value
v
:
c
)
{
d
.
add
(
db
,
dataType
,
v
);
d
.
add
(
db
,
v
);
}
return
d
.
getValue
(
db
,
dataType
);
}
...
...
h2/src/main/org/h2/expression/aggregate/AggregateData.java
浏览文件 @
b284e144
...
...
@@ -21,9 +21,10 @@ abstract class AggregateData {
*
* @param aggregateType the type of the aggregate operation
* @param distinct if the calculation should be distinct
* @param dataType the data type of the computed result
* @return the aggregate data object of the specified type
*/
static
AggregateData
create
(
AggregateType
aggregateType
,
boolean
distinct
)
{
static
AggregateData
create
(
AggregateType
aggregateType
,
boolean
distinct
,
int
dataType
)
{
switch
(
aggregateType
)
{
case
COUNT_ALL:
return
new
AggregateDataCount
(
true
);
...
...
@@ -42,7 +43,7 @@ abstract class AggregateData {
case
BIT_AND:
case
ANY:
case
EVERY:
return
new
AggregateDataDefault
(
aggregateType
);
return
new
AggregateDataDefault
(
aggregateType
,
dataType
);
case
SUM:
case
AVG:
case
STDDEV_POP:
...
...
@@ -50,7 +51,7 @@ abstract class AggregateData {
case
VAR_POP:
case
VAR_SAMP:
if
(!
distinct
)
{
return
new
AggregateDataDefault
(
aggregateType
);
return
new
AggregateDataDefault
(
aggregateType
,
dataType
);
}
break
;
case
SELECTIVITY:
...
...
@@ -71,10 +72,9 @@ abstract class AggregateData {
* Add a value to this aggregate.
*
* @param database the database
* @param dataType the datatype of the computed result
* @param v the value
*/
abstract
void
add
(
Database
database
,
int
dataType
,
Value
v
);
abstract
void
add
(
Database
database
,
Value
v
);
/**
* Get the aggregate result.
...
...
h2/src/main/org/h2/expression/aggregate/AggregateDataCollecting.java
浏览文件 @
b284e144
...
...
@@ -41,7 +41,7 @@ class AggregateDataCollecting extends AggregateData implements Iterable<Value> {
}
@Override
void
add
(
Database
database
,
int
dataType
,
Value
v
)
{
void
add
(
Database
database
,
Value
v
)
{
if
(
v
==
ValueNull
.
INSTANCE
)
{
return
;
}
...
...
h2/src/main/org/h2/expression/aggregate/AggregateDataCount.java
浏览文件 @
b284e144
...
...
@@ -24,7 +24,7 @@ class AggregateDataCount extends AggregateData {
}
@Override
void
add
(
Database
database
,
int
dataType
,
Value
v
)
{
void
add
(
Database
database
,
Value
v
)
{
if
(
all
||
v
!=
ValueNull
.
INSTANCE
)
{
count
++;
}
...
...
h2/src/main/org/h2/expression/aggregate/AggregateDataDefault.java
浏览文件 @
b284e144
...
...
@@ -21,19 +21,22 @@ import org.h2.value.ValueNull;
class
AggregateDataDefault
extends
AggregateData
{
private
final
AggregateType
aggregateType
;
private
final
int
dataType
;
private
long
count
;
private
Value
value
;
private
double
m2
,
mean
;
/**
* @param aggregateType the type of the aggregate operation
* @param dataType the data type of the computed result
*/
AggregateDataDefault
(
AggregateType
aggregateType
)
{
AggregateDataDefault
(
AggregateType
aggregateType
,
int
dataType
)
{
this
.
aggregateType
=
aggregateType
;
this
.
dataType
=
dataType
;
}
@Override
void
add
(
Database
database
,
int
dataType
,
Value
v
)
{
void
add
(
Database
database
,
Value
v
)
{
if
(
v
==
ValueNull
.
INSTANCE
)
{
return
;
}
...
...
h2/src/main/org/h2/expression/aggregate/AggregateDataDistinctWithCounts.java
浏览文件 @
b284e144
...
...
@@ -37,7 +37,7 @@ class AggregateDataDistinctWithCounts extends AggregateData {
}
@Override
void
add
(
Database
database
,
int
dataType
,
Value
v
)
{
void
add
(
Database
database
,
Value
v
)
{
if
(
ignoreNulls
&&
v
==
ValueNull
.
INSTANCE
)
{
return
;
}
...
...
h2/src/main/org/h2/expression/aggregate/AggregateDataEnvelope.java
浏览文件 @
b284e144
...
...
@@ -57,7 +57,7 @@ class AggregateDataEnvelope extends AggregateData {
}
@Override
void
add
(
Database
database
,
int
dataType
,
Value
v
)
{
void
add
(
Database
database
,
Value
v
)
{
if
(
v
==
ValueNull
.
INSTANCE
)
{
return
;
}
...
...
h2/src/main/org/h2/expression/aggregate/AggregateDataSelectivity.java
浏览文件 @
b284e144
...
...
@@ -32,7 +32,7 @@ class AggregateDataSelectivity extends AggregateData {
}
@Override
void
add
(
Database
database
,
int
dataType
,
Value
v
)
{
void
add
(
Database
database
,
Value
v
)
{
count
++;
if
(
distinctHashes
==
null
)
{
distinctHashes
=
new
IntIntHashMap
();
...
...
h2/src/main/org/h2/expression/aggregate/JavaAggregate.java
浏览文件 @
b284e144
...
...
@@ -193,7 +193,7 @@ public class JavaAggregate extends AbstractAggregate {
arg
=
arg
.
convertTo
(
argTypes
[
i
]);
argValues
[
i
]
=
arg
;
}
data
.
add
(
session
.
getDatabase
(),
dataType
,
args
.
length
==
1
?
arg
:
ValueArray
.
get
(
argValues
));
data
.
add
(
session
.
getDatabase
(),
args
.
length
==
1
?
arg
:
ValueArray
.
get
(
argValues
));
}
else
{
Aggregate
agg
=
(
Aggregate
)
aggregateData
;
Object
[]
argValues
=
new
Object
[
args
.
length
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论