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":898.4000000357628,"ttfb":217.80000001192093,"pageVisibility":"visible","entityId":63278,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"b3b039b8-653a-4810-8b20-aa4fa5c2ddf1","navigationType":0,"readyForUser":979.1999999880791,"redirectCount":0,"resourceLoadedEnd":854.9000000357628,"resourceLoadedStart":223.4000000357628,"resourceTiming":[{"duration":159.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":223.4000000357628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":223.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":383.30000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":160.0999999642372,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":223.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":223.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":383.69999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":212.80000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":223.80000001192093,"connectEnd":223.80000001192093,"connectStart":223.80000001192093,"domainLookupEnd":223.80000001192093,"domainLookupStart":223.80000001192093,"fetchStart":223.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":223.80000001192093,"responseEnd":436.60000002384186,"responseStart":436.60000002384186,"secureConnectionStart":223.80000001192093},{"duration":279.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":224,"connectEnd":224,"connectStart":224,"domainLookupEnd":224,"domainLookupStart":224,"fetchStart":224,"redirectEnd":0,"redirectStart":0,"requestStart":224,"responseEnd":503.19999998807907,"responseStart":503.19999998807907,"secureConnectionStart":224},{"duration":282.9000000357628,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":224.19999998807907,"connectEnd":224.19999998807907,"connectStart":224.19999998807907,"domainLookupEnd":224.19999998807907,"domainLookupStart":224.19999998807907,"fetchStart":224.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":224.19999998807907,"responseEnd":507.10000002384186,"responseStart":507.10000002384186,"secureConnectionStart":224.19999998807907},{"duration":283.0999999642372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":224.4000000357628,"connectEnd":224.4000000357628,"connectStart":224.4000000357628,"domainLookupEnd":224.4000000357628,"domainLookupStart":224.4000000357628,"fetchStart":224.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":224.4000000357628,"responseEnd":507.5,"responseStart":507.5,"secureConnectionStart":224.4000000357628},{"duration":283.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":224.69999998807907,"connectEnd":224.69999998807907,"connectStart":224.69999998807907,"domainLookupEnd":224.69999998807907,"domainLookupStart":224.69999998807907,"fetchStart":224.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":224.69999998807907,"responseEnd":507.9000000357628,"responseStart":507.9000000357628,"secureConnectionStart":224.69999998807907},{"duration":352.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":224.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":224.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":577.4000000357628,"responseStart":0,"secureConnectionStart":0},{"duration":283.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":224.9000000357628,"connectEnd":224.9000000357628,"connectStart":224.9000000357628,"domainLookupEnd":224.9000000357628,"domainLookupStart":224.9000000357628,"fetchStart":224.9000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":224.9000000357628,"responseEnd":508.30000001192093,"responseStart":508.30000001192093,"secureConnectionStart":224.9000000357628},{"duration":352.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":225.10000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":225.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":577.5,"responseStart":0,"secureConnectionStart":0},{"duration":283.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":225.30000001192093,"connectEnd":225.30000001192093,"connectStart":225.30000001192093,"domainLookupEnd":225.30000001192093,"domainLookupStart":225.30000001192093,"fetchStart":225.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":225.30000001192093,"responseEnd":508.9000000357628,"responseStart":508.9000000357628,"secureConnectionStart":225.30000001192093},{"duration":411.69999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":226.10000002384186,"connectEnd":226.10000002384186,"connectStart":226.10000002384186,"domainLookupEnd":226.10000002384186,"domainLookupStart":226.10000002384186,"fetchStart":226.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":226.10000002384186,"responseEnd":637.8000000119209,"responseStart":637.8000000119209,"secureConnectionStart":226.10000002384186},{"duration":520.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":230.4000000357628,"connectEnd":230.4000000357628,"connectStart":230.4000000357628,"domainLookupEnd":230.4000000357628,"domainLookupStart":230.4000000357628,"fetchStart":230.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":230.4000000357628,"responseEnd":750.6999999880791,"responseStart":750.6999999880791,"secureConnectionStart":230.4000000357628},{"duration":54.80000001192093,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":588.6000000238419,"connectEnd":588.6000000238419,"connectStart":588.6000000238419,"domainLookupEnd":588.6000000238419,"domainLookupStart":588.6000000238419,"fetchStart":588.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":588.6000000238419,"responseEnd":643.4000000357628,"responseStart":643.4000000357628,"secureConnectionStart":588.6000000238419},{"duration":199.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/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","startTime":655.3000000119209,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":655.3000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":854.9000000357628,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":41,"responseStart":217,"responseEnd":222,"domLoading":221,"domInteractive":1070,"domContentLoadedEventStart":1070,"domContentLoadedEventEnd":1116,"domComplete":1479,"loadEventStart":1479,"loadEventEnd":1479,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1052.4000000357628},{"name":"bigPipe.sidebar-id.end","time":1053.199999988079},{"name":"bigPipe.activity-panel-pipe-id.start","time":1053.4000000357628},{"name":"bigPipe.activity-panel-pipe-id.end","time":1054.300000011921},{"name":"activityTabFullyLoaded","time":1132.699999988079}],"measures":[],"correlationId":"61d6c0d9b15bc0","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":112,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Pushed to bb-10.2-ext and 10.3