Type:
Technical task
Priority:
Major
Resolution:
Fixed
Affects Version/s:
None
Sprint:
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
As of version 10.3.1 , Item_func_case (when handling a simple CASE ) stores the predicant argument (in the args[] array) after the WHEN..THEN arguments and before the ELSE argument.
For example, this expression:
CASE pred WHEN search1 THEN res1 WHEN search2 THEN res2 ELSE resE END
stores the arguments as follows:
args[0] =search1
args[1] =res1
args[2] =search2
args[3] =res2
args[4] =pred
args[6] =resE
Under terms of this task we'll do the following:
1. Change Item_func_case to store the arguments in the order of their appearance in the parser: the predicant argument in args[0] , followed by the WHEN..THEN..ELSE arguments
2. Split Item_func_case into two separate classes Item_func_case_simple and Item_func_case_searched (for CASE expressions with and without predicant respectively).
3. Change the constructors of the affected classes just to accept a List<Item> argument (without additional first_expr_arg and else_expr_arg .
Advantages:
a. #1 and #3 will help to simplify the code in sql_yacc_ora.yy
| DECODE_SYM '(' expr ',' decode_when_list ')'
{
// 30 lines of the code, extracting {{else_expr_arg}} from the list.
}
to something as simple as:
| DECODE_SYM '(' expr ',' decode_when_list ')'
{
$5->push_front($3, thd->mem_root);
if (!($$= new (thd->mem_root) Item_func_case_simple(thd, *$5)))
MYSQL_YYABORT;
}
b. #1 and #3 will help to implement MDEV-13863 easier. MDEV-13836 will introduce a new class Item_func_decode_oracle . Without #1, we'd have to use the same complex code from sql_yacc_ora.yy , now for both DECODE() and DECODE_ORACLE() .
c. #2 will slightly reduce the memory size required to handle searched CASE expression, because only Item_func_case_simple will need to derive from Predicant_to_list_comparator
d. #2 will make the code more readable by removing a lot of if statements like this:
if (first_expr_num != -1)
{
...
}
else
{
...
}
as the branches for the searched and the simple CASE expressions will reside in methods of different classes.
e. #1 will make it easier to debug the code in gdb , as printing the arguments in their syntactic order will be much easier than now.
blocks
MDEV-13863
sql_mode=ORACLE: DECODE does not treat two NULLs as equivalent
Closed
{"report":{"fcp":1235.699999999255,"ttfb":228.80000000074506,"pageVisibility":"visible","entityId":63278,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"69198528-4796-46ab-9448-b5e71b286817","navigationType":0,"readyForUser":1296.800000000745,"redirectCount":0,"resourceLoadedEnd":1195.199999999255,"resourceLoadedStart":234,"resourceTiming":[{"duration":6.199999999254942,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":234,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":240.19999999925494,"responseStart":0,"secureConnectionStart":0},{"duration":6.199999999254942,"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":234.30000000074506,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234.30000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":240.5,"responseStart":0,"secureConnectionStart":0},{"duration":58.30000000074506,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":234.39999999850988,"connectEnd":234.39999999850988,"connectStart":234.39999999850988,"domainLookupEnd":234.39999999850988,"domainLookupStart":234.39999999850988,"fetchStart":234.39999999850988,"redirectEnd":0,"redirectStart":0,"requestStart":234.39999999850988,"responseEnd":292.69999999925494,"responseStart":292.69999999925494,"secureConnectionStart":234.39999999850988},{"duration":124.69999999925494,"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":234.60000000149012,"connectEnd":234.60000000149012,"connectStart":234.60000000149012,"domainLookupEnd":234.60000000149012,"domainLookupStart":234.60000000149012,"fetchStart":234.60000000149012,"redirectEnd":0,"redirectStart":0,"requestStart":234.60000000149012,"responseEnd":359.30000000074506,"responseStart":359.30000000074506,"secureConnectionStart":234.60000000149012},{"duration":10.200000002980232,"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":234.89999999850988,"connectEnd":234.89999999850988,"connectStart":234.89999999850988,"domainLookupEnd":234.89999999850988,"domainLookupStart":234.89999999850988,"fetchStart":234.89999999850988,"redirectEnd":0,"redirectStart":0,"requestStart":234.89999999850988,"responseEnd":245.10000000149012,"responseStart":245.10000000149012,"secureConnectionStart":234.89999999850988},{"duration":11.600000001490116,"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":235,"connectEnd":235,"connectStart":235,"domainLookupEnd":235,"domainLookupStart":235,"fetchStart":235,"redirectEnd":0,"redirectStart":0,"requestStart":235,"responseEnd":246.60000000149012,"responseStart":246.60000000149012,"secureConnectionStart":235},{"duration":13.100000001490116,"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":235.39999999850988,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.39999999850988,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":248.5,"responseStart":0,"secureConnectionStart":0},{"duration":126.89999999850988,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/f66960d7757d5f06891021cb34673e32/shortcuts.js?context=issuenavigation&context=issueaction","startTime":235.5,"connectEnd":235.5,"connectStart":235.5,"domainLookupEnd":235.5,"domainLookupStart":235.5,"fetchStart":235.5,"redirectEnd":0,"redirectStart":0,"requestStart":235.5,"responseEnd":362.3999999985099,"responseStart":362.3999999985099,"secureConnectionStart":235.5},{"duration":199.10000000149012,"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":235.69999999925494,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.69999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":434.80000000074506,"responseStart":0,"secureConnectionStart":0},{"duration":127.20000000298023,"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":235.89999999850988,"connectEnd":235.89999999850988,"connectStart":235.89999999850988,"domainLookupEnd":235.89999999850988,"domainLookupStart":235.89999999850988,"fetchStart":235.89999999850988,"redirectEnd":0,"redirectStart":0,"requestStart":235.89999999850988,"responseEnd":363.1000000014901,"responseStart":363.1000000014901,"secureConnectionStart":235.89999999850988},{"duration":207.59999999776483,"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":245.10000000149012,"connectEnd":245.10000000149012,"connectStart":245.10000000149012,"domainLookupEnd":245.10000000149012,"domainLookupStart":245.10000000149012,"fetchStart":245.10000000149012,"redirectEnd":0,"redirectStart":0,"requestStart":245.10000000149012,"responseEnd":452.69999999925494,"responseStart":452.69999999925494,"secureConnectionStart":245.10000000149012},{"duration":235.40000000223517,"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":246.19999999925494,"connectEnd":246.19999999925494,"connectStart":246.19999999925494,"domainLookupEnd":246.19999999925494,"domainLookupStart":246.19999999925494,"fetchStart":246.19999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":246.19999999925494,"responseEnd":481.6000000014901,"responseStart":481.6000000014901,"secureConnectionStart":246.19999999925494},{"duration":23.800000000745058,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":458.8999999985099,"connectEnd":458.8999999985099,"connectStart":458.8999999985099,"domainLookupEnd":458.8999999985099,"domainLookupStart":458.8999999985099,"fetchStart":458.8999999985099,"redirectEnd":0,"redirectStart":0,"requestStart":458.8999999985099,"responseEnd":482.69999999925494,"responseStart":482.69999999925494,"secureConnectionStart":458.8999999985099},{"duration":346.30000000074506,"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","startTime":485.8999999985099,"connectEnd":485.8999999985099,"connectStart":485.8999999985099,"domainLookupEnd":485.8999999985099,"domainLookupStart":485.8999999985099,"fetchStart":485.8999999985099,"redirectEnd":0,"redirectStart":0,"requestStart":485.8999999985099,"responseEnd":832.1999999992549,"responseStart":832.1999999992549,"secureConnectionStart":485.8999999985099},{"duration":960,"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":235.19999999925494,"connectEnd":235.19999999925494,"connectStart":235.19999999925494,"domainLookupEnd":235.19999999925494,"domainLookupStart":235.19999999925494,"fetchStart":235.19999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":235.19999999925494,"responseEnd":1195.199999999255,"responseStart":1195.199999999255,"secureConnectionStart":235.19999999925494},{"duration":34.69999999925494,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":838.1000000014901,"connectEnd":838.1000000014901,"connectStart":838.1000000014901,"domainLookupEnd":838.1000000014901,"domainLookupStart":838.1000000014901,"fetchStart":838.1000000014901,"redirectEnd":0,"redirectStart":0,"requestStart":838.1000000014901,"responseEnd":872.8000000007451,"responseStart":872.8000000007451,"secureConnectionStart":838.1000000014901},{"duration":103.89999999850988,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1230.1000000014901,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1230.1000000014901,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1334,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":3,"domainLookupEnd":47,"connectStart":47,"connectEnd":66,"secureConnectionStart":55,"requestStart":66,"responseStart":228,"responseEnd":246,"domLoading":232,"domInteractive":1355,"domContentLoadedEventStart":1355,"domContentLoadedEventEnd":1405,"domComplete":1580,"loadEventStart":1580,"loadEventEnd":1580,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1336.1000000014901},{"name":"bigPipe.sidebar-id.end","time":1336.800000000745},{"name":"bigPipe.activity-panel-pipe-id.start","time":1337},{"name":"bigPipe.activity-panel-pipe-id.end","time":1337.800000000745},{"name":"activityTabFullyLoaded","time":1423.8999999985099}],"measures":[],"correlationId":"9805e0fad73ab1","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":103,"dbReadsTimeInMs":13,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Pushed to bb-10.2-ext and 10.3