-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
groupBy v2: Ignore timestamp completely when granularity = all, excep…
…t for the final merge. (#3740) * GroupByBenchmark: Add serde, spilling, all-gran benchmarks. Also use more iterations. * groupBy v2: Ignore timestamp completely when granularity = all, except for the final merge. Specifically: - Remove timestamp from RowBasedKey when not needed - Set timestamp to null in MapBasedRows that are not part of the final merge.
- Loading branch information
Showing
6 changed files
with
322 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
benchmarks/src/main/java/io/druid/benchmark/query/SerializingQueryRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Licensed to Metamarkets Group Inc. (Metamarkets) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. Metamarkets licenses this file | ||
* to you 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 io.druid.benchmark.query; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.google.common.base.Function; | ||
import io.druid.java.util.common.guava.Sequence; | ||
import io.druid.java.util.common.guava.Sequences; | ||
import io.druid.query.Query; | ||
import io.druid.query.QueryRunner; | ||
|
||
import java.util.Map; | ||
|
||
public class SerializingQueryRunner<T> implements QueryRunner<T> | ||
{ | ||
private final ObjectMapper smileMapper; | ||
private final QueryRunner<T> baseRunner; | ||
private final Class<T> clazz; | ||
|
||
public SerializingQueryRunner( | ||
ObjectMapper smileMapper, | ||
Class<T> clazz, | ||
QueryRunner<T> baseRunner | ||
) | ||
{ | ||
this.smileMapper = smileMapper; | ||
this.clazz = clazz; | ||
this.baseRunner = baseRunner; | ||
} | ||
|
||
@Override | ||
public Sequence<T> run( | ||
final Query<T> query, | ||
final Map<String, Object> responseContext | ||
) | ||
{ | ||
return Sequences.map( | ||
baseRunner.run(query, responseContext), | ||
new Function<T, T>() | ||
{ | ||
@Override | ||
public T apply(T input) | ||
{ | ||
try { | ||
return smileMapper.readValue(smileMapper.writeValueAsBytes(input), clazz); | ||
} | ||
catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.