Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Forever310
druid
提交
918ee874
D
druid
项目概览
Forever310
/
druid
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
druid
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
918ee874
编写于
5月 15, 2014
作者:
G
Gian Merlino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More JS aggregator tests.
上级
d389fbc9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
52 addition
and
3 deletion
+52
-3
processing/src/test/java/io/druid/query/QueryRunnerTestHelper.java
...g/src/test/java/io/druid/query/QueryRunnerTestHelper.java
+8
-1
processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java
.../io/druid/query/timeseries/TimeseriesQueryRunnerTest.java
+44
-2
未找到文件。
processing/src/test/java/io/druid/query/QueryRunnerTestHelper.java
浏览文件 @
918ee874
...
...
@@ -81,13 +81,20 @@ public class QueryRunnerTestHelper
public
static
final
CountAggregatorFactory
rowsCount
=
new
CountAggregatorFactory
(
"rows"
);
public
static
final
LongSumAggregatorFactory
indexLongSum
=
new
LongSumAggregatorFactory
(
"index"
,
"index"
);
public
static
final
DoubleSumAggregatorFactory
indexDoubleSum
=
new
DoubleSumAggregatorFactory
(
"index"
,
"index"
);
public
static
final
JavaScriptAggregatorFactory
indexSumJsPlacementishN
=
new
JavaScriptAggregatorFactory
(
public
static
final
JavaScriptAggregatorFactory
jsIndexSumIfPlacementishA
=
new
JavaScriptAggregatorFactory
(
"nindex"
,
Arrays
.
asList
(
"placementish"
,
"index"
),
"function aggregate(current, a, b) { if ((Array.isArray(a) && a.indexOf('a') > -1) || a === 'a') { return current + b; } else { return current; } }"
,
"function reset() { return 0; }"
,
"function combine(a, b) { return a + b; }"
);
public
static
final
JavaScriptAggregatorFactory
jsPlacementishCount
=
new
JavaScriptAggregatorFactory
(
"pishcount"
,
Arrays
.
asList
(
"placementish"
,
"index"
),
"function aggregate(current, a) { if (Array.isArray(a)) { return current + a.length; } else if (typeof a === 'string') { return current + 1; } else { return current; } }"
,
"function reset() { return 0; }"
,
"function combine(a, b) { return a + b; }"
);
public
static
final
HyperUniquesAggregatorFactory
qualityUniques
=
new
HyperUniquesAggregatorFactory
(
"uniques"
,
"quality_uniques"
...
...
processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java
浏览文件 @
918ee874
...
...
@@ -1273,7 +1273,8 @@ public class TimeseriesQueryRunnerTest
.
aggregators
(
ImmutableList
.
of
(
QueryRunnerTestHelper
.
indexDoubleSum
,
QueryRunnerTestHelper
.
indexSumJsPlacementishN
QueryRunnerTestHelper
.
jsIndexSumIfPlacementishA
,
QueryRunnerTestHelper
.
jsPlacementishCount
)
)
.
build
();
...
...
@@ -1288,7 +1289,48 @@ public class TimeseriesQueryRunnerTest
new
TimeseriesResultValue
(
ImmutableMap
.<
String
,
Object
>
of
(
"index"
,
12459.361190795898d
,
"nindex"
,
283.31103515625d
"nindex"
,
283.31103515625d
,
"pishcount"
,
52
d
)
)
)
);
Iterable
<
Result
<
TimeseriesResultValue
>>
actualResults
=
Sequences
.
toList
(
runner
.
run
(
query
),
Lists
.<
Result
<
TimeseriesResultValue
>>
newArrayList
()
);
TestHelper
.
assertExpectedResults
(
expectedResults
,
actualResults
);
}
@Test
public
void
testTimeseriesWithMultiValueFilteringJavascriptAggregatorAndAlsoRegularFilters
()
{
TimeseriesQuery
query
=
Druids
.
newTimeseriesQueryBuilder
()
.
dataSource
(
QueryRunnerTestHelper
.
dataSource
)
.
granularity
(
QueryRunnerTestHelper
.
allGran
)
.
filters
(
QueryRunnerTestHelper
.
placementishDimension
,
"a"
)
.
intervals
(
QueryRunnerTestHelper
.
firstToThird
)
.
aggregators
(
ImmutableList
.
of
(
QueryRunnerTestHelper
.
indexDoubleSum
,
QueryRunnerTestHelper
.
jsIndexSumIfPlacementishA
,
QueryRunnerTestHelper
.
jsPlacementishCount
)
)
.
build
();
Iterable
<
Result
<
TimeseriesResultValue
>>
expectedResults
=
ImmutableList
.
of
(
new
Result
<>(
new
DateTime
(
QueryRunnerTestHelper
.
firstToThird
.
getIntervals
()
.
get
(
0
)
.
getStart
()
),
new
TimeseriesResultValue
(
ImmutableMap
.<
String
,
Object
>
of
(
"index"
,
283.31103515625d
,
"nindex"
,
283.31103515625d
,
"pishcount"
,
4
d
)
)
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录