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
Transition
Time In Source Status
Execution Times
Open
In Progress
3h 26m
1
In Progress
Closed
21h 9m
1
{"report":{"fcp":983.2000000476837,"ttfb":273.2999999523163,"pageVisibility":"visible","entityId":63278,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"5b677810-385f-43c9-9931-d55ef1318e72","navigationType":0,"readyForUser":1064.2999999523163,"redirectCount":0,"resourceLoadedEnd":903.5999999046326,"resourceLoadedStart":281.2999999523163,"resourceTiming":[{"duration":187.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":281.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":469.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":188,"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":281.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":469.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":199,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":281.7999999523163,"connectEnd":281.7999999523163,"connectStart":281.7999999523163,"domainLookupEnd":281.7999999523163,"domainLookupStart":281.7999999523163,"fetchStart":281.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":281.7999999523163,"responseEnd":480.7999999523163,"responseStart":480.7999999523163,"secureConnectionStart":281.7999999523163},{"duration":252.90000009536743,"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":282.2999999523163,"connectEnd":282.2999999523163,"connectStart":282.2999999523163,"domainLookupEnd":282.2999999523163,"domainLookupStart":282.2999999523163,"fetchStart":282.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":282.2999999523163,"responseEnd":535.2000000476837,"responseStart":535.2000000476837,"secureConnectionStart":282.2999999523163},{"duration":256.39999985694885,"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":282.5,"connectEnd":282.5,"connectStart":282.5,"domainLookupEnd":282.5,"domainLookupStart":282.5,"fetchStart":282.5,"redirectEnd":0,"redirectStart":0,"requestStart":282.5,"responseEnd":538.8999998569489,"responseStart":538.8999998569489,"secureConnectionStart":282.5},{"duration":256.7999999523163,"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":282.59999990463257,"connectEnd":282.59999990463257,"connectStart":282.59999990463257,"domainLookupEnd":282.59999990463257,"domainLookupStart":282.59999990463257,"fetchStart":282.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":282.59999990463257,"responseEnd":539.3999998569489,"responseStart":539.3999998569489,"secureConnectionStart":282.59999990463257},{"duration":256.90000009536743,"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":282.7999999523163,"connectEnd":282.7999999523163,"connectStart":282.7999999523163,"domainLookupEnd":282.7999999523163,"domainLookupStart":282.7999999523163,"fetchStart":282.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":282.7999999523163,"responseEnd":539.7000000476837,"responseStart":539.7000000476837,"secureConnectionStart":282.7999999523163},{"duration":340.09999990463257,"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":283,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":283,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":623.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":283.2000000476837,"connectEnd":283.2000000476837,"connectStart":283.2000000476837,"domainLookupEnd":283.2000000476837,"domainLookupStart":283.2000000476837,"fetchStart":283.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":283.2000000476837,"responseEnd":540.2000000476837,"responseStart":540.2000000476837,"secureConnectionStart":283.2000000476837},{"duration":340,"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":283.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":283.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":623.2999999523163,"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":283.39999985694885,"connectEnd":283.39999985694885,"connectStart":283.39999985694885,"domainLookupEnd":283.39999985694885,"domainLookupStart":283.39999985694885,"fetchStart":283.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":283.39999985694885,"responseEnd":540.7000000476837,"responseStart":540.7000000476837,"secureConnectionStart":283.39999985694885},{"duration":398.40000009536743,"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":285.39999985694885,"connectEnd":285.39999985694885,"connectStart":285.39999985694885,"domainLookupEnd":285.39999985694885,"domainLookupStart":285.39999985694885,"fetchStart":285.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":285.39999985694885,"responseEnd":683.7999999523163,"responseStart":683.7999999523163,"secureConnectionStart":285.39999985694885},{"duration":455,"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":285.5,"connectEnd":285.5,"connectStart":285.5,"domainLookupEnd":285.5,"domainLookupStart":285.5,"fetchStart":285.5,"redirectEnd":0,"redirectStart":0,"requestStart":285.5,"responseEnd":740.5,"responseStart":740.5,"secureConnectionStart":285.5},{"duration":53.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":634.5,"connectEnd":634.5,"connectStart":634.5,"domainLookupEnd":634.5,"domainLookupStart":634.5,"fetchStart":634.5,"redirectEnd":0,"redirectStart":0,"requestStart":634.5,"responseEnd":688,"responseStart":688,"secureConnectionStart":634.5},{"duration":197.20000004768372,"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":706.3999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":706.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":903.5999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":27,"domainLookupEnd":67,"connectStart":68,"connectEnd":86,"secureConnectionStart":76,"requestStart":87,"responseStart":273,"responseEnd":283,"domLoading":276,"domInteractive":1119,"domContentLoadedEventStart":1119,"domContentLoadedEventEnd":1166,"domComplete":1781,"loadEventStart":1781,"loadEventEnd":1781,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1101.5},{"name":"bigPipe.sidebar-id.end","time":1102.3999998569489},{"name":"bigPipe.activity-panel-pipe-id.start","time":1102.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1103.5},{"name":"activityTabFullyLoaded","time":1184.8999998569489}],"measures":[],"correlationId":"f687f25d3514e9","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":17,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}