The sliding window defined by RANGE BETWEEN N FOLLOWING and N PRECEDING does not add/remove rows in the correct order.
Example:
insertinto 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 orderby pk ROWSBETWEEN 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).
Sergei Petrunia
added a comment - Fix pushed into the feature tree.
People
Sergei Petrunia
Vicențiu Ciorbaru
Votes:
0Vote for this issue
Watchers:
2Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
1 of 1
{"errorMessages":["jqlTooComplex"],"errors":{}}
[{"id":-1,"name":"My open issues","jql":"assignee = currentUser() AND resolution = Unresolved order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":true},{"id":-2,"name":"Reported by me","jql":"reporter = currentUser() order by created DESC","isSystem":true,"sharePermissions":[],"requiresLogin":true},{"id":-4,"name":"All issues","jql":"order by created DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-5,"name":"Open issues","jql":"resolution = Unresolved order by priority DESC,updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-9,"name":"Done issues","jql":"statusCategory = Done order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-3,"name":"Viewed recently","jql":"issuekey in issueHistory() order by lastViewed DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-6,"name":"Created recently","jql":"created >= -1w order by created DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-7,"name":"Resolved recently","jql":"resolutiondate >= -1w order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-8,"name":"Updated recently","jql":"updated >= -1w order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false}]
0.3
0
{"report":{"fcp":991.7000002861023,"ttfb":192.80000019073486,"pageVisibility":"visible","key":"jira.issue.nav-detail","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"dead2e7f-706a-4f35-9698-1e08e6b10952","navigationType":0,"readyForUser":1501.6000003814697,"redirectCount":0,"resourceLoadedEnd":661.8000001907349,"resourceLoadedStart":209,"resourceTiming":[{"duration":162.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":209,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":371.5,"responseStart":0,"secureConnectionStart":0},{"duration":162.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/1478ee9518804fac4b35845dc4ce556a-CDN/lu2cib/820016/12ta74/97a9a6b13407d4702f4a258757d43f81/_/download/contextbatch/css/jira.view.issue,viewissue.standalone,jira.navigator.kickass,jira.general,jira.global,jira.navigator,atl.general,jira.navigator.simple,jira.navigator.advanced,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":209.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":371.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":163,"initiatorType":"link","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/3.0.4/_/download/batch/com.atlassian.jira.jira-tzdetect-plugin:tzdetect-banner-component/com.atlassian.jira.jira-tzdetect-plugin:tzdetect-banner-component.css","startTime":209.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":372.5,"responseStart":0,"secureConnectionStart":0},{"duration":163.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/a7c82c2f9b4c8fd63530eb9f2a1d712a-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.filter.deletion.warning:styles/jira.filter.deletion.warning:styles.css","startTime":209.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":209.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":372.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":243.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":210.10000038146973,"connectEnd":210.10000038146973,"connectStart":210.10000038146973,"domainLookupEnd":210.10000038146973,"domainLookupStart":210.10000038146973,"fetchStart":210.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":376.5,"responseEnd":453.2000002861023,"responseStart":388.5,"secureConnectionStart":210.10000038146973},{"duration":293.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/3e25a0b0c47560558d0a6707b047e06f-CDN/lu2cib/820016/12ta74/97a9a6b13407d4702f4a258757d43f81/_/download/contextbatch/js/jira.view.issue,viewissue.standalone,jira.navigator.kickass,jira.general,jira.global,jira.navigator,atl.general,jira.navigator.simple,jira.navigator.advanced,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":210.30000019073486,"connectEnd":210.30000019073486,"connectStart":210.30000019073486,"domainLookupEnd":210.30000019073486,"domainLookupStart":210.30000019073486,"fetchStart":210.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":377.1000003814697,"responseEnd":503.90000009536743,"responseStart":391.7000002861023,"secureConnectionStart":210.30000019073486},{"duration":192.5,"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":210.5,"connectEnd":210.5,"connectStart":210.5,"domainLookupEnd":210.5,"domainLookupStart":210.5,"fetchStart":210.5,"redirectEnd":0,"redirectStart":0,"requestStart":378.5,"responseEnd":403,"responseStart":402.2000002861023,"secureConnectionStart":210.5},{"duration":197.39999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/aa6a6199803063cf5eed6122dfa3f13b-CDN/lu2cib/820016/12ta74/3.0.4/_/download/batch/com.atlassian.jira.jira-tzdetect-plugin:tzdetect-banner-component/com.atlassian.jira.jira-tzdetect-plugin:tzdetect-banner-component.js?locale=en","startTime":210.60000038146973,"connectEnd":210.60000038146973,"connectStart":210.60000038146973,"domainLookupEnd":210.60000038146973,"domainLookupStart":210.60000038146973,"fetchStart":210.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":379.40000009536743,"responseEnd":408,"responseStart":407.6000003814697,"secureConnectionStart":210.60000038146973},{"duration":196.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/3.0.4/_/download/batch/com.atlassian.jira.jira-tzdetect-plugin:tzdetect-lib/com.atlassian.jira.jira-tzdetect-plugin:tzdetect-lib.js","startTime":210.90000009536743,"connectEnd":210.90000009536743,"connectStart":210.90000009536743,"domainLookupEnd":210.90000009536743,"domainLookupStart":210.90000009536743,"fetchStart":210.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":380.7000002861023,"responseEnd":407.40000009536743,"responseStart":406.90000009536743,"secureConnectionStart":210.90000009536743},{"duration":205.7999997138977,"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":211.10000038146973,"connectEnd":211.10000038146973,"connectStart":211.10000038146973,"domainLookupEnd":211.10000038146973,"domainLookupStart":211.10000038146973,"fetchStart":211.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":381.7000002861023,"responseEnd":416.90000009536743,"responseStart":416.40000009536743,"secureConnectionStart":211.10000038146973},{"duration":197.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":211.2000002861023,"connectEnd":211.2000002861023,"connectStart":211.2000002861023,"domainLookupEnd":211.2000002861023,"domainLookupStart":211.2000002861023,"fetchStart":211.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":383.5,"responseEnd":408.6000003814697,"responseStart":408.1000003814697,"secureConnectionStart":211.2000002861023},{"duration":171,"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":211.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":211.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":382.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":204.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":211.5,"connectEnd":211.5,"connectStart":211.5,"domainLookupEnd":211.5,"domainLookupStart":211.5,"fetchStart":211.5,"redirectEnd":0,"redirectStart":0,"requestStart":386,"responseEnd":416.30000019073486,"responseStart":415.6000003814697,"secureConnectionStart":211.5},{"duration":217.80000019073486,"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":211.90000009536743,"connectEnd":211.90000009536743,"connectStart":211.90000009536743,"domainLookupEnd":211.90000009536743,"domainLookupStart":211.90000009536743,"fetchStart":211.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":386.7000002861023,"responseEnd":429.7000002861023,"responseStart":429.1000003814697,"secureConnectionStart":211.90000009536743},{"duration":449.69999980926514,"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":212.10000038146973,"connectEnd":212.10000038146973,"connectStart":212.10000038146973,"domainLookupEnd":212.10000038146973,"domainLookupStart":212.10000038146973,"fetchStart":212.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":452.30000019073486,"responseEnd":661.8000001907349,"responseStart":660.1000003814697,"secureConnectionStart":212.10000038146973},{"duration":316.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":757.6000003814697,"connectEnd":757.6000003814697,"connectStart":757.6000003814697,"domainLookupEnd":757.6000003814697,"domainLookupStart":757.6000003814697,"fetchStart":757.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1037.7000002861023,"responseEnd":1073.7000002861023,"responseStart":1073.1000003814697,"secureConnectionStart":757.6000003814697},{"duration":202.90000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":973.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":973.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1176.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":236.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/api/2/filter/favourite?expand=subscriptions[-5:]&_=1743508408816","startTime":1046.6000003814697,"connectEnd":1046.6000003814697,"connectStart":1046.6000003814697,"domainLookupEnd":1046.6000003814697,"domainLookupStart":1046.6000003814697,"fetchStart":1046.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1255.8000001907349,"responseEnd":1282.7000002861023,"responseStart":1282,"secureConnectionStart":1046.6000003814697},{"duration":373.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/issueNav/latest/preferredSearchLayout","startTime":1112.3000001907349,"connectEnd":1112.3000001907349,"connectStart":1112.3000001907349,"domainLookupEnd":1112.3000001907349,"domainLookupStart":1112.3000001907349,"fetchStart":1112.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1455.4000000953674,"responseEnd":1485.6000003814697,"responseStart":1485.2000002861023,"secureConnectionStart":1112.3000001907349},{"duration":347.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/issueNav/1/issueTable/stable","startTime":1141.8000001907349,"connectEnd":1141.8000001907349,"connectStart":1141.8000001907349,"domainLookupEnd":1141.8000001907349,"domainLookupStart":1141.8000001907349,"fetchStart":1141.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1456.1000003814697,"responseEnd":1489.3000001907349,"responseStart":1488.7000002861023,"secureConnectionStart":1141.8000001907349},{"duration":337.90000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/menu/latest/appswitcher?_=1743508408817","startTime":1148.8000001907349,"connectEnd":1148.8000001907349,"connectStart":1148.8000001907349,"domainLookupEnd":1148.8000001907349,"domainLookupStart":1148.8000001907349,"fetchStart":1148.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1456.8000001907349,"responseEnd":1486.7000002861023,"responseStart":1486,"secureConnectionStart":1148.8000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":66,"responseStart":192,"responseEnd":208,"domLoading":196,"domInteractive":1012,"domContentLoadedEventStart":1012,"domContentLoadedEventEnd":1168,"domComplete":1920,"loadEventStart":1920,"loadEventEnd":1920,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[],"measures":[],"correlationId":"e35d4f3bffee61","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":79,"dbReadsTimeInMs":3,"dbConnsTimeInMs":7,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Fix pushed into the feature tree.