Type:
Bug
Priority:
Major
Resolution:
Unresolved
Affects Version/s:
10.5.17 , 11.0.1 , 10.3(EOL) , 10.4(EOL) , 10.5 , 10.6 , 10.7(EOL) , 10.8(EOL) , 10.9(EOL) , 10.10(EOL) , 10.11
MariaDB [beta]> select s, lap, avg(s)over() -- , avg(lap)over()
-> from (
-> select seq s , seq + floor(rand(0)*(2)-1) lap
-> from seq_1_to_5
-> ) as a
-> order by s
-> ;
+---+-----+--------------+
| s | lap | avg(s)over() |
+---+-----+--------------+
| 0 | 3 | 5.0000 |
| 0 | 3 | 5.0000 |
| 0 | 5 | 5.0000 |
| 0 | 0 | 5.0000 |
| 0 | 2 | 5.0000 |
+---+-----+--------------+
5 rows in set (0.002 sec)
Correct result:
+---+-----+----------------+
| s | lap | avg(seq)over() |
+---+-----+----------------+
| 1 | 0 | 3.0000 |
| 2 | 2 | 3.0000 |
| 3 | 3 | 3.0000 |
| 4 | 3 | 3.0000 |
| 5 | 5 | 3.0000 |
+---+-----+----------------+
5 rows in set (0.000 sec)
{"report":{"fcp":753.1000001430511,"ttfb":166.60000014305115,"pageVisibility":"visible","entityId":119856,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"3942e025-1fa2-4186-a37f-74a106c1533a","navigationType":0,"readyForUser":830.5,"redirectCount":0,"resourceLoadedEnd":800,"resourceLoadedStart":171.79999995231628,"resourceTiming":[{"duration":7.700000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":171.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":171.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":179.5,"responseStart":0,"secureConnectionStart":0},{"duration":7.799999952316284,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":172,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":172,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":179.79999995231628,"responseStart":0,"secureConnectionStart":0},{"duration":68.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":172.20000004768372,"connectEnd":172.20000004768372,"connectStart":172.20000004768372,"domainLookupEnd":172.20000004768372,"domainLookupStart":172.20000004768372,"fetchStart":172.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":172.20000004768372,"responseEnd":240.90000009536743,"responseStart":240.90000009536743,"secureConnectionStart":172.20000004768372},{"duration":152,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":172.40000009536743,"connectEnd":172.40000009536743,"connectStart":172.40000009536743,"domainLookupEnd":172.40000009536743,"domainLookupStart":172.40000009536743,"fetchStart":172.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":172.40000009536743,"responseEnd":324.40000009536743,"responseStart":324.40000009536743,"secureConnectionStart":172.40000009536743},{"duration":155.79999995231628,"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":172.60000014305115,"connectEnd":172.60000014305115,"connectStart":172.60000014305115,"domainLookupEnd":172.60000014305115,"domainLookupStart":172.60000014305115,"fetchStart":172.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":172.60000014305115,"responseEnd":328.40000009536743,"responseStart":328.40000009536743,"secureConnectionStart":172.60000014305115},{"duration":155.89999985694885,"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":172.90000009536743,"connectEnd":172.90000009536743,"connectStart":172.90000009536743,"domainLookupEnd":172.90000009536743,"domainLookupStart":172.90000009536743,"fetchStart":172.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":172.90000009536743,"responseEnd":328.7999999523163,"responseStart":328.7999999523163,"secureConnectionStart":172.90000009536743},{"duration":156.20000004768372,"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":173,"connectEnd":173,"connectStart":173,"domainLookupEnd":173,"domainLookupStart":173,"fetchStart":173,"redirectEnd":0,"redirectStart":0,"requestStart":173,"responseEnd":329.2000000476837,"responseStart":329.2000000476837,"secureConnectionStart":173},{"duration":210.60000014305115,"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":173.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":173.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":383.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":156.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":173.40000009536743,"connectEnd":173.40000009536743,"connectStart":173.40000009536743,"domainLookupEnd":173.40000009536743,"domainLookupStart":173.40000009536743,"fetchStart":173.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":173.40000009536743,"responseEnd":329.90000009536743,"responseStart":329.90000009536743,"secureConnectionStart":173.40000009536743},{"duration":210.39999985694885,"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":173.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":173.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":384,"responseStart":0,"secureConnectionStart":0},{"duration":156.90000009536743,"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":173.79999995231628,"connectEnd":173.79999995231628,"connectStart":173.79999995231628,"domainLookupEnd":173.79999995231628,"domainLookupStart":173.79999995231628,"fetchStart":173.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":173.79999995231628,"responseEnd":330.7000000476837,"responseStart":330.7000000476837,"secureConnectionStart":173.79999995231628},{"duration":288,"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":179.20000004768372,"connectEnd":179.20000004768372,"connectStart":179.20000004768372,"domainLookupEnd":179.20000004768372,"domainLookupStart":179.20000004768372,"fetchStart":179.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":179.20000004768372,"responseEnd":467.2000000476837,"responseStart":467.2000000476837,"secureConnectionStart":179.20000004768372},{"duration":502.60000014305115,"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":179.29999995231628,"connectEnd":179.29999995231628,"connectStart":179.29999995231628,"domainLookupEnd":179.29999995231628,"domainLookupStart":179.29999995231628,"fetchStart":179.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":179.29999995231628,"responseEnd":681.9000000953674,"responseStart":681.9000000953674,"secureConnectionStart":179.29999995231628},{"duration":83.20000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":395.7999999523163,"connectEnd":395.7999999523163,"connectStart":395.7999999523163,"domainLookupEnd":395.7999999523163,"domainLookupStart":395.7999999523163,"fetchStart":395.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":395.7999999523163,"responseEnd":479,"responseStart":479,"secureConnectionStart":395.7999999523163},{"duration":38,"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&whisper-enabled=true","startTime":671.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":671.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":709.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":119,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":672.2999999523163,"connectEnd":672.2999999523163,"connectStart":672.2999999523163,"domainLookupEnd":672.2999999523163,"domainLookupStart":672.2999999523163,"fetchStart":672.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":672.2999999523163,"responseEnd":791.2999999523163,"responseStart":791.2999999523163,"secureConnectionStart":672.2999999523163},{"duration":127.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/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.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":672.7000000476837,"connectEnd":672.7000000476837,"connectStart":672.7000000476837,"domainLookupEnd":672.7000000476837,"domainLookupStart":672.7000000476837,"fetchStart":672.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":672.7000000476837,"responseEnd":800,"responseStart":800,"secureConnectionStart":672.7000000476837},{"duration":118.59999990463257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":746.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":746.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":865.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":58.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":767.7000000476837,"connectEnd":767.7000000476837,"connectStart":767.7000000476837,"domainLookupEnd":767.7000000476837,"domainLookupStart":767.7000000476837,"fetchStart":767.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":767.7000000476837,"responseEnd":826.2000000476837,"responseStart":826.2000000476837,"secureConnectionStart":767.7000000476837}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":15,"responseStart":166,"responseEnd":176,"domLoading":169,"domInteractive":909,"domContentLoadedEventStart":909,"domContentLoadedEventEnd":952,"domComplete":1035,"loadEventStart":1035,"loadEventEnd":1036,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":867.7999999523163},{"name":"bigPipe.sidebar-id.end","time":868.6000001430511},{"name":"bigPipe.activity-panel-pipe-id.start","time":868.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.end","time":870.6000001430511},{"name":"activityTabFullyLoaded","time":970}],"measures":[],"correlationId":"6e0c581002d960","effectiveType":"4g","downlink":9.5,"rtt":0,"serverDuration":91,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thank you for the report! I repeated as described on 10.3-10.11,11.0
MariaDB [test]> select seq, avg(seq) over () from ( select seq from seq_1_to_5 ) as a ;
+-----+------------------+
| seq | avg(seq) over () |
+-----+------------------+
| 1 | 3.0000 |
| 2 | 3.0000 |
| 3 | 3.0000 |
| 4 | 3.0000 |
| 5 | 3.0000 |
+-----+------------------+
5 rows in set (0,001 sec)
MariaDB [test]> select seq, avg(seq) over () from ( select seq, rand() from seq_1_to_5 ) as a ;
+-----+------------------+
| seq | avg(seq) over () |
+-----+------------------+
| 0 | 5.0000 |
| 0 | 5.0000 |
| 0 | 5.0000 |
| 0 | 5.0000 |
| 0 | 5.0000 |
+-----+------------------+
5 rows in set (0,001 sec)
MariaDB [test]> explain extended select seq, avg(seq) over () from ( select seq, rand() from seq_1_to_5 ) as a ;
+------+-------------+------------+-------+---------------+---------+---------+------+------+----------+-----------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+------------+-------+---------------+---------+---------+------+------+----------+-----------------+
| 1 | PRIMARY | <derived2> | ALL | NULL | NULL | NULL | NULL | 5 | 100.00 | Using temporary |
| 2 | DERIVED | seq_1_to_5 | index | NULL | PRIMARY | 8 | NULL | 5 | 100.00 | Using index |
+------+-------------+------------+-------+---------------+---------+---------+------+------+----------+-----------------+
2 rows in set, 1 warning (0,001 sec)
Note (Code 1003): /* select#1 */ select `a`.`seq` AS `seq`,avg(`a`.`seq`) over () AS `avg(seq) over ()` from (/* select#2 */ select `test`.`seq_1_to_5`.`seq` AS `seq`,rand() AS `rand()` from `test`.`seq_1_to_5`) `a`
MariaDB [test]> explain extended select seq, avg(seq) over () from ( select seq from seq_1_to_5 ) as a ;
+------+-------------+------------+-------+---------------+---------+---------+------+------+----------+------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+------+-------------+------------+-------+---------------+---------+---------+------+------+----------+------------------------------+
| 1 | SIMPLE | seq_1_to_5 | index | NULL | PRIMARY | 8 | NULL | 5 | 100.00 | Using index; Using temporary |
+------+-------------+------------+-------+---------------+---------+---------+------+------+----------+------------------------------+
1 row in set, 1 warning (0,000 sec)
Note (Code 1003): select `test`.`seq_1_to_5`.`seq` AS `seq`,avg(`test`.`seq_1_to_5`.`seq`) over () AS `avg(seq) over ()` from `test`.`seq_1_to_5`