Fixes #1159 - deltas are now generated on first update for 0-sided contexts #1164
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.
Bugfix
#1159 reported an issue where row deltas were empty in tables after their first update from schema. This was due to the
notify
calls for first and subsequent updates being on different code paths (with different invocations ofnotify
), and the line that added the primary key to be tracked as a changed row was missing. This PR fixes the issue, and adds a litany of tests in Javascript and Python.Additionally, this PR fixes a previously overlooked issue - though we enable delta calculation based on whether they are used in on_update or not, 0-sided contexts would always calculate step and row deltas regardless of whether they were enabled or not. This seemed to be a default -
get_deltas_enabled
would always returntrue
, andset_deltas_enabled
would be a no-op for zero sided contexts.Because there is no public API to get a delta without going through
on_update
and enabling deltas, and considering that row deltas are used far more widely than cell deltas (and cell deltas aren't even implemented in Python), it seems to make sense for 0-sided contexts to have the same behavior as 1/2 sided contexts, which respectget_deltas_enabled
.A next step might be differentiating cell/row delta enablement inside the context, which means that a callback that requests a row delta would not also enable cell delta calculation. This would be an internal API, as the cell/row delta methods are, and might bring some performance improvements.
This PR also adds benchmarking for deltas across different contexts, which means we can use it to test out actual performance over different versions.
Testing
Tests added for JS and Python, for multiple context types, computed columns, indexed, etc.
Screenshots (if appropriate)
Checklist
CONTRIBUTING.md
and followed its Guidelines