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":893.8999998569489,"ttfb":339.39999985694885,"pageVisibility":"visible","entityId":63278,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":1,"journeyId":"b82dfab4-c383-458c-8f3f-e481f6fb825b","navigationType":0,"readyForUser":989.5,"redirectCount":0,"resourceLoadedEnd":438.59999990463257,"resourceLoadedStart":347.59999990463257,"resourceTiming":[{"duration":12.100000143051147,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":347.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":347.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":359.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":12.100000143051147,"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":347.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":347.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":360,"responseStart":0,"secureConnectionStart":0},{"duration":82.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":348.09999990463257,"connectEnd":348.09999990463257,"connectStart":348.09999990463257,"domainLookupEnd":348.09999990463257,"domainLookupStart":348.09999990463257,"fetchStart":348.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":363.7000000476837,"responseEnd":430.7000000476837,"responseStart":390.39999985694885,"secureConnectionStart":348.09999990463257},{"duration":90.39999985694885,"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":348.2000000476837,"connectEnd":348.2000000476837,"connectStart":348.2000000476837,"domainLookupEnd":348.2000000476837,"domainLookupStart":348.2000000476837,"fetchStart":348.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":363.7000000476837,"responseEnd":438.59999990463257,"responseStart":379.09999990463257,"secureConnectionStart":348.2000000476837},{"duration":30.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":348.39999985694885,"connectEnd":348.39999985694885,"connectStart":348.39999985694885,"domainLookupEnd":348.39999985694885,"domainLookupStart":348.39999985694885,"fetchStart":348.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":364.09999990463257,"responseEnd":378.89999985694885,"responseStart":378,"secureConnectionStart":348.39999985694885},{"duration":53.39999985694885,"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":348.5,"connectEnd":348.5,"connectStart":348.5,"domainLookupEnd":348.5,"domainLookupStart":348.5,"fetchStart":348.5,"redirectEnd":0,"redirectStart":0,"requestStart":366.7000000476837,"responseEnd":401.89999985694885,"responseStart":400.7000000476837,"secureConnectionStart":348.5},{"duration":17.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":348.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":348.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":365.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":55.700000047683716,"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":348.7999999523163,"connectEnd":348.7999999523163,"connectStart":348.7999999523163,"domainLookupEnd":348.7999999523163,"domainLookupStart":348.7999999523163,"fetchStart":348.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":369.09999990463257,"responseEnd":404.5,"responseStart":404,"secureConnectionStart":348.7999999523163},{"duration":54.799999952316284,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":349,"connectEnd":349,"connectStart":349,"domainLookupEnd":349,"domainLookupStart":349,"fetchStart":349,"redirectEnd":0,"redirectStart":0,"requestStart":369.59999990463257,"responseEnd":403.7999999523163,"responseStart":403.09999990463257,"secureConnectionStart":349},{"duration":19.799999952316284,"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":349.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":349.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":369.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":53.60000014305115,"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":349.39999985694885,"connectEnd":349.39999985694885,"connectStart":349.39999985694885,"domainLookupEnd":349.39999985694885,"domainLookupStart":349.39999985694885,"fetchStart":349.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":371.39999985694885,"responseEnd":403,"responseStart":402,"secureConnectionStart":349.39999985694885},{"duration":30,"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":357.7000000476837,"connectEnd":376.2999999523163,"connectStart":376.2999999523163,"domainLookupEnd":376.2999999523163,"domainLookupStart":376.2999999523163,"fetchStart":357.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":376.5,"responseEnd":387.7000000476837,"responseStart":387,"secureConnectionStart":376.2999999523163},{"duration":34.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":358.7999999523163,"connectEnd":358.7999999523163,"connectStart":358.7999999523163,"domainLookupEnd":358.7999999523163,"domainLookupStart":358.7999999523163,"fetchStart":358.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":382.09999990463257,"responseEnd":393.39999985694885,"responseStart":392.2999999523163,"secureConnectionStart":358.7999999523163},{"duration":201.20000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":640.0999999046326,"connectEnd":640.0999999046326,"connectStart":640.0999999046326,"domainLookupEnd":640.0999999046326,"domainLookupStart":640.0999999046326,"fetchStart":640.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":791.2999999523163,"responseEnd":841.2999999523163,"responseStart":840.3999998569489,"secureConnectionStart":640.0999999046326},{"duration":158.90000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":866.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":866.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1025.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":84.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":885.7000000476837,"connectEnd":885.7000000476837,"connectStart":885.7000000476837,"domainLookupEnd":885.7000000476837,"domainLookupStart":885.7000000476837,"fetchStart":885.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":923.2000000476837,"responseEnd":970.2999999523163,"responseStart":969.5,"secureConnectionStart":885.7000000476837}],"fetchStart":0,"domainLookupStart":3,"domainLookupEnd":122,"connectStart":122,"connectEnd":143,"secureConnectionStart":131,"requestStart":143,"responseStart":339,"responseEnd":358,"domLoading":343,"domInteractive":1051,"domContentLoadedEventStart":1051,"domContentLoadedEventEnd":1097,"domComplete":1339,"loadEventStart":1339,"loadEventEnd":1340,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1030.7999999523163},{"name":"bigPipe.sidebar-id.end","time":1031.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1031.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":1034.2000000476837},{"name":"activityTabFullyLoaded","time":1106.3999998569489}],"measures":[],"correlationId":"4916ac0b599447","effectiveType":"4g","downlink":9.9,"rtt":0,"serverDuration":115,"dbReadsTimeInMs":14,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}