From 2a46086e2077892a0c47826e38378b02441b60c0 Mon Sep 17 00:00:00 2001 From: cheddar Date: Thu, 29 Aug 2013 15:25:36 -0500 Subject: [PATCH] 1) Didn't remove the io.druid files from client. Remove those and make sure things compile 2) Switch DefaultObjectMapper to CommonObjectMapper 3) Create new DefaultObjectMapper in client that has Query stuff registered on it by default --- .../com/metamx/druid/sql/antlr4/DruidSQL.g4 | 2 +- .../main/java/com/metamx/druid/BaseQuery.java | 137 ------------------ .../metamx/druid/guice/QueryableModule.java | 21 ++- .../druid/http/ClientQuerySegmentWalker.java | 4 +- .../http/DirectClientQuerySegmentWalker.java | 4 +- .../com/metamx/druid/http/QueryServlet.java | 4 +- .../druid/jackson/DefaultObjectMapper.java} | 19 ++- .../druid/jackson/QueryRegisteringModule.java | 85 +++++++++++ .../query/dimension/DefaultDimensionSpec.java | 5 +- .../druid/query/dimension/DimensionSpec.java | 39 ----- .../dimension/ExtractionDimensionSpec.java | 5 +- .../query/extraction/DimExtractionFn.java | 38 ----- .../extraction/PartialDimExtractionFn.java | 3 +- .../extraction/RegexDimExtractionFn.java | 3 +- .../SearchQuerySpecDimExtractionFn.java | 3 +- .../query/extraction/TimeDimExtractionFn.java | 3 +- .../query/filter/ExtractionDimFilter.java | 4 +- .../druid/query/group/GroupByQuery.java | 9 +- .../group/GroupByQueryQueryToolChest.java | 4 +- .../query/group/orderby/DefaultLimitSpec.java | 4 +- .../druid/query/group/orderby/LimitSpec.java | 4 +- .../query/group/orderby/NoopLimitSpec.java | 21 ++- .../query/metadata/SegmentMetadataQuery.java | 6 +- .../druid/query/search/SearchQuery.java | 7 +- .../query/segment/QuerySegmentWalker.java | 47 ------ .../query/segment/SpecificSegmentSpec.java | 3 +- .../query/timeboundary/TimeBoundaryQuery.java | 7 +- .../query/timeseries/TimeseriesQuery.java | 7 +- .../java/com/metamx/druid/sql/SQLRunner.java | 21 ++- .../java/io/druid/query/CacheStrategy.java | 39 ----- .../src/main/java/io/druid/query/Query.java | 75 ---------- .../java/io/druid/query/QueryToolChest.java | 66 --------- .../io/druid/query/SegmentDescriptor.java | 106 -------------- .../aggregation/MetricManipulationFn.java | 27 ---- .../druid/query/spec/LegacySegmentSpec.java | 69 --------- .../spec/MultipleIntervalSegmentSpec.java | 67 --------- .../spec/MultipleSpecificSegmentSpec.java | 94 ------------ .../io/druid/query/spec/QuerySegmentSpec.java | 43 ------ .../metamx/druid/client/DataSegmentTest.java | 3 +- .../PartialDimExtractionFnTest.java | 3 +- .../extraction/RegexDimExtractionFnTest.java | 3 +- .../SearchQuerySpecDimExtractionFnTest.java | 3 +- .../extraction/TimeDimExtractionFnTest.java | 3 +- ...ectMapper.java => CommonObjectMapper.java} | 8 +- .../metamx/druid/jackson/JacksonModule.java | 4 +- .../metamx/druid/QueryGranularityTest.java | 12 +- .../metamx/druid/histogram/HistogramTest.java | 6 +- ...rTest.java => CommonObjectMapperTest.java} | 6 +- .../com/metamx/druid/index/v1/IndexIO.java | 8 +- .../indexer/data/InputRowParserSerdeTest.java | 23 ++- .../indexer/HadoopDruidIndexerAzkWrapper.java | 87 ----------- .../coordinator/ThreadPoolTaskRunner.java | 4 +- .../indexing/worker/WorkerTaskMonitor.java | 4 +- .../druid/realtime/RealtimeManager.java | 4 +- .../druid/coordination/ServerManager.java | 4 +- .../druid/index/brita/ExtractionFilter.java | 4 +- .../druid/query/group/GroupByQueryEngine.java | 4 +- .../query/group/GroupByQueryRunnerTest.java | 6 +- 58 files changed, 272 insertions(+), 1032 deletions(-) delete mode 100644 client/src/main/java/com/metamx/druid/BaseQuery.java rename client/src/main/java/{io/druid/query/QueryRunner.java => com/metamx/druid/jackson/DefaultObjectMapper.java} (67%) create mode 100644 client/src/main/java/com/metamx/druid/jackson/QueryRegisteringModule.java delete mode 100644 client/src/main/java/com/metamx/druid/query/dimension/DimensionSpec.java delete mode 100644 client/src/main/java/com/metamx/druid/query/extraction/DimExtractionFn.java delete mode 100644 client/src/main/java/com/metamx/druid/query/segment/QuerySegmentWalker.java delete mode 100644 client/src/main/java/io/druid/query/CacheStrategy.java delete mode 100644 client/src/main/java/io/druid/query/Query.java delete mode 100644 client/src/main/java/io/druid/query/QueryToolChest.java delete mode 100644 client/src/main/java/io/druid/query/SegmentDescriptor.java delete mode 100644 client/src/main/java/io/druid/query/aggregation/MetricManipulationFn.java delete mode 100644 client/src/main/java/io/druid/query/spec/LegacySegmentSpec.java delete mode 100644 client/src/main/java/io/druid/query/spec/MultipleIntervalSegmentSpec.java delete mode 100644 client/src/main/java/io/druid/query/spec/MultipleSpecificSegmentSpec.java delete mode 100644 client/src/main/java/io/druid/query/spec/QuerySegmentSpec.java rename common/src/main/java/com/metamx/druid/jackson/{DefaultObjectMapper.java => CommonObjectMapper.java} (91%) rename common/src/test/java/com/metamx/druid/jackson/{DefaultObjectMapperTest.java => CommonObjectMapperTest.java} (89%) delete mode 100644 indexing-hadoop/src/main/java/com/metamx/druid/indexer/HadoopDruidIndexerAzkWrapper.java diff --git a/client/src/main/antlr4/com/metamx/druid/sql/antlr4/DruidSQL.g4 b/client/src/main/antlr4/com/metamx/druid/sql/antlr4/DruidSQL.g4 index d1ce41a1cc5..825e0728afa 100644 --- a/client/src/main/antlr4/com/metamx/druid/sql/antlr4/DruidSQL.g4 +++ b/client/src/main/antlr4/com/metamx/druid/sql/antlr4/DruidSQL.g4 @@ -12,7 +12,7 @@ import com.metamx.druid.aggregation.post.ConstantPostAggregator; import com.metamx.druid.aggregation.post.FieldAccessPostAggregator; import com.metamx.druid.aggregation.post.PostAggregator; import com.metamx.druid.query.dimension.DefaultDimensionSpec; -import com.metamx.druid.query.dimension.DimensionSpec; +import io.druid.query.spec.DimensionSpec; import com.metamx.druid.query.filter.AndDimFilter; import com.metamx.druid.query.filter.DimFilter; import com.metamx.druid.query.filter.NotDimFilter; diff --git a/client/src/main/java/com/metamx/druid/BaseQuery.java b/client/src/main/java/com/metamx/druid/BaseQuery.java deleted file mode 100644 index e3e01b331f7..00000000000 --- a/client/src/main/java/com/metamx/druid/BaseQuery.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package com.metamx.druid; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; -import com.metamx.common.guava.Sequence; -import com.metamx.druid.query.segment.QuerySegmentWalker; -import io.druid.query.Query; -import io.druid.query.QueryRunner; -import io.druid.query.spec.QuerySegmentSpec; -import org.joda.time.Duration; -import org.joda.time.Interval; - -import java.util.List; -import java.util.Map; - -/** - */ -public abstract class BaseQuery implements Query -{ - private final String dataSource; - private final Map context; - private final QuerySegmentSpec querySegmentSpec; - - private volatile Duration duration; - - public BaseQuery( - String dataSource, - QuerySegmentSpec querySegmentSpec, - Map context - ) - { - Preconditions.checkNotNull(dataSource, "dataSource can't be null"); - Preconditions.checkNotNull(querySegmentSpec, "querySegmentSpec can't be null"); - - this.dataSource = dataSource.toLowerCase(); - this.context = context; - this.querySegmentSpec = querySegmentSpec; - - } - - @JsonProperty - @Override - public String getDataSource() - { - return dataSource; - } - - @JsonProperty("intervals") - public QuerySegmentSpec getQuerySegmentSpec() - { - return querySegmentSpec; - } - - @Override - public Sequence run(QuerySegmentWalker walker) - { - return run(querySegmentSpec.lookup(this, walker)); - } - - public Sequence run(QueryRunner runner) - { - return runner.run(this); - } - - @Override - public List getIntervals() - { - return querySegmentSpec.getIntervals(); - } - - @Override - public Duration getDuration() - { - if (duration == null) { - Duration totalDuration = new Duration(0); - for (Interval interval : querySegmentSpec.getIntervals()) { - if (interval != null) { - totalDuration = totalDuration.plus(interval.toDuration()); - } - } - duration = totalDuration; - } - - return duration; - } - - @JsonProperty - public Map getContext() - { - return context; - } - - @Override - public String getContextValue(String key) - { - return context == null ? null : context.get(key); - } - - @Override - public String getContextValue(String key, String defaultValue) - { - String retVal = getContextValue(key); - return retVal == null ? defaultValue : retVal; - } - - protected Map computeOverridenContext(Map overrides) - { - Map overridden = Maps.newTreeMap(); - final Map context = getContext(); - if (context != null) { - overridden.putAll(context); - } - overridden.putAll(overrides); - - return overridden; - } -} diff --git a/client/src/main/java/com/metamx/druid/guice/QueryableModule.java b/client/src/main/java/com/metamx/druid/guice/QueryableModule.java index 2c00162e2d0..29a65462d36 100644 --- a/client/src/main/java/com/metamx/druid/guice/QueryableModule.java +++ b/client/src/main/java/com/metamx/druid/guice/QueryableModule.java @@ -1,3 +1,22 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + package com.metamx.druid.guice; import com.fasterxml.jackson.databind.Module; @@ -8,8 +27,8 @@ import com.metamx.druid.http.log.EmittingRequestLoggerProvider; import com.metamx.druid.http.log.FileRequestLoggerProvider; import com.metamx.druid.http.log.RequestLogger; import com.metamx.druid.http.log.RequestLoggerProvider; -import com.metamx.druid.query.segment.QuerySegmentWalker; import io.druid.initialization.DruidModule; +import io.druid.query.QuerySegmentWalker; import java.util.Arrays; import java.util.List; diff --git a/client/src/main/java/com/metamx/druid/http/ClientQuerySegmentWalker.java b/client/src/main/java/com/metamx/druid/http/ClientQuerySegmentWalker.java index 86bd39e6522..4287fb620a3 100644 --- a/client/src/main/java/com/metamx/druid/http/ClientQuerySegmentWalker.java +++ b/client/src/main/java/com/metamx/druid/http/ClientQuerySegmentWalker.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,11 +25,11 @@ import com.metamx.druid.client.CachingClusteredClient; import com.metamx.druid.query.FinalizeResultsQueryRunner; import com.metamx.druid.query.MetricsEmittingQueryRunner; import com.metamx.druid.query.QueryToolChestWarehouse; -import com.metamx.druid.query.segment.QuerySegmentWalker; import com.metamx.emitter.service.ServiceEmitter; import com.metamx.emitter.service.ServiceMetricEvent; import io.druid.query.Query; import io.druid.query.QueryRunner; +import io.druid.query.QuerySegmentWalker; import io.druid.query.QueryToolChest; import io.druid.query.SegmentDescriptor; import org.joda.time.Interval; diff --git a/client/src/main/java/com/metamx/druid/http/DirectClientQuerySegmentWalker.java b/client/src/main/java/com/metamx/druid/http/DirectClientQuerySegmentWalker.java index 228d03a3a9e..a2aef1c7a85 100644 --- a/client/src/main/java/com/metamx/druid/http/DirectClientQuerySegmentWalker.java +++ b/client/src/main/java/com/metamx/druid/http/DirectClientQuerySegmentWalker.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,9 +22,9 @@ package com.metamx.druid.http; import com.metamx.druid.client.DirectDruidClient; import com.metamx.druid.query.FinalizeResultsQueryRunner; import com.metamx.druid.query.QueryToolChestWarehouse; -import com.metamx.druid.query.segment.QuerySegmentWalker; import io.druid.query.Query; import io.druid.query.QueryRunner; +import io.druid.query.QuerySegmentWalker; import io.druid.query.SegmentDescriptor; import org.joda.time.Interval; diff --git a/client/src/main/java/com/metamx/druid/http/QueryServlet.java b/client/src/main/java/com/metamx/druid/http/QueryServlet.java index 6e11d8c2825..131186be24e 100644 --- a/client/src/main/java/com/metamx/druid/http/QueryServlet.java +++ b/client/src/main/java/com/metamx/druid/http/QueryServlet.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,11 +32,11 @@ import com.metamx.common.logger.Logger; import com.metamx.druid.guice.annotations.Json; import com.metamx.druid.guice.annotations.Smile; import com.metamx.druid.http.log.RequestLogger; -import com.metamx.druid.query.segment.QuerySegmentWalker; import com.metamx.emitter.service.AlertEvent; import com.metamx.emitter.service.ServiceEmitter; import com.metamx.emitter.service.ServiceMetricEvent; import io.druid.query.Query; +import io.druid.query.QuerySegmentWalker; import org.eclipse.jetty.server.Request; import org.joda.time.DateTime; diff --git a/client/src/main/java/io/druid/query/QueryRunner.java b/client/src/main/java/com/metamx/druid/jackson/DefaultObjectMapper.java similarity index 67% rename from client/src/main/java/io/druid/query/QueryRunner.java rename to client/src/main/java/com/metamx/druid/jackson/DefaultObjectMapper.java index 4d20739412a..b7bd32d3e99 100644 --- a/client/src/main/java/io/druid/query/QueryRunner.java +++ b/client/src/main/java/com/metamx/druid/jackson/DefaultObjectMapper.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -17,13 +17,22 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package io.druid.query; +package com.metamx.druid.jackson; -import com.metamx.common.guava.Sequence; +import com.fasterxml.jackson.core.JsonFactory; /** */ -public interface QueryRunner +public class DefaultObjectMapper extends CommonObjectMapper { - public Sequence run(Query query); + public DefaultObjectMapper() + { + this(null); + } + + public DefaultObjectMapper(JsonFactory factory) + { + super(factory); + registerModule(new QueryRegisteringModule()); + } } diff --git a/client/src/main/java/com/metamx/druid/jackson/QueryRegisteringModule.java b/client/src/main/java/com/metamx/druid/jackson/QueryRegisteringModule.java new file mode 100644 index 00000000000..73cdee0bae7 --- /dev/null +++ b/client/src/main/java/com/metamx/druid/jackson/QueryRegisteringModule.java @@ -0,0 +1,85 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package com.metamx.druid.jackson; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.metamx.druid.query.dimension.DefaultDimensionSpec; +import com.metamx.druid.query.dimension.ExtractionDimensionSpec; +import com.metamx.druid.query.dimension.LegacyDimensionSpec; +import com.metamx.druid.query.extraction.PartialDimExtractionFn; +import com.metamx.druid.query.extraction.RegexDimExtractionFn; +import com.metamx.druid.query.extraction.SearchQuerySpecDimExtractionFn; +import com.metamx.druid.query.extraction.TimeDimExtractionFn; +import com.metamx.druid.query.group.GroupByQuery; +import com.metamx.druid.query.metadata.SegmentMetadataQuery; +import com.metamx.druid.query.search.SearchQuery; +import com.metamx.druid.query.timeboundary.TimeBoundaryQuery; +import com.metamx.druid.query.timeseries.TimeseriesQuery; +import io.druid.query.Query; +import io.druid.query.spec.DimExtractionFn; +import io.druid.query.spec.DimensionSpec; + +/** + */ +public class QueryRegisteringModule extends SimpleModule +{ + public QueryRegisteringModule() + { + super("QueryRegistering"); + + setMixInAnnotation(Query.class, QueriesMixin.class); + setMixInAnnotation(DimensionSpec.class, DimensionSpecMixin.class); + setMixInAnnotation(DimExtractionFn.class, DimensionSpecMixin.class); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "queryType") + @JsonSubTypes(value = { + @JsonSubTypes.Type(name = "timeseries", value = TimeseriesQuery.class), + @JsonSubTypes.Type(name = "search", value = SearchQuery.class), + @JsonSubTypes.Type(name = "timeBoundary", value = TimeBoundaryQuery.class), + @JsonSubTypes.Type(name = "groupBy", value = GroupByQuery.class), + @JsonSubTypes.Type(name = "segmentMetadata", value = SegmentMetadataQuery.class) + }) + public static interface QueriesMixin + { + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = LegacyDimensionSpec.class) + @JsonSubTypes(value = { + @JsonSubTypes.Type(name = "default", value = DefaultDimensionSpec.class), + @JsonSubTypes.Type(name = "extraction", value = ExtractionDimensionSpec.class) + }) + public static interface DimensionSpecMixin + { + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property="type") + @JsonSubTypes(value = { + @JsonSubTypes.Type(name = "time", value = TimeDimExtractionFn.class), + @JsonSubTypes.Type(name = "regex", value = RegexDimExtractionFn.class), + @JsonSubTypes.Type(name = "partial", value = PartialDimExtractionFn.class), + @JsonSubTypes.Type(name = "searchQuery", value = SearchQuerySpecDimExtractionFn.class) + }) + public static interface DimExtractionFnMixin + { + } +} diff --git a/client/src/main/java/com/metamx/druid/query/dimension/DefaultDimensionSpec.java b/client/src/main/java/com/metamx/druid/query/dimension/DefaultDimensionSpec.java index b27b361eda0..6bb896083b1 100644 --- a/client/src/main/java/com/metamx/druid/query/dimension/DefaultDimensionSpec.java +++ b/client/src/main/java/com/metamx/druid/query/dimension/DefaultDimensionSpec.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,7 +21,8 @@ package com.metamx.druid.query.dimension; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import com.metamx.druid.query.extraction.DimExtractionFn; +import io.druid.query.spec.DimExtractionFn; +import io.druid.query.spec.DimensionSpec; import java.nio.ByteBuffer; diff --git a/client/src/main/java/com/metamx/druid/query/dimension/DimensionSpec.java b/client/src/main/java/com/metamx/druid/query/dimension/DimensionSpec.java deleted file mode 100644 index 0773ef6ca06..00000000000 --- a/client/src/main/java/com/metamx/druid/query/dimension/DimensionSpec.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package com.metamx.druid.query.dimension; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.metamx.druid.query.extraction.DimExtractionFn; - -/** - */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = LegacyDimensionSpec.class) -@JsonSubTypes(value = { - @JsonSubTypes.Type(name = "default", value = DefaultDimensionSpec.class), - @JsonSubTypes.Type(name = "extraction", value = ExtractionDimensionSpec.class) -}) -public interface DimensionSpec -{ - public String getDimension(); - public String getOutputName(); - public DimExtractionFn getDimExtractionFn(); - public byte[] getCacheKey(); -} diff --git a/client/src/main/java/com/metamx/druid/query/dimension/ExtractionDimensionSpec.java b/client/src/main/java/com/metamx/druid/query/dimension/ExtractionDimensionSpec.java index c746b7b3108..a48504d4ef8 100644 --- a/client/src/main/java/com/metamx/druid/query/dimension/ExtractionDimensionSpec.java +++ b/client/src/main/java/com/metamx/druid/query/dimension/ExtractionDimensionSpec.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,7 +21,8 @@ package com.metamx.druid.query.dimension; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import com.metamx.druid.query.extraction.DimExtractionFn; +import io.druid.query.spec.DimExtractionFn; +import io.druid.query.spec.DimensionSpec; import java.nio.ByteBuffer; diff --git a/client/src/main/java/com/metamx/druid/query/extraction/DimExtractionFn.java b/client/src/main/java/com/metamx/druid/query/extraction/DimExtractionFn.java deleted file mode 100644 index 45b84313542..00000000000 --- a/client/src/main/java/com/metamx/druid/query/extraction/DimExtractionFn.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package com.metamx.druid.query.extraction; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -/** - */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property="type") -@JsonSubTypes(value = { - @JsonSubTypes.Type(name = "time", value = TimeDimExtractionFn.class), - @JsonSubTypes.Type(name = "regex", value = RegexDimExtractionFn.class), - @JsonSubTypes.Type(name = "partial", value = PartialDimExtractionFn.class), - @JsonSubTypes.Type(name = "searchQuery", value = SearchQuerySpecDimExtractionFn.class) -}) -public interface DimExtractionFn -{ - public byte[] getCacheKey(); - public String apply(String dimValue); -} diff --git a/client/src/main/java/com/metamx/druid/query/extraction/PartialDimExtractionFn.java b/client/src/main/java/com/metamx/druid/query/extraction/PartialDimExtractionFn.java index 86b1d1ddbd2..e8fc679bd1a 100644 --- a/client/src/main/java/com/metamx/druid/query/extraction/PartialDimExtractionFn.java +++ b/client/src/main/java/com/metamx/druid/query/extraction/PartialDimExtractionFn.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,6 +21,7 @@ package com.metamx.druid.query.extraction; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import io.druid.query.spec.DimExtractionFn; import java.nio.ByteBuffer; import java.util.regex.Matcher; diff --git a/client/src/main/java/com/metamx/druid/query/extraction/RegexDimExtractionFn.java b/client/src/main/java/com/metamx/druid/query/extraction/RegexDimExtractionFn.java index f5135a2d1c5..f8d68b86f09 100644 --- a/client/src/main/java/com/metamx/druid/query/extraction/RegexDimExtractionFn.java +++ b/client/src/main/java/com/metamx/druid/query/extraction/RegexDimExtractionFn.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,6 +21,7 @@ package com.metamx.druid.query.extraction; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import io.druid.query.spec.DimExtractionFn; import java.nio.ByteBuffer; import java.util.regex.Matcher; diff --git a/client/src/main/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFn.java b/client/src/main/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFn.java index 3b1a323ac1c..d8748387080 100644 --- a/client/src/main/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFn.java +++ b/client/src/main/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFn.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,6 +22,7 @@ package com.metamx.druid.query.extraction; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.metamx.druid.query.search.SearchQuerySpec; +import io.druid.query.spec.DimExtractionFn; import java.nio.ByteBuffer; diff --git a/client/src/main/java/com/metamx/druid/query/extraction/TimeDimExtractionFn.java b/client/src/main/java/com/metamx/druid/query/extraction/TimeDimExtractionFn.java index 71ff8bed15f..ea721fff1e2 100644 --- a/client/src/main/java/com/metamx/druid/query/extraction/TimeDimExtractionFn.java +++ b/client/src/main/java/com/metamx/druid/query/extraction/TimeDimExtractionFn.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,6 +22,7 @@ package com.metamx.druid.query.extraction; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.ibm.icu.text.SimpleDateFormat; +import io.druid.query.spec.DimExtractionFn; import java.nio.ByteBuffer; import java.text.ParseException; diff --git a/client/src/main/java/com/metamx/druid/query/filter/ExtractionDimFilter.java b/client/src/main/java/com/metamx/druid/query/filter/ExtractionDimFilter.java index b6a43c5af04..cd15c74f64b 100644 --- a/client/src/main/java/com/metamx/druid/query/filter/ExtractionDimFilter.java +++ b/client/src/main/java/com/metamx/druid/query/filter/ExtractionDimFilter.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,7 +22,7 @@ package com.metamx.druid.query.filter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; -import com.metamx.druid.query.extraction.DimExtractionFn; +import io.druid.query.spec.DimExtractionFn; import java.nio.ByteBuffer; diff --git a/client/src/main/java/com/metamx/druid/query/group/GroupByQuery.java b/client/src/main/java/com/metamx/druid/query/group/GroupByQuery.java index b705deac2bf..3c0c42cd848 100644 --- a/client/src/main/java/com/metamx/druid/query/group/GroupByQuery.java +++ b/client/src/main/java/com/metamx/druid/query/group/GroupByQuery.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -30,12 +30,10 @@ import com.google.common.collect.Lists; import com.metamx.common.ISE; import com.metamx.common.guava.Sequence; import com.metamx.common.guava.Sequences; -import com.metamx.druid.BaseQuery; import com.metamx.druid.aggregation.post.PostAggregator; import com.metamx.druid.input.Row; import com.metamx.druid.query.Queries; import com.metamx.druid.query.dimension.DefaultDimensionSpec; -import com.metamx.druid.query.dimension.DimensionSpec; import com.metamx.druid.query.filter.DimFilter; import com.metamx.druid.query.group.having.HavingSpec; import com.metamx.druid.query.group.orderby.DefaultLimitSpec; @@ -43,8 +41,9 @@ import com.metamx.druid.query.group.orderby.LimitSpec; import com.metamx.druid.query.group.orderby.NoopLimitSpec; import com.metamx.druid.query.group.orderby.OrderByColumnSpec; import io.druid.granularity.QueryGranularity; -import io.druid.query.Query; +import io.druid.query.BaseQuery; import io.druid.query.aggregation.AggregatorFactory; +import io.druid.query.spec.DimensionSpec; import io.druid.query.spec.LegacySegmentSpec; import io.druid.query.spec.QuerySegmentSpec; @@ -210,7 +209,7 @@ public class GroupByQuery extends BaseQuery @Override public String getType() { - return Query.GROUP_BY; + return "groupBy"; } public Sequence applyLimit(Sequence results) diff --git a/client/src/main/java/com/metamx/druid/query/group/GroupByQueryQueryToolChest.java b/client/src/main/java/com/metamx/druid/query/group/GroupByQueryQueryToolChest.java index 7ff15dc9371..cf4d733d6ac 100644 --- a/client/src/main/java/com/metamx/druid/query/group/GroupByQueryQueryToolChest.java +++ b/client/src/main/java/com/metamx/druid/query/group/GroupByQueryQueryToolChest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,7 +36,6 @@ import com.metamx.druid.index.v1.IncrementalIndex; import com.metamx.druid.input.MapBasedRow; import com.metamx.druid.input.Row; import com.metamx.druid.input.Rows; -import com.metamx.druid.query.dimension.DimensionSpec; import com.metamx.emitter.service.ServiceMetricEvent; import io.druid.granularity.QueryGranularity; import io.druid.query.Query; @@ -44,6 +43,7 @@ import io.druid.query.QueryRunner; import io.druid.query.QueryToolChest; import io.druid.query.aggregation.AggregatorFactory; import io.druid.query.aggregation.MetricManipulationFn; +import io.druid.query.spec.DimensionSpec; import org.joda.time.Interval; import org.joda.time.Minutes; diff --git a/client/src/main/java/com/metamx/druid/query/group/orderby/DefaultLimitSpec.java b/client/src/main/java/com/metamx/druid/query/group/orderby/DefaultLimitSpec.java index cbe5efa90b0..4dc9ebac057 100644 --- a/client/src/main/java/com/metamx/druid/query/group/orderby/DefaultLimitSpec.java +++ b/client/src/main/java/com/metamx/druid/query/group/orderby/DefaultLimitSpec.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,8 +33,8 @@ import com.metamx.common.guava.Sequence; import com.metamx.common.guava.Sequences; import com.metamx.druid.aggregation.post.PostAggregator; import com.metamx.druid.input.Row; -import com.metamx.druid.query.dimension.DimensionSpec; import io.druid.query.aggregation.AggregatorFactory; +import io.druid.query.spec.DimensionSpec; import javax.annotation.Nullable; import java.util.ArrayList; diff --git a/client/src/main/java/com/metamx/druid/query/group/orderby/LimitSpec.java b/client/src/main/java/com/metamx/druid/query/group/orderby/LimitSpec.java index bcefbf82663..3814d8ab93d 100644 --- a/client/src/main/java/com/metamx/druid/query/group/orderby/LimitSpec.java +++ b/client/src/main/java/com/metamx/druid/query/group/orderby/LimitSpec.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,8 +25,8 @@ import com.google.common.base.Function; import com.metamx.common.guava.Sequence; import com.metamx.druid.aggregation.post.PostAggregator; import com.metamx.druid.input.Row; -import com.metamx.druid.query.dimension.DimensionSpec; import io.druid.query.aggregation.AggregatorFactory; +import io.druid.query.spec.DimensionSpec; import java.util.List; diff --git a/client/src/main/java/com/metamx/druid/query/group/orderby/NoopLimitSpec.java b/client/src/main/java/com/metamx/druid/query/group/orderby/NoopLimitSpec.java index fddb6ce1904..faf9ab760cd 100644 --- a/client/src/main/java/com/metamx/druid/query/group/orderby/NoopLimitSpec.java +++ b/client/src/main/java/com/metamx/druid/query/group/orderby/NoopLimitSpec.java @@ -1,3 +1,22 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + package com.metamx.druid.query.group.orderby; import com.google.common.base.Function; @@ -5,8 +24,8 @@ import com.google.common.base.Functions; import com.metamx.common.guava.Sequence; import com.metamx.druid.aggregation.post.PostAggregator; import com.metamx.druid.input.Row; -import com.metamx.druid.query.dimension.DimensionSpec; import io.druid.query.aggregation.AggregatorFactory; +import io.druid.query.spec.DimensionSpec; import java.util.List; diff --git a/client/src/main/java/com/metamx/druid/query/metadata/SegmentMetadataQuery.java b/client/src/main/java/com/metamx/druid/query/metadata/SegmentMetadataQuery.java index cc375e57433..99e6c29b5c2 100644 --- a/client/src/main/java/com/metamx/druid/query/metadata/SegmentMetadataQuery.java +++ b/client/src/main/java/com/metamx/druid/query/metadata/SegmentMetadataQuery.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,7 +21,7 @@ package com.metamx.druid.query.metadata; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import com.metamx.druid.BaseQuery; +import io.druid.query.BaseQuery; import io.druid.query.Query; import io.druid.query.spec.QuerySegmentSpec; @@ -69,7 +69,7 @@ public class SegmentMetadataQuery extends BaseQuery @Override public String getType() { - return Query.SEGMENT_METADATA; + return "segmentMetadata"; } @Override diff --git a/client/src/main/java/com/metamx/druid/query/search/SearchQuery.java b/client/src/main/java/com/metamx/druid/query/search/SearchQuery.java index 8702156598b..c6b3d329709 100644 --- a/client/src/main/java/com/metamx/druid/query/search/SearchQuery.java +++ b/client/src/main/java/com/metamx/druid/query/search/SearchQuery.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,12 +24,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -import com.metamx.druid.BaseQuery; import com.metamx.druid.query.filter.DimFilter; import com.metamx.druid.result.Result; import com.metamx.druid.result.SearchResultValue; import io.druid.granularity.QueryGranularity; -import io.druid.query.Query; +import io.druid.query.BaseQuery; import io.druid.query.spec.QuerySegmentSpec; import javax.annotation.Nullable; @@ -91,7 +90,7 @@ public class SearchQuery extends BaseQuery> @Override public String getType() { - return Query.SEARCH; + return "search"; } @Override diff --git a/client/src/main/java/com/metamx/druid/query/segment/QuerySegmentWalker.java b/client/src/main/java/com/metamx/druid/query/segment/QuerySegmentWalker.java deleted file mode 100644 index 3bf3b37bea6..00000000000 --- a/client/src/main/java/com/metamx/druid/query/segment/QuerySegmentWalker.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package com.metamx.druid.query.segment; - -import io.druid.query.Query; -import io.druid.query.QueryRunner; -import io.druid.query.SegmentDescriptor; -import org.joda.time.Interval; - -/** - */ -public interface QuerySegmentWalker -{ - /** - * Gets the Queryable for a given interval, the Queryable returned can be any version(s) or partitionNumber(s) - * such that it represents the interval. - * - * @param intervals the intervals to find a Queryable for - * @return a Queryable object that represents the interval - */ - public QueryRunner getQueryRunnerForIntervals(Query query, Iterable intervals); - - /** - * Gets the Queryable for a given list of SegmentSpecs. - * exist. - * - * @return the Queryable object with the given SegmentSpecs - */ - public QueryRunner getQueryRunnerForSegments(Query query, Iterable specs); -} diff --git a/client/src/main/java/com/metamx/druid/query/segment/SpecificSegmentSpec.java b/client/src/main/java/com/metamx/druid/query/segment/SpecificSegmentSpec.java index 55973aff8f4..2587467d930 100644 --- a/client/src/main/java/com/metamx/druid/query/segment/SpecificSegmentSpec.java +++ b/client/src/main/java/com/metamx/druid/query/segment/SpecificSegmentSpec.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,6 +21,7 @@ package com.metamx.druid.query.segment; import io.druid.query.Query; import io.druid.query.QueryRunner; +import io.druid.query.QuerySegmentWalker; import io.druid.query.SegmentDescriptor; import io.druid.query.spec.QuerySegmentSpec; import org.joda.time.Interval; diff --git a/client/src/main/java/com/metamx/druid/query/timeboundary/TimeBoundaryQuery.java b/client/src/main/java/com/metamx/druid/query/timeboundary/TimeBoundaryQuery.java index ecded61c0e9..a462d10ad2d 100644 --- a/client/src/main/java/com/metamx/druid/query/timeboundary/TimeBoundaryQuery.java +++ b/client/src/main/java/com/metamx/druid/query/timeboundary/TimeBoundaryQuery.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,10 +24,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.metamx.druid.BaseQuery; import com.metamx.druid.result.Result; import com.metamx.druid.result.TimeBoundaryResultValue; -import io.druid.query.Query; +import io.druid.query.BaseQuery; import io.druid.query.spec.MultipleIntervalSegmentSpec; import io.druid.query.spec.QuerySegmentSpec; import org.joda.time.DateTime; @@ -74,7 +73,7 @@ public class TimeBoundaryQuery extends BaseQuery @Override public String getType() { - return Query.TIME_BOUNDARY; + return "timeBoundary"; } @Override diff --git a/client/src/main/java/com/metamx/druid/query/timeseries/TimeseriesQuery.java b/client/src/main/java/com/metamx/druid/query/timeseries/TimeseriesQuery.java index ef06fd4480b..8be56a4e3d4 100644 --- a/client/src/main/java/com/metamx/druid/query/timeseries/TimeseriesQuery.java +++ b/client/src/main/java/com/metamx/druid/query/timeseries/TimeseriesQuery.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,14 +23,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.common.collect.ImmutableList; -import com.metamx.druid.BaseQuery; import com.metamx.druid.aggregation.post.PostAggregator; import com.metamx.druid.query.Queries; import com.metamx.druid.query.filter.DimFilter; import com.metamx.druid.result.Result; import com.metamx.druid.result.TimeseriesResultValue; import io.druid.granularity.QueryGranularity; -import io.druid.query.Query; +import io.druid.query.BaseQuery; import io.druid.query.aggregation.AggregatorFactory; import io.druid.query.spec.QuerySegmentSpec; @@ -76,7 +75,7 @@ public class TimeseriesQuery extends BaseQuery> @Override public String getType() { - return Query.TIMESERIES; + return "timeseries"; } @JsonProperty("filter") diff --git a/client/src/main/java/com/metamx/druid/sql/SQLRunner.java b/client/src/main/java/com/metamx/druid/sql/SQLRunner.java index 5667583e25d..fc400082bc5 100644 --- a/client/src/main/java/com/metamx/druid/sql/SQLRunner.java +++ b/client/src/main/java/com/metamx/druid/sql/SQLRunner.java @@ -1,3 +1,22 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + package com.metamx.druid.sql; import com.fasterxml.jackson.core.type.TypeReference; @@ -11,7 +30,6 @@ import com.google.common.io.Closeables; import com.metamx.druid.Druids; import com.metamx.druid.input.Row; import com.metamx.druid.jackson.DefaultObjectMapper; -import com.metamx.druid.query.dimension.DimensionSpec; import com.metamx.druid.query.group.GroupByQuery; import com.metamx.druid.result.Result; import com.metamx.druid.result.TimeseriesResultValue; @@ -19,6 +37,7 @@ import com.metamx.druid.sql.antlr4.DruidSQLLexer; import com.metamx.druid.sql.antlr4.DruidSQLParser; import io.druid.query.Query; import io.druid.query.aggregation.AggregatorFactory; +import io.druid.query.spec.DimensionSpec; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CommonTokenStream; diff --git a/client/src/main/java/io/druid/query/CacheStrategy.java b/client/src/main/java/io/druid/query/CacheStrategy.java deleted file mode 100644 index c8d5217841f..00000000000 --- a/client/src/main/java/io/druid/query/CacheStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.google.common.base.Function; -import com.metamx.common.guava.Sequence; - -/** -*/ -public interface CacheStrategy> -{ - public byte[] computeCacheKey(QueryType query); - - public TypeReference getCacheObjectClazz(); - - public Function prepareForCache(); - - public Function pullFromCache(); - - public Sequence mergeSequences(Sequence> seqOfSequences); -} diff --git a/client/src/main/java/io/druid/query/Query.java b/client/src/main/java/io/druid/query/Query.java deleted file mode 100644 index 47f38d6e61f..00000000000 --- a/client/src/main/java/io/druid/query/Query.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.metamx.common.guava.Sequence; -import com.metamx.druid.query.group.GroupByQuery; -import com.metamx.druid.query.metadata.SegmentMetadataQuery; -import com.metamx.druid.query.search.SearchQuery; -import com.metamx.druid.query.segment.QuerySegmentWalker; -import com.metamx.druid.query.timeboundary.TimeBoundaryQuery; -import com.metamx.druid.query.timeseries.TimeseriesQuery; -import io.druid.query.spec.QuerySegmentSpec; -import org.joda.time.Duration; -import org.joda.time.Interval; - -import java.util.List; -import java.util.Map; - -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "queryType") -@JsonSubTypes(value = { - @JsonSubTypes.Type(name = Query.TIMESERIES, value = TimeseriesQuery.class), - @JsonSubTypes.Type(name = Query.SEARCH, value = SearchQuery.class), - @JsonSubTypes.Type(name = Query.TIME_BOUNDARY, value = TimeBoundaryQuery.class), - @JsonSubTypes.Type(name = Query.GROUP_BY, value = GroupByQuery.class), - @JsonSubTypes.Type(name = Query.SEGMENT_METADATA, value = SegmentMetadataQuery.class) -}) -public interface Query -{ - public static final String TIMESERIES = "timeseries"; - public static final String SEARCH = "search"; - public static final String TIME_BOUNDARY = "timeBoundary"; - public static final String GROUP_BY = "groupBy"; - public static final String SEGMENT_METADATA = "segmentMetadata"; - - public String getDataSource(); - - public boolean hasFilters(); - - public String getType(); - - public Sequence run(QuerySegmentWalker walker); - - public Sequence run(QueryRunner runner); - - public List getIntervals(); - - public Duration getDuration(); - - public String getContextValue(String key); - - public String getContextValue(String key, String defaultValue); - - public Query withOverriddenContext(Map contextOverride); - - public Query withQuerySegmentSpec(QuerySegmentSpec spec); -} diff --git a/client/src/main/java/io/druid/query/QueryToolChest.java b/client/src/main/java/io/druid/query/QueryToolChest.java deleted file mode 100644 index 37fbd41f3ee..00000000000 --- a/client/src/main/java/io/druid/query/QueryToolChest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.google.common.base.Function; -import com.metamx.common.guava.Sequence; -import com.metamx.emitter.service.ServiceMetricEvent; -import io.druid.query.aggregation.MetricManipulationFn; -import io.druid.segment.LogicalSegment; - -import java.util.List; - -/** - * The broker-side (also used by server in some cases) API for a specific Query type. This API is still undergoing - * evolution and is only semi-stable, so proprietary Query implementations should be ready for the potential - * maintenance burden when upgrading versions. - */ -public abstract class QueryToolChest> -{ - public abstract QueryRunner mergeResults(QueryRunner runner); - - /** - * This method doesn't belong here, but it's here for now just to make it work. - * - * @param seqOfSequences - * @return - */ - public abstract Sequence mergeSequences(Sequence> seqOfSequences); - public abstract ServiceMetricEvent.Builder makeMetricBuilder(QueryType query); - public abstract Function makeMetricManipulatorFn(QueryType query, MetricManipulationFn fn); - public abstract TypeReference getResultTypeReference(); - - public CacheStrategy getCacheStrategy(QueryType query) { - return null; - } - - public QueryRunner preMergeQueryDecoration(QueryRunner runner) { - return runner; - } - - public QueryRunner postMergeQueryDecoration(QueryRunner runner) { - return runner; - } - - public List filterSegments(QueryType query, List segments) { - return segments; - } -} diff --git a/client/src/main/java/io/druid/query/SegmentDescriptor.java b/client/src/main/java/io/druid/query/SegmentDescriptor.java deleted file mode 100644 index f66b7f66d6a..00000000000 --- a/client/src/main/java/io/druid/query/SegmentDescriptor.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.joda.time.Interval; - -/** -*/ -public class SegmentDescriptor -{ - private final Interval interval; - private final String version; - private final int partitionNumber; - - @JsonCreator - public SegmentDescriptor( - @JsonProperty("itvl") Interval interval, - @JsonProperty("ver") String version, - @JsonProperty("part") int partitionNumber) - { - this.interval = interval; - this.version = version; - this.partitionNumber = partitionNumber; - } - - @JsonProperty("itvl") - public Interval getInterval() - { - return interval; - } - - @JsonProperty("ver") - public String getVersion() - { - return version; - } - - @JsonProperty("part") - public int getPartitionNumber() - { - return partitionNumber; - } - - @Override - public boolean equals(Object o) - { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - SegmentDescriptor that = (SegmentDescriptor) o; - - if (partitionNumber != that.partitionNumber) { - return false; - } - if (interval != null ? !interval.equals(that.interval) : that.interval != null) { - return false; - } - if (version != null ? !version.equals(that.version) : that.version != null) { - return false; - } - - return true; - } - - @Override - public int hashCode() - { - int result = interval != null ? interval.hashCode() : 0; - result = 31 * result + (version != null ? version.hashCode() : 0); - result = 31 * result + partitionNumber; - return result; - } - - @Override - public String toString() - { - return "SegmentDescriptor{" + - "interval=" + interval + - ", version='" + version + '\'' + - ", partitionNumber=" + partitionNumber + - '}'; - } -} diff --git a/client/src/main/java/io/druid/query/aggregation/MetricManipulationFn.java b/client/src/main/java/io/druid/query/aggregation/MetricManipulationFn.java deleted file mode 100644 index 0da9c9f63cc..00000000000 --- a/client/src/main/java/io/druid/query/aggregation/MetricManipulationFn.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query.aggregation; - -/** -*/ -public interface MetricManipulationFn -{ - public Object manipulate(AggregatorFactory factory, Object object); -} diff --git a/client/src/main/java/io/druid/query/spec/LegacySegmentSpec.java b/client/src/main/java/io/druid/query/spec/LegacySegmentSpec.java deleted file mode 100644 index 505760aa762..00000000000 --- a/client/src/main/java/io/druid/query/spec/LegacySegmentSpec.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query.spec; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.google.common.base.Function; -import com.google.common.collect.Lists; -import com.metamx.common.IAE; -import org.joda.time.Interval; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - */ -public class LegacySegmentSpec extends MultipleIntervalSegmentSpec -{ - private static List convertValue(Object intervals) - { - final List intervalStringList; - if (intervals instanceof String) { - intervalStringList = Arrays.asList((((String) intervals).split(","))); - } else if (intervals instanceof Map) { - intervalStringList = (List) ((Map) intervals).get("intervals"); - } else if (intervals instanceof List) { - intervalStringList = (List) intervals; - } else { - throw new IAE("Unknown type[%s] for intervals[%s]", intervals.getClass(), intervals); - } - - return Lists.transform( - intervalStringList, - new Function() - { - @Override - public Interval apply(Object input) - { - return new Interval(input); - } - } - ); - } - - @JsonCreator - public LegacySegmentSpec( - Object intervals - ) - { - super(convertValue(intervals)); - } -} diff --git a/client/src/main/java/io/druid/query/spec/MultipleIntervalSegmentSpec.java b/client/src/main/java/io/druid/query/spec/MultipleIntervalSegmentSpec.java deleted file mode 100644 index 7c9c7703492..00000000000 --- a/client/src/main/java/io/druid/query/spec/MultipleIntervalSegmentSpec.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query.spec; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.metamx.druid.query.segment.QuerySegmentWalker; -import com.metamx.druid.utils.JodaUtils; -import io.druid.query.Query; -import io.druid.query.QueryRunner; -import org.joda.time.Interval; - -import java.util.Collections; -import java.util.List; - -/** - */ -public class MultipleIntervalSegmentSpec implements QuerySegmentSpec -{ - private final List intervals; - - @JsonCreator - public MultipleIntervalSegmentSpec( - @JsonProperty("intervals") List intervals - ) - { - this.intervals = Collections.unmodifiableList(JodaUtils.condenseIntervals(intervals)); - } - - @Override - @JsonProperty("intervals") - public List getIntervals() - { - return intervals; - } - - @Override - public QueryRunner lookup(Query query, QuerySegmentWalker walker) - { - return walker.getQueryRunnerForIntervals(query, intervals); - } - - @Override - public String toString() - { - return getClass().getSimpleName() + "{" + - "intervals=" + intervals + - '}'; - } -} diff --git a/client/src/main/java/io/druid/query/spec/MultipleSpecificSegmentSpec.java b/client/src/main/java/io/druid/query/spec/MultipleSpecificSegmentSpec.java deleted file mode 100644 index 37e8b6c338d..00000000000 --- a/client/src/main/java/io/druid/query/spec/MultipleSpecificSegmentSpec.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query.spec; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Function; -import com.google.common.collect.Iterables; -import com.metamx.druid.query.segment.QuerySegmentWalker; -import com.metamx.druid.utils.JodaUtils; -import io.druid.query.Query; -import io.druid.query.QueryRunner; -import io.druid.query.SegmentDescriptor; -import org.joda.time.Interval; - -import java.util.List; - -/** - */ -public class MultipleSpecificSegmentSpec implements QuerySegmentSpec -{ - private final List descriptors; - - private volatile List intervals = null; - - @JsonCreator - public MultipleSpecificSegmentSpec( - @JsonProperty("segments") List descriptors - ) - { - this.descriptors = descriptors; - } - - @JsonProperty("segments") - public List getDescriptors() - { - return descriptors; - } - - @Override - public List getIntervals() - { - if (intervals != null) { - return intervals; - } - - intervals = JodaUtils.condenseIntervals( - Iterables.transform( - descriptors, - new Function() - { - @Override - public Interval apply(SegmentDescriptor input) - { - return input.getInterval(); - } - } - ) - ); - - return intervals; - } - - @Override - public QueryRunner lookup(Query query, QuerySegmentWalker walker) - { - return walker.getQueryRunnerForSegments(query, descriptors); - } - - @Override - public String toString() - { - return "MultipleSpecificSegmentSpec{" + - "descriptors=" + descriptors + - '}'; - } -} diff --git a/client/src/main/java/io/druid/query/spec/QuerySegmentSpec.java b/client/src/main/java/io/druid/query/spec/QuerySegmentSpec.java deleted file mode 100644 index 126b1d99b58..00000000000 --- a/client/src/main/java/io/druid/query/spec/QuerySegmentSpec.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package io.druid.query.spec; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.metamx.druid.query.segment.QuerySegmentWalker; -import io.druid.query.Query; -import io.druid.query.QueryRunner; -import org.joda.time.Interval; - -import java.util.List; - -/** - */ -@JsonTypeInfo(use= JsonTypeInfo.Id.NAME, property="type", defaultImpl = LegacySegmentSpec.class) -@JsonSubTypes(value={ - @JsonSubTypes.Type(name="intervals", value=MultipleIntervalSegmentSpec.class), - @JsonSubTypes.Type(name="segments", value=MultipleSpecificSegmentSpec.class) -}) -public interface QuerySegmentSpec -{ - public List getIntervals(); - - public QueryRunner lookup(Query query, QuerySegmentWalker walker); -} diff --git a/client/src/test/java/com/metamx/druid/client/DataSegmentTest.java b/client/src/test/java/com/metamx/druid/client/DataSegmentTest.java index 63f3326a92e..7532aeb1424 100644 --- a/client/src/test/java/com/metamx/druid/client/DataSegmentTest.java +++ b/client/src/test/java/com/metamx/druid/client/DataSegmentTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,7 +29,6 @@ import com.metamx.druid.index.v1.IndexIO; import com.metamx.druid.jackson.DefaultObjectMapper; import com.metamx.druid.shard.NoneShardSpec; import com.metamx.druid.shard.SingleDimensionShardSpec; - import org.joda.time.DateTime; import org.joda.time.Interval; import org.junit.Assert; diff --git a/client/src/test/java/com/metamx/druid/query/extraction/PartialDimExtractionFnTest.java b/client/src/test/java/com/metamx/druid/query/extraction/PartialDimExtractionFnTest.java index 061f8122f2e..a894756dd6e 100644 --- a/client/src/test/java/com/metamx/druid/query/extraction/PartialDimExtractionFnTest.java +++ b/client/src/test/java/com/metamx/druid/query/extraction/PartialDimExtractionFnTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,6 +20,7 @@ package com.metamx.druid.query.extraction; import com.google.common.collect.Sets; +import io.druid.query.spec.DimExtractionFn; import org.junit.Assert; import org.junit.Test; diff --git a/client/src/test/java/com/metamx/druid/query/extraction/RegexDimExtractionFnTest.java b/client/src/test/java/com/metamx/druid/query/extraction/RegexDimExtractionFnTest.java index 2ec3f3db239..e430695836b 100644 --- a/client/src/test/java/com/metamx/druid/query/extraction/RegexDimExtractionFnTest.java +++ b/client/src/test/java/com/metamx/druid/query/extraction/RegexDimExtractionFnTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,6 +20,7 @@ package com.metamx.druid.query.extraction; import com.google.common.collect.Sets; +import io.druid.query.spec.DimExtractionFn; import org.junit.Assert; import org.junit.Test; diff --git a/client/src/test/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFnTest.java b/client/src/test/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFnTest.java index 06e9cde0ffd..55c6bc696cf 100644 --- a/client/src/test/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFnTest.java +++ b/client/src/test/java/com/metamx/druid/query/extraction/SearchQuerySpecDimExtractionFnTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,6 +22,7 @@ package com.metamx.druid.query.extraction; import com.google.common.collect.Sets; import com.metamx.druid.query.search.FragmentSearchQuerySpec; import com.metamx.druid.query.search.SearchQuerySpec; +import io.druid.query.spec.DimExtractionFn; import org.junit.Assert; import org.junit.Test; diff --git a/client/src/test/java/com/metamx/druid/query/extraction/TimeDimExtractionFnTest.java b/client/src/test/java/com/metamx/druid/query/extraction/TimeDimExtractionFnTest.java index 7f5b6eabe1c..53ce56f981a 100644 --- a/client/src/test/java/com/metamx/druid/query/extraction/TimeDimExtractionFnTest.java +++ b/client/src/test/java/com/metamx/druid/query/extraction/TimeDimExtractionFnTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,6 +20,7 @@ package com.metamx.druid.query.extraction; import com.google.common.collect.Sets; +import io.druid.query.spec.DimExtractionFn; import org.junit.Assert; import org.junit.Test; diff --git a/common/src/main/java/com/metamx/druid/jackson/DefaultObjectMapper.java b/common/src/main/java/com/metamx/druid/jackson/CommonObjectMapper.java similarity index 91% rename from common/src/main/java/com/metamx/druid/jackson/DefaultObjectMapper.java rename to common/src/main/java/com/metamx/druid/jackson/CommonObjectMapper.java index 1c6e4b18636..85775df1040 100644 --- a/common/src/main/java/com/metamx/druid/jackson/DefaultObjectMapper.java +++ b/common/src/main/java/com/metamx/druid/jackson/CommonObjectMapper.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,14 +28,14 @@ import com.fasterxml.jackson.datatype.guava.GuavaModule; /** */ -public class DefaultObjectMapper extends ObjectMapper +public class CommonObjectMapper extends ObjectMapper { - public DefaultObjectMapper() + public CommonObjectMapper() { this(null); } - public DefaultObjectMapper(JsonFactory factory) + public CommonObjectMapper(JsonFactory factory) { super(factory); registerModule(new DruidDefaultSerializersModule()); diff --git a/common/src/main/java/com/metamx/druid/jackson/JacksonModule.java b/common/src/main/java/com/metamx/druid/jackson/JacksonModule.java index 694f4d2bf4c..33eb36125f7 100644 --- a/common/src/main/java/com/metamx/druid/jackson/JacksonModule.java +++ b/common/src/main/java/com/metamx/druid/jackson/JacksonModule.java @@ -42,13 +42,13 @@ public class JacksonModule implements Module @Provides @LazySingleton @Json public ObjectMapper jsonMapper() { - return new DefaultObjectMapper(); + return new CommonObjectMapper(); } @Provides @LazySingleton @Smile public ObjectMapper smileMapper() { - ObjectMapper retVal = new DefaultObjectMapper(new SmileFactory()); + ObjectMapper retVal = new CommonObjectMapper(new SmileFactory()); retVal.getJsonFactory().setCodec(retVal); return retVal; } diff --git a/common/src/test/java/com/metamx/druid/QueryGranularityTest.java b/common/src/test/java/com/metamx/druid/QueryGranularityTest.java index ad54b418d01..f98389cd457 100644 --- a/common/src/test/java/com/metamx/druid/QueryGranularityTest.java +++ b/common/src/test/java/com/metamx/druid/QueryGranularityTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,7 +22,7 @@ package com.metamx.druid; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import com.metamx.druid.jackson.DefaultObjectMapper; +import com.metamx.druid.jackson.CommonObjectMapper; import io.druid.granularity.DurationGranularity; import io.druid.granularity.PeriodGranularity; import io.druid.granularity.QueryGranularity; @@ -437,7 +437,7 @@ public class QueryGranularityTest @Test public void testSerializePeriod() throws Exception { - ObjectMapper mapper = new DefaultObjectMapper(); + ObjectMapper mapper = new CommonObjectMapper(); String json = "{ \"type\": \"period\", \"period\": \"P1D\" }"; QueryGranularity gran = mapper.readValue(json, QueryGranularity.class); @@ -462,7 +462,7 @@ public class QueryGranularityTest @Test public void testSerializeDuration() throws Exception { - ObjectMapper mapper = new DefaultObjectMapper(); + ObjectMapper mapper = new CommonObjectMapper(); String json = "{ \"type\": \"duration\", \"duration\": \"3600000\" }"; QueryGranularity gran = mapper.readValue(json, QueryGranularity.class); @@ -479,7 +479,7 @@ public class QueryGranularityTest @Test public void testSerializeSimple() throws Exception { - ObjectMapper mapper = new DefaultObjectMapper(); + ObjectMapper mapper = new CommonObjectMapper(); Assert.assertEquals( QueryGranularity.ALL, @@ -501,7 +501,7 @@ public class QueryGranularityTest @Test public void testDeserializeSimple() throws Exception { - ObjectMapper mapper = new DefaultObjectMapper(); + ObjectMapper mapper = new CommonObjectMapper(); Assert.assertEquals(QueryGranularity.ALL, mapper.readValue("\"all\"", QueryGranularity.class)); Assert.assertEquals(QueryGranularity.ALL, mapper.readValue("\"ALL\"", QueryGranularity.class)); diff --git a/common/src/test/java/com/metamx/druid/histogram/HistogramTest.java b/common/src/test/java/com/metamx/druid/histogram/HistogramTest.java index f221b0e26df..fa5f9f4e8ea 100644 --- a/common/src/test/java/com/metamx/druid/histogram/HistogramTest.java +++ b/common/src/test/java/com/metamx/druid/histogram/HistogramTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,8 +22,6 @@ package com.metamx.druid.histogram; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Maps; import com.metamx.druid.aggregation.Histogram; -import com.metamx.druid.jackson.DefaultObjectMapper; - import org.junit.Assert; import org.junit.Test; @@ -63,7 +61,7 @@ public class HistogramTest Double[] visualBreaks = {-1.0, -0.5, 0.0, 0.5, 1.0}; Double[] visualCounts = { 123., 4., 56., 7. }; - ObjectMapper objectMapper = new DefaultObjectMapper(); + ObjectMapper objectMapper = new ObjectMapper(); String json = objectMapper.writeValueAsString(h.asVisual()); Map expectedObj = Maps.newLinkedHashMap(); diff --git a/common/src/test/java/com/metamx/druid/jackson/DefaultObjectMapperTest.java b/common/src/test/java/com/metamx/druid/jackson/CommonObjectMapperTest.java similarity index 89% rename from common/src/test/java/com/metamx/druid/jackson/DefaultObjectMapperTest.java rename to common/src/test/java/com/metamx/druid/jackson/CommonObjectMapperTest.java index aff4ad208c6..45ca35c6ac5 100644 --- a/common/src/test/java/com/metamx/druid/jackson/DefaultObjectMapperTest.java +++ b/common/src/test/java/com/metamx/druid/jackson/CommonObjectMapperTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,9 +26,9 @@ import org.junit.Test; /** */ -public class DefaultObjectMapperTest +public class CommonObjectMapperTest { - ObjectMapper mapper = new DefaultObjectMapper(); + ObjectMapper mapper = new CommonObjectMapper(); @Test public void testDateTime() throws Exception diff --git a/indexing-common/src/main/java/com/metamx/druid/index/v1/IndexIO.java b/indexing-common/src/main/java/com/metamx/druid/index/v1/IndexIO.java index f95803831c8..aa12747ba9b 100644 --- a/indexing-common/src/main/java/com/metamx/druid/index/v1/IndexIO.java +++ b/indexing-common/src/main/java/com/metamx/druid/index/v1/IndexIO.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -52,7 +52,7 @@ import com.metamx.druid.index.serde.FloatGenericColumnSupplier; import com.metamx.druid.index.serde.LongGenericColumnPartSerde; import com.metamx.druid.index.serde.LongGenericColumnSupplier; import com.metamx.druid.index.serde.SpatialIndexColumnPartSupplier; -import com.metamx.druid.jackson.DefaultObjectMapper; +import com.metamx.druid.jackson.CommonObjectMapper; import com.metamx.druid.kv.ArrayIndexed; import com.metamx.druid.kv.ByteBufferSerializer; import com.metamx.druid.kv.ConciseCompressedIndexedInts; @@ -110,7 +110,7 @@ public class IndexIO public static final ByteOrder BYTE_ORDER = ByteOrder.nativeOrder(); // This should really be provided by DI, should be changed once we switch around to using a DI framework - private static final ObjectMapper mapper = new DefaultObjectMapper(); + private static final ObjectMapper mapper = new CommonObjectMapper(); private static volatile IndexIOHandler handler = null; public static final int CURRENT_VERSION_ID = V9_VERSION; @@ -790,7 +790,7 @@ public class IndexIO Map columns = Maps.newHashMap(); - ObjectMapper mapper = new DefaultObjectMapper(); + ObjectMapper mapper = new CommonObjectMapper(); for (String columnName : cols) { columns.put(columnName, deserializeColumn(mapper, smooshedFiles.mapFile(columnName))); diff --git a/indexing-common/src/test/java/com/metamx/druid/indexer/data/InputRowParserSerdeTest.java b/indexing-common/src/test/java/com/metamx/druid/indexer/data/InputRowParserSerdeTest.java index 418661ce9d6..649f0374eb6 100644 --- a/indexing-common/src/test/java/com/metamx/druid/indexer/data/InputRowParserSerdeTest.java +++ b/indexing-common/src/test/java/com/metamx/druid/indexer/data/InputRowParserSerdeTest.java @@ -1,3 +1,22 @@ +/* + * Druid - a distributed column store. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + package com.metamx.druid.indexer.data; import com.fasterxml.jackson.databind.ObjectMapper; @@ -6,7 +25,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.metamx.druid.index.v1.SpatialDimensionSchema; import com.metamx.druid.input.InputRow; -import com.metamx.druid.jackson.DefaultObjectMapper; +import com.metamx.druid.jackson.CommonObjectMapper; import junit.framework.Assert; import org.joda.time.DateTime; import org.junit.Test; @@ -15,7 +34,7 @@ import java.nio.ByteBuffer; public class InputRowParserSerdeTest { - private final ObjectMapper jsonMapper = new DefaultObjectMapper(); + private final ObjectMapper jsonMapper = new CommonObjectMapper(); @Test public void testStringInputRowParserSerde() throws Exception diff --git a/indexing-hadoop/src/main/java/com/metamx/druid/indexer/HadoopDruidIndexerAzkWrapper.java b/indexing-hadoop/src/main/java/com/metamx/druid/indexer/HadoopDruidIndexerAzkWrapper.java deleted file mode 100644 index 244c1d80901..00000000000 --- a/indexing-hadoop/src/main/java/com/metamx/druid/indexer/HadoopDruidIndexerAzkWrapper.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package com.metamx.druid.indexer; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.metamx.common.MapUtils; -import com.metamx.common.logger.Logger; -import com.metamx.druid.jackson.DefaultObjectMapper; -import org.joda.time.DateTime; -import org.joda.time.Interval; - -import java.util.List; -import java.util.Map; -import java.util.Properties; - -/** - */ -public class HadoopDruidIndexerAzkWrapper -{ - private static final Logger log = new Logger(HadoopDruidIndexerAzkWrapper.class); - private static final String PROPERTY_PREFIX = "druid.indexer."; - - private final String jobName; - private final Properties properties; - - public HadoopDruidIndexerAzkWrapper( - String jobName, - Properties properties - ) - { - this.jobName = jobName; - this.properties = properties; - } - - public void run() throws Exception - { - final DefaultObjectMapper jsonMapper = new DefaultObjectMapper(); - - final List dataInterval; - final Map theMap = Maps.newTreeMap(); - - for (String propertyName : properties.stringPropertyNames()) { - if (propertyName.startsWith(PROPERTY_PREFIX)) { - final String propValue = properties.getProperty(propertyName); - if (propValue.trim().startsWith("{") || propValue.trim().startsWith("[")) { - theMap.put(propertyName.substring(PROPERTY_PREFIX.length()), jsonMapper.readValue(propValue, Object.class)); - } - else { - theMap.put(propertyName.substring(PROPERTY_PREFIX.length()), propValue); - } - } - } - - log.info("Running with properties:"); - for (Map.Entry entry : theMap.entrySet()) { - log.info("%30s => %s", entry.getKey(), entry.getValue()); - } - - dataInterval = Lists.transform( - Lists.newArrayList(MapUtils.getString(theMap, "timeInterval").split(",")), new StringIntervalFunction() - ); - - final HadoopDruidIndexerConfig config = jsonMapper.convertValue(theMap, HadoopDruidIndexerConfig.class); - config.setIntervals(dataInterval); - config.setVersion(new DateTime().toString()); - - new HadoopDruidIndexerJob(config).run(); - } -} diff --git a/indexing-service/src/main/java/com/metamx/druid/indexing/coordinator/ThreadPoolTaskRunner.java b/indexing-service/src/main/java/com/metamx/druid/indexing/coordinator/ThreadPoolTaskRunner.java index e41f0aabb50..7a953bc9ccc 100644 --- a/indexing-service/src/main/java/com/metamx/druid/indexing/coordinator/ThreadPoolTaskRunner.java +++ b/indexing-service/src/main/java/com/metamx/druid/indexing/coordinator/ThreadPoolTaskRunner.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,10 +36,10 @@ import com.metamx.druid.indexing.common.TaskToolbox; import com.metamx.druid.indexing.common.TaskToolboxFactory; import com.metamx.druid.indexing.common.task.Task; import com.metamx.druid.query.NoopQueryRunner; -import com.metamx.druid.query.segment.QuerySegmentWalker; import com.metamx.emitter.EmittingLogger; import io.druid.query.Query; import io.druid.query.QueryRunner; +import io.druid.query.QuerySegmentWalker; import io.druid.query.SegmentDescriptor; import org.apache.commons.io.FileUtils; import org.joda.time.Interval; diff --git a/indexing-service/src/main/java/com/metamx/druid/indexing/worker/WorkerTaskMonitor.java b/indexing-service/src/main/java/com/metamx/druid/indexing/worker/WorkerTaskMonitor.java index d7e60e373f3..e59ad71a401 100644 --- a/indexing-service/src/main/java/com/metamx/druid/indexing/worker/WorkerTaskMonitor.java +++ b/indexing-service/src/main/java/com/metamx/druid/indexing/worker/WorkerTaskMonitor.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,8 +28,8 @@ import com.metamx.druid.indexing.common.TaskStatus; import com.metamx.druid.indexing.common.task.Task; import com.metamx.druid.indexing.coordinator.TaskRunner; import com.metamx.druid.indexing.worker.config.WorkerConfig; -import com.metamx.druid.query.segment.QuerySegmentWalker; import com.metamx.emitter.EmittingLogger; +import io.druid.query.QuerySegmentWalker; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.PathChildrenCache; import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; diff --git a/realtime/src/main/java/com/metamx/druid/realtime/RealtimeManager.java b/realtime/src/main/java/com/metamx/druid/realtime/RealtimeManager.java index 89288d5ab83..4681b644a40 100644 --- a/realtime/src/main/java/com/metamx/druid/realtime/RealtimeManager.java +++ b/realtime/src/main/java/com/metamx/druid/realtime/RealtimeManager.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,7 +31,6 @@ import com.metamx.druid.input.InputRow; import com.metamx.druid.query.FinalizeResultsQueryRunner; import com.metamx.druid.query.NoopQueryRunner; import com.metamx.druid.query.QueryRunnerFactoryConglomerate; -import com.metamx.druid.query.segment.QuerySegmentWalker; import com.metamx.druid.realtime.firehose.Firehose; import com.metamx.druid.realtime.plumber.Plumber; import com.metamx.druid.realtime.plumber.Sink; @@ -39,6 +38,7 @@ import com.metamx.emitter.EmittingLogger; import io.druid.query.Query; import io.druid.query.QueryRunner; import io.druid.query.QueryRunnerFactory; +import io.druid.query.QuerySegmentWalker; import io.druid.query.QueryToolChest; import io.druid.query.SegmentDescriptor; import org.joda.time.DateTime; diff --git a/server/src/main/java/com/metamx/druid/coordination/ServerManager.java b/server/src/main/java/com/metamx/druid/coordination/ServerManager.java index 138aab556af..56c591de522 100644 --- a/server/src/main/java/com/metamx/druid/coordination/ServerManager.java +++ b/server/src/main/java/com/metamx/druid/coordination/ServerManager.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -41,7 +41,6 @@ import com.metamx.druid.query.MetricsEmittingQueryRunner; import com.metamx.druid.query.NoopQueryRunner; import com.metamx.druid.query.QueryRunnerFactoryConglomerate; import com.metamx.druid.query.ReferenceCountingSegmentQueryRunner; -import com.metamx.druid.query.segment.QuerySegmentWalker; import com.metamx.druid.query.segment.SpecificSegmentQueryRunner; import com.metamx.druid.query.segment.SpecificSegmentSpec; import com.metamx.emitter.EmittingLogger; @@ -50,6 +49,7 @@ import com.metamx.emitter.service.ServiceMetricEvent; import io.druid.query.Query; import io.druid.query.QueryRunner; import io.druid.query.QueryRunnerFactory; +import io.druid.query.QuerySegmentWalker; import io.druid.query.QueryToolChest; import io.druid.query.SegmentDescriptor; import io.druid.query.spec.QuerySegmentSpec; diff --git a/server/src/main/java/com/metamx/druid/index/brita/ExtractionFilter.java b/server/src/main/java/com/metamx/druid/index/brita/ExtractionFilter.java index e12f067e211..5207efc0699 100644 --- a/server/src/main/java/com/metamx/druid/index/brita/ExtractionFilter.java +++ b/server/src/main/java/com/metamx/druid/index/brita/ExtractionFilter.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -20,12 +20,12 @@ package com.metamx.druid.index.brita; import com.google.common.collect.Lists; -import com.metamx.druid.query.extraction.DimExtractionFn; import io.druid.data.Indexed; import io.druid.query.filter.BitmapIndexSelector; import io.druid.query.filter.Filter; import io.druid.query.filter.ValueMatcher; import io.druid.query.filter.ValueMatcherFactory; +import io.druid.query.spec.DimExtractionFn; import it.uniroma3.mat.extendedset.intset.ImmutableConciseSet; import java.util.List; diff --git a/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java b/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java index 526cb8cc3c4..969d087efe3 100644 --- a/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java +++ b/server/src/main/java/com/metamx/druid/query/group/GroupByQueryEngine.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,9 +42,9 @@ import com.metamx.druid.guice.annotations.Global; import com.metamx.druid.index.brita.Filters; import com.metamx.druid.input.MapBasedRow; import com.metamx.druid.input.Row; -import com.metamx.druid.query.dimension.DimensionSpec; import io.druid.query.aggregation.AggregatorFactory; import io.druid.query.aggregation.BufferAggregator; +import io.druid.query.spec.DimensionSpec; import io.druid.segment.Cursor; import io.druid.segment.DimensionSelector; import io.druid.segment.StorageAdapter; diff --git a/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java b/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java index 66129edcffb..147fa7a72ee 100644 --- a/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java +++ b/server/src/test/java/com/metamx/druid/query/group/GroupByQueryRunnerTest.java @@ -1,6 +1,6 @@ /* * Druid - a distributed column store. - * Copyright (C) 2012 Metamarkets Group Inc. + * Copyright (C) 2012, 2013 Metamarkets Group Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,7 +38,6 @@ import com.metamx.druid.input.MapBasedRow; import com.metamx.druid.input.Row; import com.metamx.druid.query.QueryRunnerTestHelper; import com.metamx.druid.query.dimension.DefaultDimensionSpec; -import com.metamx.druid.query.dimension.DimensionSpec; import com.metamx.druid.query.filter.RegexDimFilter; import com.metamx.druid.query.group.having.EqualToHavingSpec; import com.metamx.druid.query.group.having.GreaterThanHavingSpec; @@ -51,6 +50,7 @@ import io.druid.granularity.QueryGranularity; import io.druid.query.Query; import io.druid.query.QueryRunner; import io.druid.query.aggregation.AggregatorFactory; +import io.druid.query.spec.DimensionSpec; import io.druid.query.spec.MultipleIntervalSegmentSpec; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -731,7 +731,7 @@ public class GroupByQueryRunnerTest ); TestHelper.assertExpectedObjects(expectedResults, runner.run(query), "normal"); - QueryRunner mergeRunner = new GroupByQueryQueryToolChest().mergeResults(runner); + QueryRunner mergeRunner = new GroupByQueryQueryToolChest(configSupplier).mergeResults(runner); TestHelper.assertExpectedObjects(expectedResults, mergeRunner.run(query), "no-limit"); }