Class: Druid::Query
- Inherits:
-
Object
- Object
- Druid::Query
- Includes:
- ActiveModel::Model
- Defined in:
- lib/druid/query.rb
Defined Under Namespace
Classes: AggregationsValidator, Builder, DimensionsValidator, FilterValidator, GranularityValidator, IntervalsValidator, PostaggregationsValidator
Instance Attribute Summary collapse
-
#aggregations ⇒ Object
Returns the value of attribute aggregations.
-
#bound ⇒ Object
timeBoundary.
-
#context ⇒ Object
Returns the value of attribute context.
-
#dataSource ⇒ Object
Returns the value of attribute dataSource.
-
#dimension ⇒ Object
topN.
-
#dimensions ⇒ Object
Returns the value of attribute dimensions.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#granularity ⇒ Object
Returns the value of attribute granularity.
-
#having ⇒ Object
groupBy.
-
#intervals ⇒ Object
Returns the value of attribute intervals.
-
#limit ⇒ Object
search.
-
#limitSpec ⇒ Object
groupBy.
-
#merge ⇒ Object
segementMetadata.
-
#metric ⇒ Object
topN.
-
#metrics ⇒ Object
select.
-
#pagingSpec ⇒ Object
select.
-
#postAggregations ⇒ Object
Returns the value of attribute postAggregations.
-
#query ⇒ Object
search.
-
#queryType ⇒ Object
Returns the value of attribute queryType.
-
#searchDimensions ⇒ Object
search.
-
#sort ⇒ Object
search.
-
#threshold ⇒ Object
topN.
-
#toInclude ⇒ Object
segementMetadata.
Instance Method Summary collapse
- #aggregation_names ⇒ Object
- #aggregation_types ⇒ Object
- #as_json(options = {}) ⇒ Object
- #contains_aggregation?(metric) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Query
constructor
A new instance of Query.
Constructor Details
Instance Attribute Details
#aggregations ⇒ Object
Returns the value of attribute aggregations.
139 140 141 |
# File 'lib/druid/query.rb', line 139 def aggregations @aggregations end |
#bound ⇒ Object
timeBoundary
255 256 257 |
# File 'lib/druid/query.rb', line 255 def bound @bound end |
#context ⇒ Object
Returns the value of attribute context.
278 279 280 |
# File 'lib/druid/query.rb', line 278 def context @context end |
#dataSource ⇒ Object
Returns the value of attribute dataSource.
22 23 24 |
# File 'lib/druid/query.rb', line 22 def dataSource @dataSource end |
#dimension ⇒ Object
topN
270 271 272 |
# File 'lib/druid/query.rb', line 270 def dimension @dimension end |
#dimensions ⇒ Object
Returns the value of attribute dimensions.
100 101 102 |
# File 'lib/druid/query.rb', line 100 def dimensions @dimensions end |
#filter ⇒ Object
Returns the value of attribute filter.
217 218 219 |
# File 'lib/druid/query.rb', line 217 def filter @filter end |
#granularity ⇒ Object
Returns the value of attribute granularity.
67 68 69 |
# File 'lib/druid/query.rb', line 67 def granularity @granularity end |
#having ⇒ Object
groupBy
229 230 231 |
# File 'lib/druid/query.rb', line 229 def having @having end |
#intervals ⇒ Object
Returns the value of attribute intervals.
43 44 45 |
# File 'lib/druid/query.rb', line 43 def intervals @intervals end |
#limit ⇒ Object
search
243 244 245 |
# File 'lib/druid/query.rb', line 243 def limit @limit end |
#limitSpec ⇒ Object
groupBy
240 241 242 |
# File 'lib/druid/query.rb', line 240 def limitSpec @limitSpec end |
#merge ⇒ Object
segementMetadata
261 262 263 |
# File 'lib/druid/query.rb', line 261 def merge @merge end |
#metric ⇒ Object
topN
273 274 275 |
# File 'lib/druid/query.rb', line 273 def metric @metric end |
#metrics ⇒ Object
select
264 265 266 |
# File 'lib/druid/query.rb', line 264 def metrics @metrics end |
#pagingSpec ⇒ Object
select
267 268 269 |
# File 'lib/druid/query.rb', line 267 def pagingSpec @pagingSpec end |
#postAggregations ⇒ Object
Returns the value of attribute postAggregations.
186 187 188 |
# File 'lib/druid/query.rb', line 186 def postAggregations @postAggregations end |
#query ⇒ Object
search
249 250 251 |
# File 'lib/druid/query.rb', line 249 def query @query end |
#queryType ⇒ Object
Returns the value of attribute queryType.
19 20 21 |
# File 'lib/druid/query.rb', line 19 def queryType @queryType end |
#searchDimensions ⇒ Object
search
246 247 248 |
# File 'lib/druid/query.rb', line 246 def searchDimensions @searchDimensions end |
#sort ⇒ Object
search
252 253 254 |
# File 'lib/druid/query.rb', line 252 def sort @sort end |
#threshold ⇒ Object
topN
276 277 278 |
# File 'lib/druid/query.rb', line 276 def threshold @threshold end |
#toInclude ⇒ Object
segementMetadata
258 259 260 |
# File 'lib/druid/query.rb', line 258 def toInclude @toInclude end |
Instance Method Details
#aggregation_names ⇒ Object
164 165 166 167 168 |
# File 'lib/druid/query.rb', line 164 def aggregation_names Set.new(@aggregations.map do |aggregation| [aggregation.fieldName] + [aggregation.fieldNames] end.flatten.compact) end |
#aggregation_types ⇒ Object
158 159 160 161 162 |
# File 'lib/druid/query.rb', line 158 def aggregation_types Set.new(@aggregations.map do |aggregation| aggregation.type end.flatten.compact) end |
#as_json(options = {}) ⇒ Object
293 294 295 |
# File 'lib/druid/query.rb', line 293 def as_json( = {}) super(.merge(except: %w(errors validation_context))) end |
#contains_aggregation?(metric) ⇒ Boolean
297 298 299 |
# File 'lib/druid/query.rb', line 297 def contains_aggregation?(metric) aggregations.any? { |a| a.name.to_s == metric.to_s } end |