-
Notifications
You must be signed in to change notification settings - Fork 71
[FIX] Pivots: Recompute measure on indirect dependency update #7610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
1851586 to
8bb1d5b
Compare
hokolomopo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a rebase to remove the first two commits 🙂
Maybe a dumb idea, but instead of bothering computing all the exact dependencies for each measure, couldn't we just have the getter getMeasureFullDependencies always return all of the dependencies of all of the measures of the pivot ? It would simplify the code a lot, and I'm not sure it would really impact the performances in practice.
| rangeList.push( | ||
| ...this.computeMeasureFullDependencies(pivotId, existingMeasure, exploredMeasures) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will create an infinite loop if we have cyclic dependencies in measures no ?
src/plugins/core/pivot.ts
Outdated
| ) | ||
| continue; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: brackets
src/plugins/core/pivot.ts
Outdated
| // this.history.update("compiledMeasureFormulas", sheetId, formulaString, undefined); | ||
| // this.history.update( | ||
| // "compiledMeasureFormulas", | ||
| // sheetId, | ||
| // newFormulaString, | ||
| // this.compileMeasureFormula(sheetId, newFormulaString) | ||
| // ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
|
|
||
| interface MeasureState { | ||
| formula: RangeCompiledFormula; | ||
| fullDependencies: Range[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove the "full" in the name of this/the getter
| for (const measure of measures) { | ||
| if (measure.computedBy) { | ||
| const dependencies = this.computeMeasureFullDependencies(pivotId, measure); | ||
| this.history.update( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably be done in the same loop as the complied formula, if computeMeasureFullDependencies returned the whole MeasureState object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if measure1 refers to measure2 and the formula of measure2 was not already compiled, you'll have a problem ^^
regarding the generic remark "always return all of the dependencies of all of the measures of the pivot " this would only have an impact on split pivot formulas which would end up having the dependencies of every measure, even those that have 0 relation to it. I don't know if it's a deal breaker
b68a741 to
e6ca467
Compare
|
@hokolomopo I have implemented your suggestion, we now store a single array of range dependecies for every pivot. it will trigger the unwanted recomputation of static pivot formulas but should not be too troublesome |
src/plugins/core/pivot.ts
Outdated
| formulaIds: Record<UID, string | undefined>; | ||
| compiledMeasureFormulas: Record<UID, Record<string, RangeCompiledFormula | undefined>>; | ||
| compiledMeasureFormulas: Record<UID, Record<string, RangeCompiledFormula>>; | ||
| pivotMeasureDependencies: Record<UID, Range[]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking to make it shorter, we know we are in the context of pivots
| pivotMeasureDependencies: Record<UID, Range[]>; | |
| measureDependencies: Record<UID, Range[]>; |
src/plugins/core/pivot.ts
Outdated
| for (const measure of measures) { | ||
| if (measure.computedBy) { | ||
| const compiledFormula = this.getMeasureCompiledFormula(pivotId, measure); | ||
| ranges.push(...compiledFormula.dependencies); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be mixed in the for loop just above
| if (measure.computedBy) { | ||
| const formula = evalContext.getters.getMeasureCompiledFormula(measure); | ||
| dependencies.push(...formula.dependencies.filter((range) => !range.invalidXc)); | ||
| dependencies.push(...evalContext.getters.getMeasureFullDependencies(pivotId, measure)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the new approach where we get all dependencies, this adds the same dependencies multiple times.
Allow to upload json files to ease development/bug investigation closes #7591 Task: 0 Signed-off-by: Rémi Rahir (rar) <[email protected]>
f7a3cfc to
e8f6a26
Compare
49e8d82 to
b70d71d
Compare

Description:
description of this task, what is implemented and why it is implemented that way.
Task: 5349782
review checklist