Type:
Technical task
Priority:
Major
Resolution:
Fixed
Affects Version/s:
None
Sprint:
10.2.0-5, 10.2.0-6, 10.2.0-7, 10.2.0-8, 10.2.2-1, 10.2.2-2, 10.2.2-3, 10.2.2-4
The sliding window defined by RANGE BETWEEN N FOLLOWING and N PRECEDING does not add/remove rows in the correct order.
Example:
insert into t1 values
( 1 , 0, 1),
( 2 , 0, 2),
( 3 , 1, 4),
( 4 , 1, 8),
( 5 , 2, 32),
( 6 , 2, 64),
( 7 , 2, 128),
( 8 , 2, 16);
select pk, a, b,
bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as bit_or
from t1;
pk a b bit_or
1 0 1 3
2 0 2 3
3 1 4 12
4 1 8 12
5 2 32 96
6 2 64 224
7 2 128 176
8 2 16 48
The issue lies within the last partition. The removal of elements from the window is wrong. It removes an element 1 row after the one that should be removed.
.....
5 2 32 96 // OK (32 | 64) = 96
6 2 64 224 // OK (32 | 64 | 128) = 224
7 2 128 176 // NOT OK. Should be (64 | 128 | 16) = 208. Instead it is: (32 | 128 | 16).
8 2 16 48 // Again NOT OK. Should be (128 | 16) = 144. Instead it is: (32 | 16)
.....
The problem lies in the fact that the removal of elements from the sliding window is done incorectly.
from [32, 64, 128] , we should add the row containing 16 and remove the row containing 32. Instead, when calling the remove() function for the window function, the current item points to row with the value of 64. Thus we remove 64 and get [32, 128, 16] .
Again the same problem continues for the next row. Instead of removing the value 64, we are removing the value 128 (the row after the correct value).
{"report":{"fcp":895.5,"ttfb":184.7000002861023,"pageVisibility":"visible","entityId":56098,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"e7c5b67e-7eb5-4b52-aaa4-6861bb085f82","navigationType":0,"readyForUser":979,"redirectCount":0,"resourceLoadedEnd":808.9000000953674,"resourceLoadedStart":190.60000038146973,"resourceTiming":[{"duration":140,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":190.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":190.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":330.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":140.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":190.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":190.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":331,"responseStart":0,"secureConnectionStart":0},{"duration":151.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":191.10000038146973,"connectEnd":191.10000038146973,"connectStart":191.10000038146973,"domainLookupEnd":191.10000038146973,"domainLookupStart":191.10000038146973,"fetchStart":191.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":191.10000038146973,"responseEnd":342.90000009536743,"responseStart":342.90000009536743,"secureConnectionStart":191.10000038146973},{"duration":252.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":191.2000002861023,"connectEnd":191.2000002861023,"connectStart":191.2000002861023,"domainLookupEnd":191.2000002861023,"domainLookupStart":191.2000002861023,"fetchStart":191.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":191.2000002861023,"responseEnd":444.1000003814697,"responseStart":444.1000003814697,"secureConnectionStart":191.2000002861023},{"duration":256.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":191.40000009536743,"connectEnd":191.40000009536743,"connectStart":191.40000009536743,"domainLookupEnd":191.40000009536743,"domainLookupStart":191.40000009536743,"fetchStart":191.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":191.40000009536743,"responseEnd":448.30000019073486,"responseStart":448.30000019073486,"secureConnectionStart":191.40000009536743},{"duration":257.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":191.60000038146973,"connectEnd":191.60000038146973,"connectStart":191.60000038146973,"domainLookupEnd":191.60000038146973,"domainLookupStart":191.60000038146973,"fetchStart":191.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":191.60000038146973,"responseEnd":448.80000019073486,"responseStart":448.80000019073486,"secureConnectionStart":191.60000038146973},{"duration":257.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":191.80000019073486,"connectEnd":191.80000019073486,"connectStart":191.80000019073486,"domainLookupEnd":191.80000019073486,"domainLookupStart":191.80000019073486,"fetchStart":191.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":191.80000019073486,"responseEnd":449.2000002861023,"responseStart":449.2000002861023,"secureConnectionStart":191.80000019073486},{"duration":300.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":191.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":191.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.5,"responseStart":0,"secureConnectionStart":0},{"duration":257.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":192.10000038146973,"connectEnd":192.10000038146973,"connectStart":192.10000038146973,"domainLookupEnd":192.10000038146973,"domainLookupStart":192.10000038146973,"fetchStart":192.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":192.10000038146973,"responseEnd":450,"responseStart":450,"secureConnectionStart":192.10000038146973},{"duration":300.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":192.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":192.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":257.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":193.40000009536743,"connectEnd":193.40000009536743,"connectStart":193.40000009536743,"domainLookupEnd":193.40000009536743,"domainLookupStart":193.40000009536743,"fetchStart":193.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":193.40000009536743,"responseEnd":450.7000002861023,"responseStart":450.7000002861023,"secureConnectionStart":193.40000009536743},{"duration":347.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":202.2000002861023,"connectEnd":202.2000002861023,"connectStart":202.2000002861023,"domainLookupEnd":202.2000002861023,"domainLookupStart":202.2000002861023,"fetchStart":202.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":202.2000002861023,"responseEnd":549.9000000953674,"responseStart":549.9000000953674,"secureConnectionStart":202.2000002861023},{"duration":378.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":202.2000002861023,"connectEnd":202.2000002861023,"connectStart":202.2000002861023,"domainLookupEnd":202.2000002861023,"domainLookupStart":202.2000002861023,"fetchStart":202.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":202.2000002861023,"responseEnd":580.8000001907349,"responseStart":580.8000001907349,"secureConnectionStart":202.2000002861023},{"duration":44.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":507.1000003814697,"connectEnd":507.1000003814697,"connectStart":507.1000003814697,"domainLookupEnd":507.1000003814697,"domainLookupStart":507.1000003814697,"fetchStart":507.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":507.1000003814697,"responseEnd":551.7000002861023,"responseStart":551.7000002861023,"secureConnectionStart":507.1000003814697},{"duration":253.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":555.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":555.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":808.9000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":38,"responseStart":184,"responseEnd":198,"domLoading":188,"domInteractive":1040,"domContentLoadedEventStart":1040,"domContentLoadedEventEnd":1084,"domComplete":1776,"loadEventStart":1777,"loadEventEnd":1777,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1015.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1016.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1016.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1017.3000001907349},{"name":"activityTabFullyLoaded","time":1103.9000000953674}],"measures":[],"correlationId":"cbfb03c805241f","effectiveType":"4g","downlink":9.6,"rtt":0,"serverDuration":84,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Fix pushed into the feature tree.