Class: Druid::Query
- Inherits:
-
Object
- Object
- Druid::Query
- Defined in:
- lib/druid/query.rb
Instance Attribute Summary collapse
-
#aggregations ⇒ Object
readonly
Returns the value of attribute aggregations.
-
#broker ⇒ Object
readonly
Returns the value of attribute broker.
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#end_interval ⇒ Object
readonly
Returns the value of attribute end_interval.
-
#fill_value ⇒ Object
readonly
Returns the value of attribute fill_value.
-
#granularity ⇒ Object
readonly
Returns the value of attribute granularity.
-
#query_opts ⇒ Object
readonly
Returns the value of attribute query_opts.
-
#query_type ⇒ Object
readonly
Returns the value of attribute query_type.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#result_key ⇒ Object
readonly
Returns the value of attribute result_key.
-
#start_interval ⇒ Object
readonly
Returns the value of attribute start_interval.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(opts) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(opts) ⇒ Query
Returns a new instance of Query.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/druid/query.rb', line 15 def initialize(opts) @aggregations = opts[:aggregations].map{|agg| agg[:name]} @broker = opts[:broker] @dimensions = opts[:dimensions] @fill_value = opts[:fill_value] @granularity = opts[:granularity] @range = parse_range(opts[:intervals]) @query_type = opts[:queryType] @end_interval = calculate_end_interval @start_interval = calculate_start_interval @query_opts = opts_for_query(opts) end |
Instance Attribute Details
#aggregations ⇒ Object (readonly)
Returns the value of attribute aggregations.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def aggregations @aggregations end |
#broker ⇒ Object (readonly)
Returns the value of attribute broker.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def broker @broker end |
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def dimensions @dimensions end |
#end_interval ⇒ Object (readonly)
Returns the value of attribute end_interval.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def end_interval @end_interval end |
#fill_value ⇒ Object (readonly)
Returns the value of attribute fill_value.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def fill_value @fill_value end |
#granularity ⇒ Object (readonly)
Returns the value of attribute granularity.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def granularity @granularity end |
#query_opts ⇒ Object (readonly)
Returns the value of attribute query_opts.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def query_opts @query_opts end |
#query_type ⇒ Object (readonly)
Returns the value of attribute query_type.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def query_type @query_type end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def range @range end |
#result_key ⇒ Object (readonly)
Returns the value of attribute result_key.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def result_key @result_key end |
#start_interval ⇒ Object (readonly)
Returns the value of attribute start_interval.
3 4 5 |
# File 'lib/druid/query.rb', line 3 def start_interval @start_interval end |
Class Method Details
.create(opts) ⇒ Object
177 178 179 |
# File 'lib/druid/query.rb', line 177 def create(opts) new(opts).execute end |
Instance Method Details
#execute ⇒ Object
28 29 30 31 |
# File 'lib/druid/query.rb', line 28 def execute result = broker.query(query_opts) fill_query_results(result) end |