Skip to content

Commit 41dcefc

Browse files
author
Y-Wakuta
authored
Merge pull request #58 from Y-Wakuta/feature/#56
Feature/#56
2 parents a2c909b + 577576c commit 41dcefc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+4349
-2300
lines changed

lib/nose.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module NoSE
1111
require_relative 'nose/debug'
1212
require_relative 'nose/enumerator'
1313
require_relative 'nose/pruned_enumerator'
14+
require_relative 'nose/simple_enumerator'
15+
require_relative 'nose/migrator'
1416
require_relative 'nose/indexes'
1517
require_relative 'nose/loader'
1618
require_relative 'nose/model'
@@ -23,6 +25,7 @@ module NoSE
2325
require_relative 'nose/schema'
2426
require_relative 'nose/search'
2527
require_relative 'nose/iterative_search'
28+
require_relative 'nose/cached_search'
2629
require_relative 'nose/statements'
2730
require_relative 'nose/timing'
2831
require_relative 'nose/workload'

lib/nose/backend.rb

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def result_conditions(conditions, results)
189189
end
190190

191191
# Decide which fields should be selected
192-
def expand_selected_fields(select)
192+
def expand_selected_fields(select, later_indexlookup_steps)
193193
# We just pick whatever is contained in the index that is either
194194
# mentioned in the query or required for the next lookup
195195
# TODO: Potentially try query.all_fields for those not required
@@ -198,6 +198,14 @@ def expand_selected_fields(select)
198198
select += @next_step.index.hash_fields \
199199
unless @next_step.nil? ||
200200
!@next_step.is_a?(Plans::IndexLookupPlanStep)
201+
202+
if !@next_step.is_a?(Plans::IndexLookupPlanStep) \
203+
and !later_indexlookup_steps.nil?
204+
later_indexlookup_steps.each do |later_indexlookup_step|
205+
select += later_indexlookup_step.index.hash_fields
206+
end
207+
end
208+
201209
select &= @step.index.all_fields
202210

203211
select
@@ -254,8 +262,18 @@ def include_row?(row, eq_conditions, range)
254262
end
255263

256264
if range
257-
range_check = row[range.field.id].method(range.operator)
258-
select &&= range_check.call range.value
265+
if row[range.field.id].nil?
266+
# if range condition field is null, remove the row from the result
267+
select = false
268+
else
269+
range_check = row[range.field.id].method(range.operator)
270+
begin
271+
select &&= range_check.call range.value
272+
rescue Exception => e
273+
puts e
274+
throw e
275+
end
276+
end
259277
end
260278

261279
select
@@ -365,8 +383,16 @@ def prepare_query_steps(steps, fields, conditions)
365383
subclass_step_name = step_class.name.sub \
366384
'NoSE::Backend::Backend', self.class.name
367385
step_class = Object.const_get subclass_step_name
368-
step_class.new client, fields, conditions,
369-
step, next_step, prev_step
386+
if step_class == NoSE::Backend::CassandraBackend::IndexLookupStatementStep \
387+
and steps.index(next_step) + 2 < steps.size
388+
#and steps[steps.index(next_step) + 1].is_a?(NoSE::Backend::CassandraBackend::IndexLookupStatementStep)
389+
later_indexlookup_steps = steps[(steps.index(next_step) + 1)..-1].select{|s| s.is_a? Plans::IndexLookupPlanStep}
390+
step_class.new client, fields, conditions,
391+
step, next_step, prev_step, later_indexlookup_steps
392+
else
393+
step_class.new client, fields, conditions,
394+
step, next_step, prev_step
395+
end
370396
end
371397
end
372398

0 commit comments

Comments
 (0)