Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Questdb
提交
dfa90cbc
Q
Questdb
项目概览
jobily
/
Questdb
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Questdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dfa90cbc
编写于
1月 12, 2015
作者:
V
Vlad Ilyushchenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6 replaced arrays with explicit variables for clarity and performance.
上级
0e002897
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
32 addition
and
90 deletion
+32
-90
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/AbstractAggregatorFunction.java
...m/nfsdb/lang/cst/impl/agg/AbstractAggregatorFunction.java
+0
-42
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/AbstractSingleColumnAggregatorFunction.java
.../cst/impl/agg/AbstractSingleColumnAggregatorFunction.java
+10
-8
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/CountIntAggregatorFunction.java
...m/nfsdb/lang/cst/impl/agg/CountIntAggregatorFunction.java
+5
-11
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/CountLongAggregatorFunction.java
.../nfsdb/lang/cst/impl/agg/CountLongAggregatorFunction.java
+5
-14
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/FirstDoubleAggregationFunction.java
...sdb/lang/cst/impl/agg/FirstDoubleAggregationFunction.java
+2
-2
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/FirstLongAggregationFunction.java
...nfsdb/lang/cst/impl/agg/FirstLongAggregationFunction.java
+1
-1
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/LastDoubleAggregationFunction.java
...fsdb/lang/cst/impl/agg/LastDoubleAggregationFunction.java
+2
-2
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/LastLongAggregationFunction.java
.../nfsdb/lang/cst/impl/agg/LastLongAggregationFunction.java
+1
-1
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/SumDoubleAggregationFunction.java
...nfsdb/lang/cst/impl/agg/SumDoubleAggregationFunction.java
+2
-3
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/SumIntAggregationFunction.java
...om/nfsdb/lang/cst/impl/agg/SumIntAggregationFunction.java
+2
-3
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/SumIntToLongAggregationFunction.java
...db/lang/cst/impl/agg/SumIntToLongAggregationFunction.java
+2
-3
未找到文件。
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/AbstractAggregatorFunction.java
已删除
100644 → 0
浏览文件 @
0e002897
/*
* Copyright (c) 2014. Vlad Ilyushchenko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.nfsdb.lang.cst.impl.agg
;
import
com.nfsdb.factory.configuration.ColumnMetadata
;
public
abstract
class
AbstractAggregatorFunction
implements
AggregatorFunction
{
private
int
map
[];
@Override
public
final
ColumnMetadata
[]
getColumns
()
{
ColumnMetadata
[]
m
=
getColumnsInternal
();
map
=
new
int
[
m
.
length
];
return
m
;
}
@Override
public
final
void
mapColumn
(
int
k
,
int
i
)
{
map
[
k
]
=
i
;
}
protected
abstract
ColumnMetadata
[]
getColumnsInternal
();
protected
int
map
(
int
x
)
{
return
map
[
x
];
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/AbstractSingleColumnAggregatorFunction.java
浏览文件 @
dfa90cbc
/*
* Copyright (c) 2014. Vlad Ilyushchenko
* Copyright (c) 2014
-2015
. Vlad Ilyushchenko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,25 +20,27 @@ import com.nfsdb.factory.configuration.ColumnMetadata;
import
com.nfsdb.lang.cst.impl.qry.Record
;
import
com.nfsdb.lang.cst.impl.qry.RecordSource
;
public
abstract
class
AbstractSingleColumnAggregatorFunction
extends
Abstract
AggregatorFunction
{
public
abstract
class
AbstractSingleColumnAggregatorFunction
implements
AggregatorFunction
{
private
final
ColumnMetadata
[]
meta
=
new
ColumnMetadata
[
1
];
private
int
columnIndex
;
protected
int
recordIndex
;
protected
int
valueIndex
;
public
AbstractSingleColumnAggregatorFunction
(
ColumnMetadata
meta
)
{
this
.
meta
[
0
]
=
meta
;
}
@Override
p
rotected
final
ColumnMetadata
[]
getColumnsInternal
()
{
p
ublic
ColumnMetadata
[]
getColumns
()
{
return
meta
;
}
protected
final
int
getColumnIndex
()
{
return
columnIndex
;
@Override
public
void
mapColumn
(
int
k
,
int
i
)
{
valueIndex
=
i
;
}
@Override
public
final
void
prepareSource
(
RecordSource
<?
extends
Record
>
source
)
{
this
.
column
Index
=
source
.
getMetadata
().
getColumnIndex
(
meta
[
0
].
name
);
public
void
prepareSource
(
RecordSource
<?
extends
Record
>
source
)
{
this
.
record
Index
=
source
.
getMetadata
().
getColumnIndex
(
meta
[
0
].
name
);
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/CountIntAggregatorFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -22,30 +22,24 @@ import com.nfsdb.factory.configuration.ColumnMetadata;
import
com.nfsdb.lang.cst.impl.qry.Record
;
import
com.nfsdb.lang.cst.impl.qry.RecordSource
;
public
class
CountIntAggregatorFunction
extends
AbstractAggregatorFunction
{
public
class
CountIntAggregatorFunction
extends
Abstract
SingleColumn
AggregatorFunction
{
private
final
ColumnMetadata
[]
meta
=
new
ColumnMetadata
[
1
];
public
CountIntAggregatorFunction
(
String
name
)
{
this
.
meta
[
0
]
=
new
ColumnMetadata
().
setName
(
name
).
setType
(
ColumnType
.
INT
);
}
@Override
protected
ColumnMetadata
[]
getColumnsInternal
()
{
return
meta
;
super
(
new
ColumnMetadata
().
setName
(
name
).
setType
(
ColumnType
.
INT
));
}
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putInt
(
map
(
0
)
,
1
);
values
.
putInt
(
valueIndex
,
1
);
}
else
{
values
.
putInt
(
map
(
0
),
values
.
getInt
(
map
(
0
)
)
+
1
);
values
.
putInt
(
valueIndex
,
values
.
getInt
(
valueIndex
)
+
1
);
}
}
@Override
public
void
prepareSource
(
RecordSource
<?
extends
Record
>
source
)
{
// do not call parent method, which will be trying to lookup column in record source.
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/CountLongAggregatorFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -22,32 +22,23 @@ import com.nfsdb.factory.configuration.ColumnMetadata;
import
com.nfsdb.lang.cst.impl.qry.Record
;
import
com.nfsdb.lang.cst.impl.qry.RecordSource
;
public
class
CountLongAggregatorFunction
extends
AbstractAggregatorFunction
{
private
final
ColumnMetadata
[]
meta
=
new
ColumnMetadata
[
1
];
public
class
CountLongAggregatorFunction
extends
AbstractSingleColumnAggregatorFunction
{
public
CountLongAggregatorFunction
(
String
name
)
{
this
.
meta
[
0
]
=
new
ColumnMetadata
();
this
.
meta
[
0
].
name
=
name
;
this
.
meta
[
0
].
type
=
ColumnType
.
LONG
;
}
@Override
protected
ColumnMetadata
[]
getColumnsInternal
()
{
return
meta
;
super
(
new
ColumnMetadata
().
setName
(
name
).
setType
(
ColumnType
.
LONG
));
}
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putLong
(
map
(
0
)
,
1
);
values
.
putLong
(
valueIndex
,
1
);
}
else
{
values
.
putLong
(
map
(
0
),
values
.
getLong
(
map
(
0
)
)
+
1
);
values
.
putLong
(
valueIndex
,
values
.
getLong
(
valueIndex
)
+
1
);
}
}
@Override
public
void
prepareSource
(
RecordSource
<?
extends
Record
>
source
)
{
// do not call parent method, which will be trying to lookup column in record source.
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/FirstDoubleAggregationFunction.java
浏览文件 @
dfa90cbc
/*
* Copyright (c) 2014. Vlad Ilyushchenko
* Copyright (c) 2014
-2015
. Vlad Ilyushchenko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -29,7 +29,7 @@ public class FirstDoubleAggregationFunction extends AbstractSingleColumnAggregat
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putDouble
(
map
(
0
),
rec
.
getDouble
(
getColumnIndex
()
));
values
.
putDouble
(
valueIndex
,
rec
.
getDouble
(
recordIndex
));
}
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/FirstLongAggregationFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -29,7 +29,7 @@ public class FirstLongAggregationFunction extends AbstractSingleColumnAggregator
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putLong
(
map
(
0
),
rec
.
getLong
(
getColumnIndex
()
));
values
.
putLong
(
valueIndex
,
rec
.
getLong
(
recordIndex
));
}
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/LastDoubleAggregationFunction.java
浏览文件 @
dfa90cbc
/*
* Copyright (c) 2014. Vlad Ilyushchenko
* Copyright (c) 2014
-2015
. Vlad Ilyushchenko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -28,6 +28,6 @@ public class LastDoubleAggregationFunction extends AbstractSingleColumnAggregato
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
values
.
putDouble
(
map
(
0
),
rec
.
getDouble
(
getColumnIndex
()
));
values
.
putDouble
(
valueIndex
,
rec
.
getDouble
(
recordIndex
));
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/LastLongAggregationFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -28,6 +28,6 @@ public class LastLongAggregationFunction extends AbstractSingleColumnAggregatorF
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
values
.
putLong
(
map
(
0
),
rec
.
getLong
(
getColumnIndex
()
));
values
.
putLong
(
valueIndex
,
rec
.
getLong
(
recordIndex
));
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/SumDoubleAggregationFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -28,10 +28,9 @@ public class SumDoubleAggregationFunction extends AbstractSingleColumnAggregator
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putDouble
(
map
(
0
),
rec
.
getDouble
(
getColumnIndex
()
));
values
.
putDouble
(
valueIndex
,
rec
.
getDouble
(
recordIndex
));
}
else
{
int
c
=
map
(
0
);
values
.
putDouble
(
c
,
values
.
getDouble
(
c
)
+
rec
.
getDouble
(
getColumnIndex
()));
values
.
putDouble
(
valueIndex
,
values
.
getDouble
(
valueIndex
)
+
rec
.
getDouble
(
recordIndex
));
}
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/SumIntAggregationFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -28,10 +28,9 @@ public class SumIntAggregationFunction extends AbstractSingleColumnAggregatorFun
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putInt
(
map
(
0
),
rec
.
getInt
(
getColumnIndex
()
));
values
.
putInt
(
valueIndex
,
rec
.
getInt
(
recordIndex
));
}
else
{
int
c
=
map
(
0
);
values
.
putInt
(
c
,
values
.
getInt
(
c
)
+
rec
.
getInt
(
getColumnIndex
()));
values
.
putInt
(
valueIndex
,
values
.
getInt
(
valueIndex
)
+
rec
.
getInt
(
recordIndex
));
}
}
}
nfsdb-core/src/main/java/com/nfsdb/lang/cst/impl/agg/SumIntToLongAggregationFunction.java
浏览文件 @
dfa90cbc
...
...
@@ -29,10 +29,9 @@ public class SumIntToLongAggregationFunction extends AbstractSingleColumnAggrega
@Override
public
void
calculate
(
Record
rec
,
MapValues
values
)
{
if
(
values
.
isNew
())
{
values
.
putLong
(
map
(
0
),
rec
.
getInt
(
getColumnIndex
()
));
values
.
putLong
(
valueIndex
,
rec
.
getInt
(
recordIndex
));
}
else
{
int
c
=
map
(
0
);
values
.
putLong
(
c
,
values
.
getLong
(
c
)
+
rec
.
getInt
(
getColumnIndex
()));
values
.
putLong
(
valueIndex
,
values
.
getLong
(
valueIndex
)
+
rec
.
getInt
(
recordIndex
));
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录