diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a5a35..c9b001e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +v1.3.2, 2025-08-06 +------------------- + * [BUGFIX] More Evaluator fixes + * [BUGFIX] fixed the build. + v1.3.1, 2025-08-06 ------------------- * [BUGFIX] Evaluator fix for Not expressions diff --git a/VERSION b/VERSION index 3a3cd8c..1892b92 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.1 +1.3.2 diff --git a/lib/sparkql/evaluator.rb b/lib/sparkql/evaluator.rb index 08a2b0f..18ee192 100644 --- a/lib/sparkql/evaluator.rb +++ b/lib/sparkql/evaluator.rb @@ -60,20 +60,22 @@ def build_structures(levels, block_groups, expressions) # with a level -1 here to turn the top level expressions into a block # group for processing. current_level = level + last_block_group = block_group while current_level >= 0 current_level -= 1 levels[current_level] ||= [] last_block_group_id = levels[current_level].last if last_block_group_id - block_groups[last_block_group_id][:expressions] << block_group + block_groups[last_block_group_id][:expressions] << last_block_group break else block_id = "placeholder_for_#{block}_#{current_level}" - placeholder_block = block_builder(block_group, current_level) - placeholder_block[:expressions] << block_group + placeholder_block = block_builder(last_block_group, current_level) + placeholder_block[:expressions] << last_block_group levels[current_level] << block_id block_groups[block_id] = placeholder_block + last_block_group = placeholder_block end end end diff --git a/test/unit/evaluator_test.rb b/test/unit/evaluator_test.rb index e02d6d8..4fd9e36 100644 --- a/test/unit/evaluator_test.rb +++ b/test/unit/evaluator_test.rb @@ -81,6 +81,10 @@ def test_nesting assert !sample("Test Eq true And ((Test Eq true And Test Eq false) Or Test Eq false) And Test Eq true") assert !sample("Test Eq true And ((Test Eq true And Test Eq false) Or Test Eq false) Or Test Eq false") assert sample("Test Eq true And ((Test Eq true And Test Eq false) Or Test Eq false) Or Test Eq true") + assert !sample("(Test Eq true Or Test Eq true) And Test Eq false") + assert !sample("(Test Eq true Or Test Eq true) And (Test Eq false)") + assert sample("(Test Eq true Or Test Eq true) And (Test Eq false Or Test Eq true)") + assert !sample("(Test Eq true Or Test Eq true) And (Test Eq false Or Test Eq false)") end def test_nots