Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1
1.3.2
8 changes: 5 additions & 3 deletions lib/sparkql/evaluator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/unit/evaluator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down