Fix momentsketch build issues (#7074)

* Fix momentsketch build issues

* Remove unused section in pom

* Fix test

* Remove unused method

* Checkstyle
This commit is contained in:
Jonathan Wei 2019-02-13 21:32:43 -08:00 committed by GitHub
parent 90c1a54b86
commit 1f29940811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 20 deletions

View File

@ -24,7 +24,7 @@
<parent>
<artifactId>druid</artifactId>
<groupId>org.apache.druid</groupId>
<version>0.14.0-incubating-SNAPSHOT</version>
<version>0.15.0-incubating-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -34,12 +34,6 @@
<name>druid-momentsketch</name>
<description>Aggregators for the approximate quantile moment sketch</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<druid.version>0.12.2</druid.version>
</properties>
<dependencies>
<dependency>
<groupId>com.github.stanford-futuredata.momentsketch</groupId>

View File

@ -22,6 +22,7 @@ package org.apache.druid.query.aggregation.momentsketch;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import org.apache.druid.initialization.DruidModule;
@ -74,9 +75,14 @@ public class MomentSketchModule implements DruidModule
@Override
public void configure(Binder binder)
{
ComplexMetrics.registerSerde(
MomentSketchAggregatorFactory.TYPE_NAME,
MomentSketchComplexMetricSerde::new
);
registerSerde();
}
@VisibleForTesting
public static void registerSerde()
{
if (ComplexMetrics.getSerdeForType(MomentSketchAggregatorFactory.TYPE_NAME) == null) {
ComplexMetrics.registerSerde(MomentSketchAggregatorFactory.TYPE_NAME, new MomentSketchComplexMetricSerde());
}
}
}

View File

@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF 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.
org.apache.druid.query.aggregation.momentsketch.MomentSketchModule

View File

@ -55,8 +55,8 @@ public class MomentsSketchAggregatorTest
public MomentsSketchAggregatorTest(final GroupByQueryConfig config)
{
MomentSketchModule.registerSerde();
DruidModule module = new MomentSketchModule();
module.configure(null);
helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
module.getJacksonModules(), config, tempFolder);
}

View File

@ -24,7 +24,6 @@ import org.apache.druid.java.util.common.ISE;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
/**
*/
@ -45,11 +44,4 @@ public class ComplexMetrics
}
complexSerializers.put(type, serde);
}
public static void registerSerde(String type, Supplier<ComplexMetricSerde> serdeSupplier)
{
if (ComplexMetrics.getSerdeForType(type) == null) {
ComplexMetrics.registerSerde(type, serdeSupplier.get());
}
}
}