├── .gitignore
├── .maven.xml
├── .travis.yml
├── LICENSE
├── NOTICE
├── README.md
├── pom.xml
└── src
├── main
└── java
│ └── in
│ └── zapr
│ └── druid
│ └── druidry
│ ├── aggregator
│ ├── CardinalityAggregator.java
│ ├── CountAggregator.java
│ ├── DoubleFirstAggregator.java
│ ├── DoubleLastAggregator.java
│ ├── DoubleMaxAggregator.java
│ ├── DoubleMinAggregator.java
│ ├── DoubleSumAggregator.java
│ ├── DruidAggregator.java
│ ├── FilteredAggregator.java
│ ├── FloatFirstAggregator.java
│ ├── FloatLastAggregator.java
│ ├── HyperUniqueAggregator.java
│ ├── JavaScriptAggregator.java
│ ├── LongFirstAggregator.java
│ ├── LongLastAggregator.java
│ ├── LongMaxAggregator.java
│ ├── LongMinAggregator.java
│ ├── LongSumAggregator.java
│ ├── StringFirstAggregator.java
│ └── StringLastAggregator.java
│ ├── averager
│ ├── DoubleMaxAverager.java
│ ├── DoubleMeanAverager.java
│ ├── DoubleMeanNoNullsAverager.java
│ ├── DoubleMinAverager.java
│ ├── DoubleSumAverager.java
│ ├── DruidAverager.java
│ ├── LongMaxAverager.java
│ ├── LongMeanAverager.java
│ ├── LongMeanNoNullsAverager.java
│ ├── LongMinAverager.java
│ └── LongSumAverager.java
│ ├── client
│ ├── DruidClient.java
│ ├── DruidConfiguration.java
│ ├── DruidError.java
│ ├── DruidJerseyClient.java
│ ├── DruidQueryProtocol.java
│ └── exception
│ │ ├── ConnectionException.java
│ │ ├── DruidryException.java
│ │ └── QueryException.java
│ ├── dataSource
│ ├── DataSource.java
│ ├── DataSourceType.java
│ ├── QueryDataSource.java
│ ├── TableDataSource.java
│ └── UnionDataSource.java
│ ├── dimension
│ ├── DefaultDimension.java
│ ├── DimensionSpec.java
│ ├── DruidDimension.java
│ ├── ExtractionDimension.java
│ ├── FilteredDimension.java
│ ├── ListFilteredDimension.java
│ ├── PrefixFilteredDimension.java
│ ├── RegexFilteredDimension.java
│ ├── SimpleDimension.java
│ └── enums
│ │ ├── FilteredDimensionType.java
│ │ └── OutputType.java
│ ├── extensions
│ ├── datasketches
│ │ ├── aggregator
│ │ │ ├── HllSketchBuildAggregator.java
│ │ │ ├── HllSketchMergeAggregator.java
│ │ │ ├── QuantilesSketchAggregator.java
│ │ │ ├── TargetHllType.java
│ │ │ ├── ThetaSketchAggregator.java
│ │ │ └── TupleSketchAggregator.java
│ │ └── postAggregator
│ │ │ ├── HllSketchEstimateWithBoundsPostAggregator.java
│ │ │ ├── HllSketchToStringPostAggregator.java
│ │ │ ├── HllSketchUnionPostAggregator.java
│ │ │ ├── QuantilesSketchToHistogramPostAggregator.java
│ │ │ ├── QuantilesSketchToQuantilePostAggregator.java
│ │ │ ├── QuantilesSketchToQuantilesPostAggregator.java
│ │ │ ├── QuantilesSketchToStringPostAggregator.java
│ │ │ ├── ThetaSketchEstimatePostAggregator.java
│ │ │ ├── ThetaSketchFunction.java
│ │ │ ├── ThetaSketchSetOpPostAggregator.java
│ │ │ ├── TupleSketchOperation.java
│ │ │ ├── TupleSketchSetOpPostAggregator.java
│ │ │ ├── TupleSketchTTestPostAggregator.java
│ │ │ ├── TupleSketchToEstimateAndBoundsPostAggregator.java
│ │ │ ├── TupleSketchToEstimatePostAggregator.java
│ │ │ ├── TupleSketchToMeansPostAggregator.java
│ │ │ ├── TupleSketchToNumEntriesPostAggregator.java
│ │ │ ├── TupleSketchToQuantilesSketchPostAggregator.java
│ │ │ ├── TupleSketchToStringPostAggregator.java
│ │ │ └── TupleSketchToVariancesPostAggregator.java
│ ├── distinctcount
│ │ └── aggregator
│ │ │ └── DistinctCountAggregator.java
│ └── histogram
│ │ ├── aggregator
│ │ ├── ApproxHistogramAggregator.java
│ │ ├── ApproxHistogramFoldAggregator.java
│ │ └── QuantilePostAggregator.java
│ │ └── postAggregator
│ │ ├── CustomBucketsPostAggregator.java
│ │ ├── EqualBucketsPostAggregator.java
│ │ ├── MaxPostAggregator.java
│ │ ├── MinPostAggregator.java
│ │ ├── QuantilePostAggregator.java
│ │ └── QuantilesPostAggregator.java
│ ├── extractionFunctions
│ ├── CascadeExtractionFunction.java
│ ├── ExtractionFunction.java
│ ├── JavascriptExtractionFunction.java
│ ├── LookUpExtractionFunction.java
│ ├── PartialExtractionFunction.java
│ ├── RegexExtractionFunction.java
│ ├── RegisteredLookUpExtractionFunction.java
│ ├── SearchQueryExtractionFunction.java
│ ├── StrLenExtractionFunction.java
│ ├── StringFormatExtractionFunction.java
│ ├── SubStringExtractionFunction.java
│ ├── TimeFormatExtractionFunction.java
│ └── TimeParsingExtractionFunction.java
│ ├── filter
│ ├── AndFilter.java
│ ├── BoundFilter.java
│ ├── DruidFilter.java
│ ├── InFilter.java
│ ├── IntervalFilter.java
│ ├── JavaScriptFilter.java
│ ├── NotFilter.java
│ ├── OrFilter.java
│ ├── RegexFilter.java
│ ├── SearchFilter.java
│ ├── SelectorFilter.java
│ ├── havingSpec
│ │ ├── AndHaving.java
│ │ ├── DimSelectorHaving.java
│ │ ├── EqualToHaving.java
│ │ ├── FilterHaving.java
│ │ ├── GreaterThanHaving.java
│ │ ├── HavingSpec.java
│ │ ├── LessThanHaving.java
│ │ ├── NotHaving.java
│ │ └── OrHaving.java
│ └── searchQuerySpec
│ │ ├── ContainsSearchQuerySpec.java
│ │ ├── FragmentSearchQuerySpec.java
│ │ ├── InsensitiveContainsSearchQuerySpec.java
│ │ ├── RegexSearchQuerySpec.java
│ │ └── SearchQuerySpec.java
│ ├── granularity
│ ├── DurationGranularity.java
│ ├── Granularity.java
│ ├── PeriodGranularity.java
│ ├── PredefinedGranularity.java
│ └── SimpleGranularity.java
│ ├── limitSpec
│ ├── DefaultLimitSpec.java
│ └── orderByColumnSpec
│ │ ├── OrderByColumnSpec.java
│ │ ├── OrderByColumnSpecMap.java
│ │ └── OrderByColumnSpecString.java
│ ├── lookUpSpec
│ └── LookUpSpec.java
│ ├── postAggregator
│ ├── ArithmeticFunction.java
│ ├── ArithmeticOrdering.java
│ ├── ArithmeticPostAggregator.java
│ ├── ConstantPostAggregator.java
│ ├── DruidPostAggregator.java
│ ├── FieldAccessPostAggregator.java
│ ├── HyperUniqueCardinalityPostAggregator.java
│ └── JavaScriptPostAggregator.java
│ ├── query
│ ├── DruidQuery.java
│ ├── QueryType.java
│ ├── aggregation
│ │ ├── DruidAggregationQuery.java
│ │ ├── DruidGroupByQuery.java
│ │ ├── DruidMovingAverageQuery.java
│ │ ├── DruidTimeSeriesQuery.java
│ │ └── DruidTopNQuery.java
│ ├── config
│ │ ├── Context.java
│ │ ├── GroupByStrategy.java
│ │ ├── Interval.java
│ │ ├── SortingOrder.java
│ │ └── Vectorize.java
│ ├── metadata
│ │ ├── DruidDataSourceMetadataQuery.java
│ │ ├── DruidMetadataQuery.java
│ │ ├── DruidSegmentMetadataQuery.java
│ │ └── DruidTimeBoundaryQuery.java
│ ├── scan
│ │ ├── DruidScanQuery.java
│ │ └── ResultFormat.java
│ ├── search
│ │ ├── DruidSearchQuery.java
│ │ └── SearchSortSpec.java
│ └── select
│ │ ├── DruidSelectQuery.java
│ │ └── PagingSpec.java
│ ├── topNMetric
│ ├── DimensionMetric.java
│ ├── InvertedMetric.java
│ ├── NumericMetric.java
│ ├── SimpleMetric.java
│ └── TopNMetric.java
│ └── virtualColumn
│ ├── DruidVirtualColumn.java
│ └── ExpressionVirtualColumn.java
└── test
├── java
└── in
│ └── zapr
│ └── druid
│ └── druidry
│ ├── aggregator
│ ├── CardinalityAggregatorTest.java
│ ├── CountAggregatorTest.java
│ ├── DoubleFirstAggregatorTest.java
│ ├── DoubleLastAggregatorTest.java
│ ├── DoubleMaxAggregatorTest.java
│ ├── DoubleMinAggregatorTest.java
│ ├── DoubleSumAggregatorTest.java
│ ├── FilteredAggregatorTest.java
│ ├── FloatFirstAggregatorTest.java
│ ├── FloatLastAggregatorTest.java
│ ├── HyperUniqueAggregatorTest.java
│ ├── JavaScriptAggregatorTest.java
│ ├── LongFirstAggregatorTest.java
│ ├── LongLastAggregatorTest.java
│ ├── LongMaxAggregatorTest.java
│ ├── LongMinAggregatorTest.java
│ ├── LongSumAggregatorTest.java
│ ├── StringFirstAggregatorTest.java
│ └── StringLastAggregatorTest.java
│ ├── client
│ ├── DruidClientTest.java
│ └── DruidConfigurationTest.java
│ ├── dataSource
│ ├── QueryDataSourceTest.java
│ ├── TableDataSourceTest.java
│ └── UnionDataSourceTest.java
│ ├── dimension
│ ├── DefaultDimensionTest.java
│ ├── ExtractionDimensionTest.java
│ ├── ListFilteredDimensionTest.java
│ ├── PrefixFilteredDimensionTest.java
│ ├── RegexFilteredDimensionTest.java
│ └── SimpleDimensionTest.java
│ ├── extensions
│ ├── datasketches
│ │ ├── aggregator
│ │ │ ├── HllSketchBuildAggregatorTest.java
│ │ │ ├── HllSketchMergeAggregatorTest.java
│ │ │ ├── QuantilesSketchAggregatorTest.java
│ │ │ ├── ThetaSketchAggregatorTest.java
│ │ │ └── TupleSketchAggregatorTest.java
│ │ └── postAggregator
│ │ │ ├── HllSketchEstimateWithBoundsPostAggregatorTest.java
│ │ │ ├── HllSketchToStringPostAggregatorTest.java
│ │ │ ├── HllSketchUnionPostAggregatorTest.java
│ │ │ ├── QuantilesSketchToHistogramPostAggregatorTest.java
│ │ │ ├── QuantilesSketchToQuantilePostAggregatorTest.java
│ │ │ ├── QuantilesSketchToQuantilesPostAggregatorTest.java
│ │ │ ├── QuantilesSketchToStringPostAggregatorTest.java
│ │ │ ├── ThetaSketchEstimatePostAggregatorTest.java
│ │ │ ├── ThetaSketchSetOpPostAggregatorTest.java
│ │ │ ├── TupleSketchSetOpPostAggregatorTest.java
│ │ │ ├── TupleSketchTTestPostAggregatorTest.java
│ │ │ ├── TupleSketchToEstimateAndBoundsPostAggregatorTest.java
│ │ │ ├── TupleSketchToEstimatePostAggregatorTest.java
│ │ │ ├── TupleSketchToMeansPostAggregatorTest.java
│ │ │ ├── TupleSketchToNumEntriesPostAggregatorTest.java
│ │ │ ├── TupleSketchToQuantilesSketchPostAggregatorTest.java
│ │ │ ├── TupleSketchToStringPostAggregatorTest.java
│ │ │ └── TupleSketchToVariancesPostAggregatorTest.java
│ ├── distinctcount
│ │ └── aggregator
│ │ │ └── DistinctCountAggregatorTest.java
│ └── histogram
│ │ ├── aggregator
│ │ ├── ApproxHistogramAggregatorTest.java
│ │ ├── ApproxHistogramFoldAggregatorTest.java
│ │ └── QuantilePostAggregatorTest.java
│ │ └── postAggregator
│ │ ├── CustomBucketsPostAggregatorTest.java
│ │ ├── EqualBucketsPostAggregatorTest.java
│ │ ├── MaxPostAggregatorTest.java
│ │ ├── MinPostAggregatorTest.java
│ │ ├── QuantilePostAggregatorTest.java
│ │ └── QuantilesPostAggregatorTest.java
│ ├── extractionFunctions
│ ├── CascadeExtractionFunctionTest.java
│ ├── JavascriptExtractionFunctionTest.java
│ ├── PartialExtractionFunctionTest.java
│ ├── RegexExtractionFunctionTest.java
│ ├── SearchQueryExtractionFunctionTest.java
│ ├── StrLenExtractionFunctionTest.java
│ ├── SubStringExtractionFunctionTest.java
│ ├── TimeFormatExtractionFunctionTest.java
│ └── TimeParsingExtractionFunctionTest.java
│ ├── filter
│ ├── AndFilterTest.java
│ ├── BoundFilterTest.java
│ ├── InFilterTest.java
│ ├── IntervalFilterTest.java
│ ├── JavascriptFilterTest.java
│ ├── NotFilterTest.java
│ ├── OrFilterTest.java
│ ├── RegexFilterTest.java
│ ├── SelectorFilterTest.java
│ ├── havingSpec
│ │ ├── AndHavingTest.java
│ │ ├── DimSelectionHavingTest.java
│ │ ├── EqualToHavingTest.java
│ │ ├── FilterHavingTest.java
│ │ ├── GreaterThanHavingTest.java
│ │ ├── LessThanHavingTest.java
│ │ ├── NotHavingTest.java
│ │ └── OrHavingTest.java
│ └── searchQuerySpec
│ │ ├── ContainsSearchQuerySpecTest.java
│ │ ├── FragmentSearchQuerySpecTest.java
│ │ ├── InsensitiveContainsSearchQuerySpecTest.java
│ │ └── RegexSearchQuerySpecTest.java
│ ├── granularity
│ ├── DurationGranularityTest.java
│ ├── PeriodGranularityTest.java
│ └── SimpleGranularityTest.java
│ ├── limitSpec
│ ├── DefaultLimitSpecTest.java
│ └── OrderByColumnSpecMapTest.java
│ ├── postAggregator
│ ├── ArithmeticPostAggregatorTest.java
│ ├── ConstantPostAggregatorTest.java
│ ├── FieldAccessPostAggregatorTest.java
│ ├── HyperUniqueCardinalityPostAggregatorTest.java
│ └── JavascriptPostAggregatorTest.java
│ ├── query
│ ├── aggregation
│ │ ├── GroupByTest.java
│ │ ├── MovingAverageCreators.java
│ │ ├── MovingAverageTest.java
│ │ ├── TimeSeriesTest.java
│ │ └── TopNQueryTest.java
│ ├── config
│ │ ├── ContextTest.java
│ │ └── IntervalTest.java
│ ├── scan
│ │ └── DruidScanQueryTest.java
│ ├── search
│ │ └── DruidSearchQueryTest.java
│ └── select
│ │ └── DruidSelectQueryTest.java
│ ├── topNMetric
│ ├── DimensionMetricTest.java
│ ├── InvertedMetricTest.java
│ └── NumericMetricTest.java
│ └── virtualColumn
│ └── ExpressionVirtualColumnTest.java
└── resources
└── query
└── aggregation
└── moving_average
├── allFields.json
├── averager_type
├── doubleMax.json
├── doubleMean.json
├── doubleMeanNoNulls.json
├── doubleMin.json
├── doubleSum.json
├── longMax.json
├── longMean.json
├── longMeanNoNulls.json
├── longMin.json
└── longSum.json
└── simple.json
/.maven.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | ossrh
7 | ${env.SONATYPE_USERNAME}
8 | ${env.SONATYPE_PASSWORD}
9 |
10 |
11 |
12 |
13 |
14 | ossrh
15 |
16 | true
17 |
18 |
19 | ${env.GPG_EXECUTABLE}
20 | ${env.GPG_PASSPHRASE}
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
3 | cache:
4 | directories:
5 | - $HOME/.m2
6 |
7 | #before_install:
8 | # - echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
9 | # - echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
10 |
11 | install:
12 | mvn --settings .maven.xml install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
13 |
14 | #script:
15 | # mvn clean deploy --settings .maven.xml -DskipTests=true -B -U -Prelease
16 |
17 | before_deploy:
18 | - echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
19 | - echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
20 | - mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
21 | - export project_version=$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
22 |
23 | deploy:
24 | provider: script
25 | script: mvn clean deploy --settings .maven.xml -DskipTests=true -B -U -Prelease
26 | skip_cleanup: true
27 | on:
28 | branch: master
29 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Druidry - a Java Druid Client
2 | Copyright 2018-present ZAPR Media Labs
3 |
4 | This product includes software developed at
5 | ZAPR Media Labs (https://www.zapr.in/)
6 |
7 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/CardinalityAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.util.List;
22 |
23 | import lombok.Builder;
24 | import lombok.EqualsAndHashCode;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @Getter
30 | @EqualsAndHashCode(callSuper = true)
31 | public class CardinalityAggregator extends DruidAggregator {
32 |
33 | private static final String CARDINALITY_AGGREGATOR_TYPE = "cardinality";
34 | private List fields;
35 | private Boolean byRow;
36 |
37 | @Builder
38 | private CardinalityAggregator(@NonNull String name, @NonNull List fields, Boolean byRow) {
39 | this.type = CARDINALITY_AGGREGATOR_TYPE;
40 | this.name = name;
41 | this.fields = fields;
42 | this.byRow = byRow;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/CountAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.NonNull;
21 |
22 | @EqualsAndHashCode(callSuper = true)
23 | public class CountAggregator extends DruidAggregator {
24 |
25 | private static final String COUNT_TYPE_AGGREGATOR = "count";
26 |
27 | public CountAggregator(@NonNull String name) {
28 | this.type = COUNT_TYPE_AGGREGATOR;
29 | this.name = name;
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/DoubleFirstAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package in.zapr.druid.druidry.aggregator;
17 |
18 | import lombok.EqualsAndHashCode;
19 | import lombok.Getter;
20 | import lombok.NonNull;
21 |
22 | @Getter
23 | @EqualsAndHashCode(callSuper = true)
24 | public class DoubleFirstAggregator extends DruidAggregator {
25 | private static final String DOUBLE_FIRST_AGGREGATOR = "doubleFirst";
26 | private String fieldName;
27 |
28 | public DoubleFirstAggregator(@NonNull String name, @NonNull String fieldName) {
29 | this.type = DOUBLE_FIRST_AGGREGATOR;
30 | this.name = name;
31 | this.fieldName = fieldName;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/DoubleLastAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode(callSuper = true)
25 | public class DoubleLastAggregator extends DruidAggregator {
26 | private static final String DOUBLE_LAST_AGGREGATOR = "doubleLast";
27 | private String fieldName;
28 |
29 | public DoubleLastAggregator(@NonNull String name, @NonNull String fieldName) {
30 | this.type = DOUBLE_LAST_AGGREGATOR;
31 | this.name = name;
32 | this.fieldName = fieldName;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/DruidAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 |
22 | @Getter
23 | @EqualsAndHashCode
24 | public abstract class DruidAggregator {
25 |
26 | protected String type;
27 | protected String name;
28 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/FilteredAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.filter.DruidFilter;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @JsonInclude(JsonInclude.Include.NON_NULL)
28 | @EqualsAndHashCode(callSuper = true)
29 | public class FilteredAggregator extends DruidAggregator {
30 |
31 | private static final String FILTERED_AGGREGATOR_TYPE = "filtered";
32 |
33 | private DruidFilter filter;
34 | private DruidAggregator aggregator;
35 |
36 | public FilteredAggregator(@NonNull DruidFilter filter, @NonNull DruidAggregator aggregator) {
37 | this.type = FILTERED_AGGREGATOR_TYPE;
38 | this.filter = filter;
39 | this.aggregator = aggregator;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/FloatFirstAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package in.zapr.druid.druidry.aggregator;
17 |
18 | import lombok.EqualsAndHashCode;
19 | import lombok.Getter;
20 | import lombok.NonNull;
21 |
22 | @Getter
23 | @EqualsAndHashCode(callSuper = true)
24 | public class FloatFirstAggregator extends DruidAggregator {
25 | private static final String FLOAT_FIRST_AGGREGATOR = "floatFirst";
26 | private String fieldName;
27 |
28 | public FloatFirstAggregator(@NonNull String name, @NonNull String fieldName) {
29 | this.type = FLOAT_FIRST_AGGREGATOR;
30 | this.name = name;
31 | this.fieldName = fieldName;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/FloatLastAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package in.zapr.druid.druidry.aggregator;
17 |
18 | import lombok.EqualsAndHashCode;
19 | import lombok.Getter;
20 | import lombok.NonNull;
21 |
22 | @Getter
23 | @EqualsAndHashCode(callSuper = true)
24 | public class FloatLastAggregator extends DruidAggregator {
25 | private static final String FLOAT_LAST_AGGREGATOR = "floatLast";
26 | private String fieldName;
27 |
28 | public FloatLastAggregator(@NonNull String name, @NonNull String fieldName) {
29 | this.type = FLOAT_LAST_AGGREGATOR;
30 | this.name = name;
31 | this.fieldName = fieldName;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/HyperUniqueAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @EqualsAndHashCode(callSuper = true)
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class HyperUniqueAggregator extends DruidAggregator {
30 |
31 | private static final String HYPER_UNIQUE_TYPE_AGGREGATOR = "hyperUnique";
32 | private String fieldName;
33 | private Boolean round;
34 |
35 | @Deprecated
36 | public HyperUniqueAggregator(@NonNull String name, @NonNull String fieldName) {
37 | this.type = HYPER_UNIQUE_TYPE_AGGREGATOR;
38 | this.name = name;
39 | this.fieldName = fieldName;
40 | }
41 |
42 | @Builder
43 | private HyperUniqueAggregator(@NonNull String name, @NonNull String fieldName, Boolean round) {
44 | this.type = HYPER_UNIQUE_TYPE_AGGREGATOR;
45 | this.name = name;
46 | this.fieldName = fieldName;
47 | this.round = round;
48 | }
49 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/LongFirstAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode(callSuper = true)
25 | public class LongFirstAggregator extends DruidAggregator {
26 | private static final String LONG_FIRST_AGGREGATOR = "longFirst";
27 | private String fieldName;
28 |
29 | public LongFirstAggregator(@NonNull String name, @NonNull String fieldName) {
30 | this.type = LONG_FIRST_AGGREGATOR;
31 | this.name = name;
32 | this.fieldName = fieldName;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/LongLastAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode(callSuper = true)
25 | public class LongLastAggregator extends DruidAggregator {
26 | private static final String LONG_LAST_AGGREGATOR = "longLast";
27 | private String fieldName;
28 |
29 | public LongLastAggregator(@NonNull String name, @NonNull String fieldName) {
30 | this.type = LONG_LAST_AGGREGATOR;
31 | this.name = name;
32 | this.fieldName = fieldName;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/StringFirstAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @EqualsAndHashCode(callSuper = true)
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class StringFirstAggregator extends DruidAggregator {
30 |
31 | private static final String STRING_FIRST_TYPE = "stringFirst";
32 |
33 | private String fieldName;
34 | private Integer maxStringBytes;
35 |
36 | @Builder
37 | private StringFirstAggregator(@NonNull String name, @NonNull String fieldName,
38 | Integer maxStringBytes) {
39 | this.type = STRING_FIRST_TYPE;
40 | this.name = name;
41 | this.fieldName = fieldName;
42 | this.maxStringBytes = maxStringBytes;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/aggregator/StringLastAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @EqualsAndHashCode(callSuper = true)
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class StringLastAggregator extends DruidAggregator {
30 |
31 | private static final String STRING_LAST_TYPE = "stringLast";
32 |
33 | private String fieldName;
34 | private Integer maxStringBytes;
35 |
36 | @Builder
37 | private StringLastAggregator(@NonNull String name, @NonNull String fieldName,
38 | Integer maxStringBytes) {
39 | this.type = STRING_LAST_TYPE;
40 | this.name = name;
41 | this.fieldName = fieldName;
42 | this.maxStringBytes = maxStringBytes;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/DoubleMaxAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class DoubleMaxAverager extends DruidAverager {
27 |
28 | private static final String DOUBLE_MAX_AVERAGER = "doubleMax";
29 |
30 | @Builder
31 | private DoubleMaxAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(DOUBLE_MAX_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/DoubleMeanAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class DoubleMeanAverager extends DruidAverager {
27 |
28 | private static final String DOUBLE_MEAN_AVERAGER = "doubleMean";
29 |
30 | @Builder
31 | private DoubleMeanAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(DOUBLE_MEAN_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/DoubleMeanNoNullsAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class DoubleMeanNoNullsAverager extends DruidAverager {
27 |
28 | private static final String DOUBLE_MEAN_NO_NULLS_AVERAGER = "doubleMeanNoNulls";
29 |
30 | @Builder
31 | private DoubleMeanNoNullsAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(DOUBLE_MEAN_NO_NULLS_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/DoubleMinAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class DoubleMinAverager extends DruidAverager {
27 |
28 | private static final String DOUBLE_MIN_AVERAGER = "doubleMin";
29 |
30 | @Builder
31 | private DoubleMinAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(DOUBLE_MIN_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/DoubleSumAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class DoubleSumAverager extends DruidAverager {
27 |
28 | private static final String DOUBLE_SUM_AVERAGER = "doubleSum";
29 |
30 | @Builder
31 | private DoubleSumAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(DOUBLE_SUM_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/DruidAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /*
18 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
19 | *
20 | * Licensed under the Apache License, Version 2.0 (the "License");
21 | * you may not use this file except in compliance with the License.
22 | * You may obtain a copy of the License at
23 | *
24 | * http://www.apache.org/licenses/LICENSE-2.0
25 | *
26 | * Unless required by applicable law or agreed to in writing, software
27 | * distributed under the License is distributed on an "AS IS" BASIS,
28 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 | * See the License for the specific language governing permissions and
30 | * limitations under the License.
31 | */
32 |
33 | package in.zapr.druid.druidry.averager;
34 |
35 | import com.fasterxml.jackson.annotation.JsonInclude;
36 | import lombok.AllArgsConstructor;
37 | import lombok.EqualsAndHashCode;
38 | import lombok.Getter;
39 |
40 | @Getter
41 | @EqualsAndHashCode
42 | @AllArgsConstructor
43 | @JsonInclude(JsonInclude.Include.NON_NULL)
44 | public abstract class DruidAverager {
45 |
46 | protected String type;
47 | protected String name;
48 | protected String fieldName;
49 | protected Integer buckets;
50 | protected Integer cycleSize;
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/LongMaxAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class LongMaxAverager extends DruidAverager {
27 |
28 | private static final String LONG_MAX_AVERAGER = "longMax";
29 |
30 | @Builder
31 | private LongMaxAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(LONG_MAX_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/LongMeanAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class LongMeanAverager extends DruidAverager {
27 |
28 | private static final String LONG_MEAN_AVERAGER = "longMean";
29 |
30 | @Builder
31 | private LongMeanAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(LONG_MEAN_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/LongMeanNoNullsAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class LongMeanNoNullsAverager extends DruidAverager {
27 |
28 | private static final String LONG_MEAN_NO_NULLS_AVERAGER = "longMeanNoNulls";
29 |
30 | @Builder
31 | private LongMeanNoNullsAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(LONG_MEAN_NO_NULLS_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/LongMinAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class LongMinAverager extends DruidAverager {
27 |
28 | private static final String LONG_MIN_AVERAGER = "longMin";
29 |
30 | @Builder
31 | private LongMinAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(LONG_MIN_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/averager/LongSumAverager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.averager;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class LongSumAverager extends DruidAverager {
27 |
28 | private static final String LONG_SUM_AVERAGER = "longSum";
29 |
30 | @Builder
31 | private LongSumAverager(@NonNull String name, @NonNull String fieldName,
32 | @NonNull Integer buckets, Integer cycleSize) {
33 | super(LONG_SUM_AVERAGER, name, fieldName, buckets, cycleSize);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/client/DruidError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.client;
18 |
19 | import lombok.Getter;
20 |
21 | @Getter
22 | public class DruidError {
23 |
24 | private String error;
25 | private String errorMessage;
26 | private String errorClass;
27 | private String host;
28 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/client/DruidQueryProtocol.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.client;
18 |
19 | public enum DruidQueryProtocol {
20 | HTTP("http"),
21 | HTTPS("https");
22 |
23 | private String protocol;
24 |
25 | DruidQueryProtocol(String protocol) {
26 | this.protocol = protocol;
27 | }
28 |
29 | @Override
30 | public String toString() {
31 | return this.protocol;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/client/exception/ConnectionException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.client.exception;
18 |
19 | public class ConnectionException extends DruidryException {
20 | public ConnectionException(Exception e) {
21 | super(e);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/client/exception/DruidryException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.client.exception;
18 |
19 | public class DruidryException extends Exception {
20 |
21 | protected DruidryException(Exception e) {
22 | super(e);
23 | }
24 |
25 | protected DruidryException(String message) {
26 | super(message);
27 | }
28 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/client/exception/QueryException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.client.exception;
18 |
19 | import in.zapr.druid.druidry.client.DruidError;
20 | import lombok.Getter;
21 |
22 | public class QueryException extends DruidryException {
23 |
24 | @Getter
25 | private DruidError druidError;
26 |
27 | public QueryException(Exception e) {
28 | super(e);
29 | }
30 |
31 | public QueryException(String message) {
32 | super(message);
33 | }
34 |
35 | public QueryException(DruidError error) {
36 | super(error.getErrorMessage());
37 | this.druidError = error;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dataSource/DataSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dataSource;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | /**
26 | * Generate datasource for druid query. See documentation
27 | *
28 | * http://druid.io/docs/latest/querying/datasource.html
29 | *
30 | */
31 | @Getter
32 | @JsonInclude(JsonInclude.Include.NON_NULL)
33 | @EqualsAndHashCode
34 | public abstract class DataSource {
35 |
36 | @NonNull
37 | protected DataSourceType type;
38 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dataSource/DataSourceType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dataSource;
18 |
19 | import com.fasterxml.jackson.annotation.JsonValue;
20 |
21 | public enum DataSourceType {
22 |
23 | TABLE("table"),
24 | UNION("union"),
25 | QUERY("query");
26 |
27 | private String value;
28 |
29 | DataSourceType(String value) {
30 | this.value = value;
31 | }
32 |
33 | @JsonValue
34 | public String getQueryType() {
35 | return value;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dataSource/QueryDataSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dataSource;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.query.DruidQuery;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class QueryDataSource extends DataSource {
31 |
32 | @NonNull
33 | private DruidQuery query;
34 |
35 | @Builder
36 | public QueryDataSource(@NonNull DruidQuery query) {
37 | this.type = DataSourceType.QUERY;
38 | this.query = query;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dataSource/TableDataSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dataSource;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @JsonInclude(JsonInclude.Include.NON_NULL)
28 | @EqualsAndHashCode(callSuper = true)
29 | public class TableDataSource extends DataSource {
30 |
31 | @NonNull
32 | private String name;
33 |
34 | @Builder
35 | public TableDataSource(@NonNull String name) {
36 | this.type = DataSourceType.TABLE;
37 | this.name = name;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dataSource/UnionDataSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dataSource;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.util.List;
22 |
23 | import lombok.Builder;
24 | import lombok.EqualsAndHashCode;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | @EqualsAndHashCode(callSuper = true)
31 | public class UnionDataSource extends DataSource {
32 |
33 | @NonNull
34 | private List dataSources;
35 |
36 | @Builder
37 | public UnionDataSource(@NonNull List dataSources) {
38 | this.type = DataSourceType.UNION;
39 | this.dataSources = dataSources;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/DefaultDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.dimension.enums.OutputType;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class DefaultDimension extends DimensionSpec {
31 |
32 | private static final String DEFAULT_TYPE = "default";
33 |
34 | @Builder
35 | public DefaultDimension(@NonNull String dimension, @NonNull String outputName,
36 | OutputType outputType) {
37 | this.type = DefaultDimension.DEFAULT_TYPE;
38 | this.dimension = dimension;
39 | this.outputName = outputName;
40 | this.outputType = outputType;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/DimensionSpec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 | import in.zapr.druid.druidry.dimension.enums.OutputType;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public abstract class DimensionSpec extends DruidDimension {
27 |
28 | @NonNull
29 | protected String type;
30 |
31 | @NonNull
32 | protected String dimension;
33 |
34 | @NonNull
35 | protected String outputName;
36 |
37 | protected OutputType outputType;
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/DruidDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 |
22 | @Getter
23 | @EqualsAndHashCode
24 | public abstract class DruidDimension {
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/FilteredDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 | import in.zapr.druid.druidry.dimension.enums.FilteredDimensionType;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public abstract class FilteredDimension extends DruidDimension {
27 | @NonNull
28 | protected DimensionSpec delegate;
29 | @NonNull
30 | protected FilteredDimensionType type;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/ListFilteredDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 | import com.fasterxml.jackson.annotation.JsonProperty;
21 |
22 | import java.util.List;
23 |
24 | import in.zapr.druid.druidry.dimension.enums.FilteredDimensionType;
25 | import lombok.Builder;
26 | import lombok.EqualsAndHashCode;
27 | import lombok.Getter;
28 | import lombok.NonNull;
29 |
30 | @Getter
31 | @JsonInclude(JsonInclude.Include.NON_NULL)
32 | @EqualsAndHashCode(callSuper = true)
33 | public class ListFilteredDimension extends FilteredDimension {
34 | private List values;
35 | @JsonProperty(value = "isWhitelist")
36 | private Boolean whitelist;
37 |
38 | @Builder
39 | public ListFilteredDimension(@NonNull DimensionSpec dimensionSpec, @NonNull List values, Boolean whitelist) {
40 | this.delegate = dimensionSpec;
41 | this.type = FilteredDimensionType.LIST_FILTERED;
42 | this.values = values;
43 | this.whitelist = whitelist;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/PrefixFilteredDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 |
22 | import in.zapr.druid.druidry.dimension.enums.FilteredDimensionType;
23 | import lombok.Builder;
24 | import lombok.EqualsAndHashCode;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | @EqualsAndHashCode(callSuper = true)
31 | public class PrefixFilteredDimension extends FilteredDimension {
32 | private String prefix;
33 |
34 | @Builder
35 | public PrefixFilteredDimension(@NonNull DimensionSpec dimensionSpec, @NonNull String prefix) {
36 | this.prefix = prefix;
37 | this.delegate = dimensionSpec;
38 | this.type = FilteredDimensionType.PREFIX_FILTERED;
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/RegexFilteredDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 |
22 | import in.zapr.druid.druidry.dimension.enums.FilteredDimensionType;
23 | import lombok.Builder;
24 | import lombok.EqualsAndHashCode;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | @EqualsAndHashCode(callSuper = true)
31 | public class RegexFilteredDimension extends FilteredDimension {
32 | private String pattern;
33 |
34 | @Builder
35 | public RegexFilteredDimension(@NonNull DimensionSpec dimensionSpec, @NonNull String pattern) {
36 | this.pattern = pattern;
37 | this.delegate = dimensionSpec;
38 | this.type = FilteredDimensionType.REGEX_FILTERED;
39 | }
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/SimpleDimension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension;
18 |
19 | import com.fasterxml.jackson.annotation.JsonValue;
20 |
21 | import lombok.EqualsAndHashCode;
22 |
23 | @EqualsAndHashCode(callSuper = true)
24 | public class SimpleDimension extends DruidDimension {
25 |
26 | private String dimension;
27 |
28 | public SimpleDimension(String dimension) {
29 | this.dimension = dimension;
30 | }
31 |
32 | @JsonValue
33 | public String getDimension() {
34 | return this.dimension;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/enums/FilteredDimensionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension.enums;
18 |
19 | import com.fasterxml.jackson.annotation.JsonProperty;
20 |
21 | public enum FilteredDimensionType {
22 |
23 | @JsonProperty(value = "listFiltered")
24 | LIST_FILTERED,
25 | @JsonProperty(value = "regexFiltered")
26 | REGEX_FILTERED,
27 | @JsonProperty(value = "prefixFiltered")
28 | PREFIX_FILTERED
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/dimension/enums/OutputType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.dimension.enums;
18 |
19 | import com.fasterxml.jackson.annotation.JsonValue;
20 |
21 | public enum OutputType {
22 | STRING, LONG, FLOAT, DOUBLE;
23 |
24 | @JsonValue
25 | public String getName() {
26 | return this.name();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/aggregator/TargetHllType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonValue;
20 |
21 | public enum TargetHllType {
22 |
23 | HLL_4("HLL_4"),
24 | HLL_6("HLL_6"),
25 | HLL_8("HLL_8");
26 |
27 | private String value;
28 |
29 | TargetHllType(String value) {
30 | this.value = value;
31 | }
32 |
33 | @JsonValue
34 | public String getValue() {
35 | return value;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/HllSketchEstimateWithBoundsPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class HllSketchEstimateWithBoundsPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String HLL_SKETCH_ESTIMATE_WITH_BOUNDS_POST_AGGREGATOR_TYPE = "HLLSketchEstimateWithBounds";
33 | private DruidPostAggregator field;
34 | private Integer numStdDev;
35 |
36 | @Builder
37 | private HllSketchEstimateWithBoundsPostAggregator(@NonNull String name,
38 | @NonNull DruidPostAggregator field,
39 | Integer numStdDev) {
40 | this.type = HLL_SKETCH_ESTIMATE_WITH_BOUNDS_POST_AGGREGATOR_TYPE;
41 | this.name = name;
42 | this.field = field;
43 | this.numStdDev = numStdDev;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/HllSketchToStringPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class HllSketchToStringPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String HLL_SKETCH_TO_STRING_POST_AGGREGATOR_TYPE = "HLLSketchToString";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private HllSketchToStringPostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = HLL_SKETCH_TO_STRING_POST_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/QuantilesSketchToQuantilePostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class QuantilesSketchToQuantilePostAggregator extends DruidPostAggregator {
31 |
32 | private static final String QUANTILES_SKETCH_TO_QUANTILE_POST_AGGREGATOR_TYPE = "quantilesDoublesSketchToQuantile";
33 | private DruidPostAggregator field;
34 | private Double fraction;
35 |
36 | @Builder
37 | private QuantilesSketchToQuantilePostAggregator(@NonNull String name,
38 | @NonNull DruidPostAggregator field,
39 | @NonNull Double fraction) {
40 | this.type = QUANTILES_SKETCH_TO_QUANTILE_POST_AGGREGATOR_TYPE;
41 | this.name = name;
42 | this.field = field;
43 | this.fraction = fraction;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/QuantilesSketchToStringPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class QuantilesSketchToStringPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String QUANTILES_SKETCH_TO_STRING_POST_AGGREGATOR_TYPE = "quantilesDoublesSketchToString";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private QuantilesSketchToStringPostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = QUANTILES_SKETCH_TO_STRING_POST_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/ThetaSketchFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonValue;
20 |
21 | public enum ThetaSketchFunction {
22 |
23 | INTERSECT("INTERSECT"),
24 | UNION("UNION"),
25 | NOT("NOT");
26 |
27 | private String value;
28 |
29 | ThetaSketchFunction(String value) {
30 | this.value = value;
31 | }
32 |
33 | @JsonValue
34 | public String getValue() {
35 | return value;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchOperation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonValue;
20 |
21 | public enum TupleSketchOperation {
22 |
23 | INTERSECT("INTERSECT"),
24 | UNION("UNION"),
25 | NOT("NOT");
26 |
27 | private String value;
28 |
29 | TupleSketchOperation(String value) {
30 | this.value = value;
31 | }
32 |
33 | @JsonValue
34 | public String getValue() {
35 | return value;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchTTestPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.util.List;
22 |
23 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
24 | import lombok.Builder;
25 | import lombok.EqualsAndHashCode;
26 | import lombok.Getter;
27 | import lombok.NonNull;
28 |
29 | @Getter
30 | @JsonInclude(JsonInclude.Include.NON_NULL)
31 | @EqualsAndHashCode(callSuper = true)
32 | public class TupleSketchTTestPostAggregator extends DruidPostAggregator {
33 |
34 | private static final String TUPLE_SKETCH_TTEST_AGGREGATOR_TYPE = "arrayOfDoublesSketchTTest";
35 | private List fields;
36 |
37 | @Builder
38 | private TupleSketchTTestPostAggregator(@NonNull String name,
39 | @NonNull List fields) {
40 | this.type = TUPLE_SKETCH_TTEST_AGGREGATOR_TYPE;
41 | this.name = name;
42 | this.fields = fields;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchToEstimatePostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class TupleSketchToEstimatePostAggregator extends DruidPostAggregator {
31 |
32 | private static final String TUPLE_SKETCH_TO_ESTIMATE_POST_AGGREGATOR_TYPE = "arrayOfDoublesSketchToEstimate";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private TupleSketchToEstimatePostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = TUPLE_SKETCH_TO_ESTIMATE_POST_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchToMeansPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class TupleSketchToMeansPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String TUPLE_SKETCH_TO_MEANS_POST_AGGREGATOR_TYPE = "arrayOfDoublesSketchToMeans";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private TupleSketchToMeansPostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = TUPLE_SKETCH_TO_MEANS_POST_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchToNumEntriesPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class TupleSketchToNumEntriesPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String TUPLE_SKETCH_TO_NUM_ENTRIES_POST_AGGREGATOR_TYPE = "arrayOfDoublesSketchToNumEntries";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private TupleSketchToNumEntriesPostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = TUPLE_SKETCH_TO_NUM_ENTRIES_POST_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchToStringPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class TupleSketchToStringPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String TUPLE_SKETCH_TO_STRING_AGGREGATOR_TYPE = "arrayOfDoublesSketchToString";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private TupleSketchToStringPostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = TUPLE_SKETCH_TO_STRING_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/datasketches/postAggregator/TupleSketchToVariancesPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.datasketches.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | @EqualsAndHashCode(callSuper = true)
30 | public class TupleSketchToVariancesPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String TUPLE_SKETCH_TO_VARIANCES_POST_AGGREGATOR_TYPE = "arrayOfDoublesSketchToVariances";
33 | private DruidPostAggregator field;
34 |
35 | @Builder
36 | private TupleSketchToVariancesPostAggregator(@NonNull String name,
37 | @NonNull DruidPostAggregator field) {
38 | this.type = TUPLE_SKETCH_TO_VARIANCES_POST_AGGREGATOR_TYPE;
39 | this.name = name;
40 | this.field = field;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/distinctcount/aggregator/DistinctCountAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.distinctcount.aggregator;
18 |
19 | import in.zapr.druid.druidry.aggregator.DruidAggregator;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class DistinctCountAggregator extends DruidAggregator {
27 |
28 | private static final String DISTINCT_COUNT_AGGREGATOR_TYPE = "distinctCount";
29 | private String fieldName;
30 |
31 | public DistinctCountAggregator(@NonNull String name, @NonNull String fieldName) {
32 | this.type = DISTINCT_COUNT_AGGREGATOR_TYPE;
33 | this.name = name;
34 | this.fieldName = fieldName;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/aggregator/QuantilePostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.aggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Builder;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @JsonInclude(JsonInclude.Include.NON_NULL)
28 | public class QuantilePostAggregator extends DruidPostAggregator {
29 |
30 | private static final String QUANTILE_POST_AGGREGATOR_TYPE = "quantile";
31 | private String fieldName;
32 | private Float probability;
33 |
34 | @Builder
35 | private QuantilePostAggregator(@NonNull String name, @NonNull String fieldName,
36 | @NonNull Float probability) {
37 | this.type = QUANTILE_POST_AGGREGATOR_TYPE;
38 | this.name = name;
39 | this.fieldName = fieldName;
40 | this.probability = probability;
41 | }
42 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/postAggregator/CustomBucketsPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.util.Set;
22 |
23 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
24 | import lombok.Builder;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class CustomBucketsPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String CUSTOMBUCKET_POST_AGGREGATOR_TYPE = "customBuckets";
33 | private String fieldName;
34 | private Set breaks;
35 |
36 | @Builder
37 | private CustomBucketsPostAggregator(@NonNull String name, @NonNull String fieldName,
38 | @NonNull Set breaks) {
39 | this.type = CUSTOMBUCKET_POST_AGGREGATOR_TYPE;
40 | this.name = name;
41 | this.fieldName = fieldName;
42 | this.breaks = breaks;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/postAggregator/EqualBucketsPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.postAggregator;
18 |
19 | import com.google.common.base.Preconditions;
20 |
21 | import com.fasterxml.jackson.annotation.JsonInclude;
22 | import com.fasterxml.jackson.annotation.JsonProperty;
23 |
24 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class EqualBucketsPostAggregator extends DruidPostAggregator {
31 | private static final String EQUAL_BUCKET_POST_AGGREGATOR_TYPE = "equalBuckets";
32 | private String fieldName;
33 | @JsonProperty("numBuckets")
34 | private Integer numberOfBuckets;
35 |
36 | public EqualBucketsPostAggregator(@NonNull String name, @NonNull String fieldName,
37 | @NonNull Integer numberOfBuckets) {
38 | Preconditions.checkArgument(numberOfBuckets > 1,
39 | "numberOfBuckets should be greater than 1");
40 |
41 | this.type = EQUAL_BUCKET_POST_AGGREGATOR_TYPE;
42 | this.name = name;
43 | this.fieldName = fieldName;
44 | this.numberOfBuckets = numberOfBuckets;
45 | }
46 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/postAggregator/MaxPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class MaxPostAggregator extends DruidPostAggregator {
28 |
29 | private static final String MAX_POST_AGGREGATOR_TYPE = "max";
30 | private String fieldName;
31 |
32 | public MaxPostAggregator(@NonNull String name, @NonNull String fieldName) {
33 | this.type = MAX_POST_AGGREGATOR_TYPE;
34 | this.name = name;
35 | this.fieldName = fieldName;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/postAggregator/MinPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class MinPostAggregator extends DruidPostAggregator {
28 |
29 | private static final String MIN_POST_AGGREGATOR_TYPE = "min";
30 | private String fieldName;
31 |
32 | public MinPostAggregator(@NonNull String name, @NonNull String fieldName) {
33 | this.type = MIN_POST_AGGREGATOR_TYPE;
34 | this.name = name;
35 | this.fieldName = fieldName;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/postAggregator/QuantilePostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.postAggregator;
18 |
19 | import com.google.common.base.Preconditions;
20 |
21 | import com.fasterxml.jackson.annotation.JsonInclude;
22 |
23 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
24 | import lombok.Builder;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class QuantilePostAggregator extends DruidPostAggregator {
31 |
32 | private static final String QUANTILE_POST_AGGREGATOR_TYPE = "quantile";
33 | private String fieldName;
34 | private Float probability;
35 |
36 | @Builder
37 | private QuantilePostAggregator(@NonNull String name, @NonNull String fieldName,
38 | @NonNull Float probability) {
39 |
40 | Preconditions.checkArgument(probability >= 0f && probability <= 1f,
41 | "Probability should lie between 0 and 1");
42 |
43 | this.type = QUANTILE_POST_AGGREGATOR_TYPE;
44 | this.name = name;
45 | this.fieldName = fieldName;
46 | this.probability = probability;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extensions/histogram/postAggregator/QuantilesPostAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extensions.histogram.postAggregator;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.util.Set;
22 |
23 | import in.zapr.druid.druidry.postAggregator.DruidPostAggregator;
24 | import lombok.Builder;
25 | import lombok.Getter;
26 | import lombok.NonNull;
27 |
28 | @Getter
29 | @JsonInclude(JsonInclude.Include.NON_NULL)
30 | public class QuantilesPostAggregator extends DruidPostAggregator {
31 |
32 | private static final String QUANTILE_POST_AGGREGATOR_TYPE = "quantiles";
33 | private String fieldName;
34 | private Set probabilities;
35 |
36 | @Builder
37 | private QuantilesPostAggregator(@NonNull String name, @NonNull String fieldName,
38 | @NonNull Set probabilities) {
39 | this.type = QUANTILE_POST_AGGREGATOR_TYPE;
40 | this.name = name;
41 | this.fieldName = fieldName;
42 | this.probabilities = probabilities;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/CascadeExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import java.util.List;
20 |
21 | import lombok.Builder;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | public class CascadeExtractionFunction extends ExtractionFunction {
27 |
28 | private List extractionFns;
29 |
30 | @Builder
31 | private CascadeExtractionFunction(@NonNull List extractionFns) {
32 | this.type = ExtractionFunction.CASCADE_TYPE;
33 | this.extractionFns = extractionFns;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/ExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode
25 | public abstract class ExtractionFunction {
26 | protected static final String REGEX_TYPE = "regex";
27 | protected static final String PARTIAL_TYPE = "partial";
28 | protected static final String SEARCH_QUERY_TYPE = "searchQuery";
29 | protected static final String SUB_STRING_TYPE = "substring";
30 | protected static final String STRING_LENGTH_TYPE = "strlen";
31 | protected static final String TIME_FORMAT_TYPE = "timeFormat";
32 | protected static final String TIME_PARSING_TYPE = "time";
33 | protected static final String JAVASCRIPT_TYPE = "javascript";
34 | protected static final String LOOPUP_TYPE = "lookup";
35 |
36 | // todo: bottom 3 are left to code. Also check for timeZone in timeformat type. lookup is also left
37 | protected static final String REGISTERED_LOOKUP_TYPE = "registeredLookup";
38 | protected static final String CASCADE_TYPE = "cascade";
39 | protected static final String STRING_FORMAT_TYPE = "stringFormat";
40 |
41 | @NonNull
42 | protected String type;
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/JavascriptExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class JavascriptExtractionFunction extends ExtractionFunction {
28 |
29 | private String function;
30 | private Boolean injective;
31 |
32 | @Builder
33 | private JavascriptExtractionFunction(@NonNull String function, Boolean injective) {
34 | this.type = JAVASCRIPT_TYPE;
35 | this.function = function;
36 | this.injective = injective;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/LookUpExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.lookUpSpec.LookUpSpec;
22 | import lombok.Builder;
23 | import lombok.Getter;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class LookUpExtractionFunction extends ExtractionFunction {
28 |
29 | private LookUpSpec lookUp;
30 | private Boolean retainMissingValue;
31 | private Boolean injective;
32 | private String replaceMissingValueWith;
33 | private Boolean optimize;
34 |
35 | @Builder
36 | private LookUpExtractionFunction(LookUpSpec lookUp, Boolean retainMissingValue, Boolean injective, String
37 | replaceMissingValueWith, Boolean optimize) {
38 | this.type = ExtractionFunction.LOOPUP_TYPE;
39 | this.lookUp = lookUp;
40 | this.retainMissingValue = retainMissingValue;
41 | this.injective = injective;
42 | this.replaceMissingValueWith = replaceMissingValueWith;
43 | this.optimize = optimize;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/PartialExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import lombok.Builder;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | @EqualsAndHashCode(callSuper = true)
26 | public class PartialExtractionFunction extends ExtractionFunction {
27 |
28 | private String expr;
29 |
30 | @Builder
31 | private PartialExtractionFunction(@NonNull String expr) {
32 | this.type = PARTIAL_TYPE;
33 | this.expr = expr;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/RegexExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class RegexExtractionFunction extends ExtractionFunction {
28 |
29 |
30 | private String expr;
31 | private Boolean replaceMissingValue;
32 | private String replaceMissingValueWith;
33 |
34 | @Builder
35 | private RegexExtractionFunction(@NonNull String expr,
36 | Boolean replaceMissingValue,
37 | String replaceMissingValueWith) {
38 | this.type = REGEX_TYPE;
39 | this.expr = expr;
40 | this.replaceMissingValue = replaceMissingValue;
41 | this.replaceMissingValueWith = replaceMissingValueWith;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/RegisteredLookUpExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import in.zapr.druid.druidry.lookUpSpec.LookUpSpec;
22 | import lombok.Builder;
23 | import lombok.Getter;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class RegisteredLookUpExtractionFunction extends ExtractionFunction {
28 |
29 | private LookUpSpec lookUp;
30 | private Boolean retainMissingValue;
31 | private Boolean injective;
32 | private String replaceMissingValueWith;
33 | private Boolean optimize;
34 |
35 | @Builder
36 | private RegisteredLookUpExtractionFunction(LookUpSpec lookUp, Boolean retainMissingValue, Boolean injective,
37 | String replaceMissingValueWith, Boolean optimize) {
38 | this.type = ExtractionFunction.LOOPUP_TYPE;
39 | this.lookUp = lookUp;
40 | this.retainMissingValue = retainMissingValue;
41 | this.injective = injective;
42 | this.replaceMissingValueWith = replaceMissingValueWith;
43 | this.optimize = optimize;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/SearchQueryExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import in.zapr.druid.druidry.filter.searchQuerySpec.SearchQuerySpec;
20 | import lombok.Builder;
21 | import lombok.Getter;
22 | import lombok.NonNull;
23 |
24 | @Getter
25 | public class SearchQueryExtractionFunction extends ExtractionFunction {
26 |
27 | private SearchQuerySpec query;
28 |
29 | @Builder
30 | private SearchQueryExtractionFunction(@NonNull SearchQuerySpec query) {
31 | this.type = SEARCH_QUERY_TYPE;
32 | this.query = query;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/StrLenExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import lombok.Builder;
20 | import lombok.Getter;
21 |
22 | @Getter
23 | public class StrLenExtractionFunction extends ExtractionFunction {
24 |
25 | @Builder
26 | private StrLenExtractionFunction() {
27 | this.type = ExtractionFunction.STRING_LENGTH_TYPE;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/StringFormatExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import lombok.Getter;
20 |
21 | @Getter
22 | public class StringFormatExtractionFunction extends ExtractionFunction {
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/SubStringExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import lombok.Builder;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @JsonInclude(JsonInclude.Include.NON_NULL)
27 | public class SubStringExtractionFunction extends ExtractionFunction {
28 | private Integer index;
29 | private Integer length;
30 |
31 | @Builder
32 | private SubStringExtractionFunction(@NonNull Integer index, Integer length) {
33 | this.type = SUB_STRING_TYPE;
34 | this.index = index;
35 | this.length = length;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/TimeFormatExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.util.Locale;
22 |
23 | import in.zapr.druid.druidry.granularity.Granularity;
24 | import lombok.Builder;
25 | import lombok.Getter;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class TimeFormatExtractionFunction extends ExtractionFunction {
30 |
31 | private String format;
32 |
33 | private Locale locale;
34 | private Granularity granularity;
35 | private Boolean asMillis;
36 |
37 | // TODO: search for a timezone library
38 | private String timeZone;
39 |
40 | @Builder
41 | private TimeFormatExtractionFunction(String format, Locale locale, Granularity granularity, String
42 | timeZone, Boolean asMillis) {
43 | this.type = TIME_FORMAT_TYPE;
44 | this.format = format;
45 | this.locale = locale;
46 | this.granularity = granularity;
47 | this.timeZone = timeZone;
48 | this.asMillis = asMillis;
49 |
50 | }
51 |
52 | public String getLocale() {
53 | return locale == null ? null : locale.toLanguageTag();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/extractionFunctions/TimeParsingExtractionFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.extractionFunctions;
18 |
19 | import com.fasterxml.jackson.annotation.JsonInclude;
20 |
21 | import java.text.SimpleDateFormat;
22 |
23 | import lombok.Builder;
24 | import lombok.Getter;
25 | import lombok.NonNull;
26 |
27 | @Getter
28 | @JsonInclude(JsonInclude.Include.NON_NULL)
29 | public class TimeParsingExtractionFunction extends ExtractionFunction {
30 |
31 | private SimpleDateFormat timeFormat;
32 | private SimpleDateFormat resultFormat;
33 |
34 | @Builder
35 | private TimeParsingExtractionFunction(@NonNull SimpleDateFormat timeFormat, @NonNull SimpleDateFormat
36 | resultFormat) {
37 | this.type = TIME_PARSING_TYPE;
38 | this.timeFormat = timeFormat;
39 | this.resultFormat = resultFormat;
40 | }
41 |
42 | public String getTimeFormat() {
43 | return timeFormat.toPattern();
44 | }
45 |
46 | public String getResultFormat() {
47 | return resultFormat.toPattern();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/AndFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import java.util.List;
20 |
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @EqualsAndHashCode(callSuper = true)
27 | public class AndFilter extends DruidFilter {
28 |
29 | private static String AND_DRUID_FILTER_TYPE = "and";
30 | private List fields;
31 |
32 | public AndFilter(@NonNull List fields) {
33 | this.type = AND_DRUID_FILTER_TYPE;
34 | this.fields = fields;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/DruidFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 |
22 | @Getter
23 | @EqualsAndHashCode
24 | public abstract class DruidFilter {
25 | protected String type;
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/InFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import java.util.List;
20 |
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @EqualsAndHashCode(callSuper = true)
27 | public class InFilter extends DruidFilter {
28 | private static String IN_DRUID_FILTER_TYPE = "in";
29 |
30 | private String dimension;
31 | private List values;
32 |
33 | public InFilter(@NonNull String dimension, @NonNull List values) {
34 | this.type = IN_DRUID_FILTER_TYPE;
35 | this.dimension = dimension;
36 | this.values = values;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/IntervalFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import java.util.List;
20 |
21 | import in.zapr.druid.druidry.query.config.Interval;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NonNull;
25 |
26 | @Getter
27 | @EqualsAndHashCode(callSuper = true)
28 | public class IntervalFilter extends DruidFilter {
29 |
30 | private static String INTERVAL_DRUID_FILTER_TYPE = "interval";
31 |
32 | private String type;
33 | private String dimension;
34 | private List intervals;
35 |
36 | public IntervalFilter(@NonNull String dimension, @NonNull List intervals) {
37 | this.type = INTERVAL_DRUID_FILTER_TYPE;
38 | this.dimension = dimension;
39 | this.intervals = intervals;
40 | }
41 |
42 | // TODO: support for Extraction Function
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/JavaScriptFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode(callSuper = true)
25 | public class JavaScriptFilter extends DruidFilter {
26 |
27 | private static String JS_DRUID_FILTER_TYPE = "javascript";
28 |
29 | private String dimension;
30 | private String function;
31 |
32 | public JavaScriptFilter(@NonNull String dimension, @NonNull String function) {
33 | this.type = JS_DRUID_FILTER_TYPE;
34 |
35 | this.dimension = dimension;
36 | this.function = function;
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/NotFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode(callSuper = true)
25 | public class NotFilter extends DruidFilter {
26 |
27 | private static String NOT_DRUID_FILTER_TYPE = "not";
28 |
29 | private DruidFilter field;
30 |
31 | public NotFilter(@NonNull DruidFilter field) {
32 | this.type = NOT_DRUID_FILTER_TYPE;
33 | this.field = field;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/OrFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import java.util.List;
20 |
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @EqualsAndHashCode(callSuper = true)
27 | public class OrFilter extends DruidFilter {
28 |
29 | private static String OR_DRUID_FILTER_TYPE = "or";
30 | private List fields;
31 |
32 | public OrFilter(@NonNull List fields) {
33 | this.type = OR_DRUID_FILTER_TYPE;
34 | this.fields = fields;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/RegexFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import lombok.EqualsAndHashCode;
20 | import lombok.Getter;
21 | import lombok.NonNull;
22 |
23 | @Getter
24 | @EqualsAndHashCode(callSuper = true)
25 | public class RegexFilter extends DruidFilter {
26 |
27 | private static String REGEX_DRUID_FILTER_TYPE = "regex";
28 |
29 | private String dimension;
30 | private String pattern;
31 |
32 | public RegexFilter(@NonNull String dimension, @NonNull String pattern) {
33 | this.type = REGEX_DRUID_FILTER_TYPE;
34 | this.dimension = dimension;
35 | this.pattern = pattern;
36 | }
37 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/SearchFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import in.zapr.druid.druidry.filter.searchQuerySpec.SearchQuerySpec;
20 | import lombok.Builder;
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @EqualsAndHashCode(callSuper = true)
27 | public class SearchFilter extends DruidFilter {
28 |
29 | private static String SEARCH_DRUID_FILTER_TYPE = "search";
30 | private String dimension;
31 | private SearchQuerySpec query;
32 |
33 | @Builder
34 | private SearchFilter(@NonNull String dimension, @NonNull SearchQuerySpec searchQuerySpec) {
35 |
36 | this.type = SEARCH_DRUID_FILTER_TYPE;
37 | this.dimension = dimension;
38 | this.query = searchQuerySpec;
39 | }
40 |
41 | // TODO: Extraction Function
42 | }
--------------------------------------------------------------------------------
/src/main/java/in/zapr/druid/druidry/filter/SelectorFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018-present Red Brick Lane Marketing Solutions Pvt. Ltd.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package in.zapr.druid.druidry.filter;
18 |
19 | import java.util.Optional;
20 |
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NonNull;
24 |
25 | @Getter
26 | @EqualsAndHashCode(callSuper = true)
27 | public class SelectorFilter extends DruidFilter {
28 |
29 | private static String SELECTOR_DRUID_FILTER_TYPE = "selector";
30 |
31 | private String dimension;
32 | private Object value;
33 |
34 | private SelectorFilter(@NonNull String dimension) {
35 | this.type = SELECTOR_DRUID_FILTER_TYPE;
36 | this.dimension = dimension;
37 | }
38 |
39 | public SelectorFilter(@NonNull String dimension, String value) {
40 | this(dimension);
41 | this.value = value;
42 | }
43 |
44 | public SelectorFilter(@NonNull String dimension, Integer value) {
45 | this(dimension);
46 | this.value = value;
47 | }
48 |
49 | public SelectorFilter(@NonNull String dimension, Long value) {
50 | this(dimension);
51 | this.value = value;
52 | }
53 |
54 | public SelectorFilter(@NonNull String dimension, Optional