[MDEV-16592] Change Item::with_sum_func from a member to a virtual method Created: 2018-06-27  Updated: 2021-05-19  Resolved: 2018-06-27

Status: Closed
Project: MariaDB Server
Component/s: Data types
Fix Version/s: 10.4.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

This task is similar to what we did earlier for Item::with_subselect (see MDEV-14517).

It's hard to track in the code which Item classes in the hierarchy:

  • have always with_sum_func==true
  • have always with_sum_func==false
  • have variable with_sum_func

Under terms of this task we'll remove the member Item::with_sum_func and add a method instead:

virtual bool with_sum_func() const { return false; }

Item_sum will override this method as follows:

bool with_sum_func() const { return true; }

Only a few Item classes need a variable "with_sum_func" value:

  • Item_ref
  • Item_cache_wrapper
  • Item_func
  • Item_row
  • Item_subselect

They'll store the "with_sum_func" value in a member, using a simple shared class With_sum_func_cache, which they will derive from.

Rationale:

  • The code will be easier to read this way (instead of searching for all possible assignments of the member with_sum_func, one can just find who overrides the method)
  • Also, Item types that do not need a variable "with_sum_func" will become potentially smaller in size (when alignment allows)


 Comments   
Comment by Oleksandr Byelkin [ 2018-06-27 ]

OK to push

Generated at Thu Feb 08 08:30:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.