Add CalculationSink for Aggregate-Level Mathematical Operations#4763
Open
abdelaziz-mahdy wants to merge 5 commits intodevelopmentfrom
Open
Add CalculationSink for Aggregate-Level Mathematical Operations#4763abdelaziz-mahdy wants to merge 5 commits intodevelopmentfrom
abdelaziz-mahdy wants to merge 5 commits intodevelopmentfrom
Conversation
…atical operations
… for better precedence management
…r clarity and consistency
… tests Fix several issues in CalculationSink for aggregate-level math operations: - Propagate eof() to child sinks before evaluation to ensure final values - Fix toString() to show correct operators matching evaluation semantics - Handle Property axioms in row-level mode via f() function check - Fix Java reduce() to verify operand is Reducible before casting - Support nested CalculationSink in getSinkValue_() - Add Java toString() implementation for consistency - Remove redundant default values for Boolean and Double properties Add comprehensive test suites covering addition, subtraction, operator precedence, division, row-level vs total-level modes, FilteredSink and GroupBy integration, nested sinks, reset, and edge cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopening due to need.
Problem
There was no way to perform mathematical operations on the results of aggregated sinks. Existing tools have gaps:
Use Case That Couldn't Be Solved:
Solution
Added
CalculationSink- a sink that performs arithmetic operations on values from other sinks with proper operator precedence.Key Features:
FilteredSink(isIncome, SUM) - FilteredSink(isExpense, SUM)*and/before+and-Example:
Data Flow:
Changes
CalculationSinkclass with support for ADD, SUBTRACT, MULTIPLY, DIVIDE operationsCalculationOperationclass to pair operands with operationsArithmeticOperationenum for supported operationsCalculationDAOAgentfor reflow UI integrationeof()now propagates to child sinks before evaluationtoString()properly uses enum labelsreduce()checks if operand is Reducible before castinggetSinkValue_()handles nested CalculationSinkWhy Not Just Use FScript?
FScript is powerful for per-row expressions but operates before aggregation:
FScript cannot:
SUM(amount)results (doesn't exist until after all rows)SUM(income) - SUM(expenses)(needs aggregate values)CalculationSink fills this gap by operating on sink outputs rather than row inputs.