Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions extensions-contrib/momentsketch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;
Expand Down Expand Up @@ -74,9 +75,14 @@ public List<? extends Module> getJacksonModules()
@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());
}
}
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

/**
*/
Expand All @@ -45,11 +44,4 @@ public static void registerSerde(String type, ComplexMetricSerde serde)
}
complexSerializers.put(type, serde);
}

public static void registerSerde(String type, Supplier<ComplexMetricSerde> serdeSupplier)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jon-wei this method was added on purpose to be used in other modules. See #7058.

{
if (ComplexMetrics.getSerdeForType(type) == null) {
ComplexMetrics.registerSerde(type, serdeSupplier.get());
}
}
}