[MDEV-19908] Add class Type_collection Created: 2019-06-29  Updated: 2020-09-16  Resolved: 2019-06-29

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

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
blocks MDEV-19923 Add type handlers for geometry sub-types Closed

 Description   

Let's add a new class with approximately this definition:

 
class Type_collection
{
public:
  virtual ~Type_collection() {}
  virtual const Type_handler *aggregate_for_result(const Type_handler *h1,
                                                   const Type_handler *h2)
                                                   const= 0;
  virtual const Type_handler *aggregate_for_comparison(const Type_handler *h1,
                                                       const Type_handler *h2)
                                                       const= 0;
  virtual const Type_handler *aggregate_for_min_max(const Type_handler *h1,
                                                    const Type_handler *h2)
                                                    const= 0;
  virtual const Type_handler *aggregate_for_num_op(const Type_handler *h1,
                                                   const Type_handler *h2)
                                                   const= 0;
};

It will work as follows:

  • Data type plugins will provide instances of Type_collection.
  • Each Type_collection will contain one or more data types (Type_handler instances).
  • Data types from the same Type_collection will "know" each other.
  • If two data types are from the same collection, data type aggregation for various operations (i.e. result, comparson, LEAST/GREATES, numeric dyadic operators) will be delegated to their Type_collection through virtual methods.

For now there will be two collections:

  • Type_collection_geometry, containing Type_handler_geometry.
  • Type_collection_std, containing all other built-in data types.

Later, we'll split out geometry subtypes (POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION) into separate type handlers, so Type_collection_geometry will contain 8 type handlers
(the generic one, and handlers for 7 subtypes):

  • Type_handler_geometry
  • Type_handler_point
  • Type_handler_linestring
  • Type_handler_polygon
  • Type_handler_multipoint
  • Type_handler_multilinestring
  • Type_handler_multipolygon
  • Type_handler_geometrycollection

Later, we'll add Type_collection_json and will turn JSON functionality into handlers:

  • Type_handler_varchar_json
  • Type_handler_tinytext_json
  • Type_handler_text_json
  • Type_handler_mediumtext_json
  • Type_handler_longtext_json
    and remove Item::is_json_type().

Later, we'll add Type_collection_inet with two data type handlers:

  • Type_handler_inet4
  • Type_handler_inet6

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