Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Forever310
druid
提交
0ddf667f
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,发现更多精彩内容 >>
提交
0ddf667f
编写于
8月 26, 2014
作者:
X
xvrl
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #705 from metamx/fix-timeseries-zero-filling
Fix extraneous timeseries zero filling at end of data interval
上级
28e31915
0eea1dc0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
126 addition
and
4 deletion
+126
-4
processing/src/main/java/io/druid/segment/QueryableIndexStorageAdapter.java
...n/java/io/druid/segment/QueryableIndexStorageAdapter.java
+4
-1
processing/src/main/java/io/druid/segment/incremental/IncrementalIndexStorageAdapter.java
...d/segment/incremental/IncrementalIndexStorageAdapter.java
+4
-1
processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java
.../io/druid/query/timeseries/TimeseriesQueryRunnerTest.java
+117
-0
processing/src/test/java/io/druid/segment/TestIndex.java
processing/src/test/java/io/druid/segment/TestIndex.java
+1
-2
未找到文件。
processing/src/main/java/io/druid/segment/QueryableIndexStorageAdapter.java
浏览文件 @
0ddf667f
...
@@ -138,7 +138,10 @@ public class QueryableIndexStorageAdapter implements StorageAdapter
...
@@ -138,7 +138,10 @@ public class QueryableIndexStorageAdapter implements StorageAdapter
{
{
Interval
actualInterval
=
interval
;
Interval
actualInterval
=
interval
;
final
Interval
dataInterval
=
new
Interval
(
getMinTime
().
getMillis
(),
gran
.
next
(
getMaxTime
().
getMillis
()));
final
Interval
dataInterval
=
new
Interval
(
getMinTime
().
getMillis
(),
gran
.
next
(
gran
.
truncate
(
getMaxTime
().
getMillis
()))
);
if
(!
actualInterval
.
overlaps
(
dataInterval
))
{
if
(!
actualInterval
.
overlaps
(
dataInterval
))
{
return
Sequences
.
empty
();
return
Sequences
.
empty
();
...
...
processing/src/main/java/io/druid/segment/incremental/IncrementalIndexStorageAdapter.java
浏览文件 @
0ddf667f
...
@@ -133,8 +133,11 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
...
@@ -133,8 +133,11 @@ public class IncrementalIndexStorageAdapter implements StorageAdapter
Interval
actualIntervalTmp
=
interval
;
Interval
actualIntervalTmp
=
interval
;
final
Interval
dataInterval
=
new
Interval
(
getMinTime
().
getMillis
(),
gran
.
next
(
gran
.
truncate
(
getMaxTime
().
getMillis
()))
);
final
Interval
dataInterval
=
new
Interval
(
getMinTime
().
getMillis
(),
gran
.
next
(
getMaxTime
().
getMillis
()));
if
(!
actualIntervalTmp
.
overlaps
(
dataInterval
))
{
if
(!
actualIntervalTmp
.
overlaps
(
dataInterval
))
{
return
Sequences
.
empty
();
return
Sequences
.
empty
();
}
}
...
...
processing/src/test/java/io/druid/query/timeseries/TimeseriesQueryRunnerTest.java
浏览文件 @
0ddf667f
...
@@ -21,7 +21,9 @@ package io.druid.query.timeseries;
...
@@ -21,7 +21,9 @@ package io.druid.query.timeseries;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Iterables
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.metamx.common.Granularity
;
import
com.metamx.common.guava.Sequences
;
import
com.metamx.common.guava.Sequences
;
import
io.druid.granularity.PeriodGranularity
;
import
io.druid.granularity.PeriodGranularity
;
import
io.druid.granularity.QueryGranularity
;
import
io.druid.granularity.QueryGranularity
;
...
@@ -465,6 +467,121 @@ public class TimeseriesQueryRunnerTest
...
@@ -465,6 +467,121 @@ public class TimeseriesQueryRunnerTest
TestHelper
.
assertExpectedResults
(
expectedResults1
,
results1
);
TestHelper
.
assertExpectedResults
(
expectedResults1
,
results1
);
}
}
@Test
public
void
testTimeseriesQueryZeroFilling
()
{
TimeseriesQuery
query1
=
Druids
.
newTimeseriesQueryBuilder
()
.
dataSource
(
QueryRunnerTestHelper
.
dataSource
)
.
filters
(
QueryRunnerTestHelper
.
providerDimension
,
"spot"
,
"upfront"
,
"total_market"
)
.
granularity
(
QueryGranularity
.
HOUR
)
.
intervals
(
Arrays
.
asList
(
new
Interval
(
"2011-04-14T00:00:00.000Z/2011-05-01T00:00:00.000Z"
)
)
)
.
aggregators
(
Arrays
.<
AggregatorFactory
>
asList
(
QueryRunnerTestHelper
.
rowsCount
,
new
LongSumAggregatorFactory
(
"idx"
,
"index"
)
)
)
.
build
();
List
<
Result
<
TimeseriesResultValue
>>
lotsOfZeroes
=
Lists
.
newArrayList
();
for
(
final
Long
millis
:
QueryGranularity
.
HOUR
.
iterable
(
new
DateTime
(
"2011-04-14T01"
).
getMillis
(),
new
DateTime
(
"2011-04-15"
).
getMillis
()
))
{
lotsOfZeroes
.
add
(
new
Result
<>(
new
DateTime
(
millis
),
new
TimeseriesResultValue
(
ImmutableMap
.<
String
,
Object
>
of
(
"rows"
,
0L
,
"idx"
,
0L
)
)
)
);
}
List
<
Result
<
TimeseriesResultValue
>>
expectedResults1
=
Lists
.
newArrayList
(
Iterables
.
concat
(
Arrays
.
asList
(
new
Result
<>(
new
DateTime
(
"2011-04-14T00"
),
new
TimeseriesResultValue
(
ImmutableMap
.<
String
,
Object
>
of
(
"rows"
,
13L
,
"idx"
,
4907L
)
)
)
),
lotsOfZeroes
,
Arrays
.
asList
(
new
Result
<>(
new
DateTime
(
"2011-04-15T00"
),
new
TimeseriesResultValue
(
ImmutableMap
.<
String
,
Object
>
of
(
"rows"
,
13L
,
"idx"
,
4717L
)
)
)
)
)
);
Iterable
<
Result
<
TimeseriesResultValue
>>
results1
=
Sequences
.
toList
(
runner
.
run
(
query1
),
Lists
.<
Result
<
TimeseriesResultValue
>>
newArrayList
()
);
TestHelper
.
assertExpectedResults
(
expectedResults1
,
results1
);
}
@Test
public
void
testTimeseriesQueryGranularityNotAlignedWithRollupGranularity
()
{
TimeseriesQuery
query1
=
Druids
.
newTimeseriesQueryBuilder
()
.
dataSource
(
QueryRunnerTestHelper
.
dataSource
)
.
filters
(
QueryRunnerTestHelper
.
providerDimension
,
"spot"
,
"upfront"
,
"total_market"
)
.
granularity
(
new
PeriodGranularity
(
new
Period
(
"PT1H"
),
new
DateTime
(
60000
),
DateTimeZone
.
UTC
)
)
.
intervals
(
Arrays
.
asList
(
new
Interval
(
"2011-04-15T00:00:00.000Z/2012"
)
)
)
.
aggregators
(
Arrays
.<
AggregatorFactory
>
asList
(
QueryRunnerTestHelper
.
rowsCount
,
new
LongSumAggregatorFactory
(
"idx"
,
"index"
)
)
)
.
build
();
List
<
Result
<
TimeseriesResultValue
>>
expectedResults1
=
Arrays
.
asList
(
new
Result
<
TimeseriesResultValue
>(
new
DateTime
(
"2011-04-14T23:01Z"
),
new
TimeseriesResultValue
(
ImmutableMap
.<
String
,
Object
>
of
(
"rows"
,
13L
,
"idx"
,
4717L
)
)
)
);
Iterable
<
Result
<
TimeseriesResultValue
>>
results1
=
Sequences
.
toList
(
runner
.
run
(
query1
),
Lists
.<
Result
<
TimeseriesResultValue
>>
newArrayList
()
);
TestHelper
.
assertExpectedResults
(
expectedResults1
,
results1
);
}
@Test
@Test
public
void
testTimeseriesWithVaryingGranWithFilter
()
public
void
testTimeseriesWithVaryingGranWithFilter
()
{
{
...
...
processing/src/test/java/io/druid/segment/TestIndex.java
浏览文件 @
0ddf667f
...
@@ -35,7 +35,6 @@ import io.druid.query.aggregation.AggregatorFactory;
...
@@ -35,7 +35,6 @@ import io.druid.query.aggregation.AggregatorFactory;
import
io.druid.query.aggregation.DoubleSumAggregatorFactory
;
import
io.druid.query.aggregation.DoubleSumAggregatorFactory
;
import
io.druid.query.aggregation.hyperloglog.HyperUniquesAggregatorFactory
;
import
io.druid.query.aggregation.hyperloglog.HyperUniquesAggregatorFactory
;
import
io.druid.query.aggregation.hyperloglog.HyperUniquesSerde
;
import
io.druid.query.aggregation.hyperloglog.HyperUniquesSerde
;
import
io.druid.segment.column.ColumnConfig
;
import
io.druid.segment.incremental.IncrementalIndex
;
import
io.druid.segment.incremental.IncrementalIndex
;
import
io.druid.segment.serde.ComplexMetrics
;
import
io.druid.segment.serde.ComplexMetrics
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTime
;
...
@@ -69,7 +68,7 @@ public class TestIndex
...
@@ -69,7 +68,7 @@ public class TestIndex
};
};
public
static
final
String
[]
DIMENSIONS
=
new
String
[]{
"provider"
,
"quALIty"
,
"plAcEmEnT"
,
"pLacementish"
};
public
static
final
String
[]
DIMENSIONS
=
new
String
[]{
"provider"
,
"quALIty"
,
"plAcEmEnT"
,
"pLacementish"
};
public
static
final
String
[]
METRICS
=
new
String
[]{
"iNdEx"
};
public
static
final
String
[]
METRICS
=
new
String
[]{
"iNdEx"
};
private
static
final
Interval
DATA_INTERVAL
=
new
Interval
(
"2011-01-12T00:00:00.000Z/2011-0
4-16
T00:00:00.000Z"
);
private
static
final
Interval
DATA_INTERVAL
=
new
Interval
(
"2011-01-12T00:00:00.000Z/2011-0
5-01
T00:00:00.000Z"
);
private
static
final
AggregatorFactory
[]
METRIC_AGGS
=
new
AggregatorFactory
[]{
private
static
final
AggregatorFactory
[]
METRIC_AGGS
=
new
AggregatorFactory
[]{
new
DoubleSumAggregatorFactory
(
METRICS
[
0
],
METRICS
[
0
]),
new
DoubleSumAggregatorFactory
(
METRICS
[
0
],
METRICS
[
0
]),
new
HyperUniquesAggregatorFactory
(
"quality_uniques"
,
"quality"
)
new
HyperUniquesAggregatorFactory
(
"quality_uniques"
,
"quality"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录