[MDEV-23290] Add overloading support in MariaDB_FUNCTION_PLUGIN Created: 2020-07-25  Updated: 2023-12-22

Status: Open
Project: MariaDB Server
Component/s: Plugins
Fix Version/s: 11.5

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexey Botchkov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-4912 Data type plugin API version 1 Closed
relates to MDEV-20837 Add MariaDB_FUNCTION_PLUGIN Closed

 Description   

Under terms of MDEV-20837 we added MariaDB_FUNCTION_PLUGIN.

Every function plugin exports a Create_func object. This is the traditional way of defining functions in MySQL/MariaDB. But it has a disadvantage: it does not support function overloading.

So two plugin authors cannot create functions with the same name but different signatures, e.g.

SOME_FUNC(geometry);
SOME_FUNC(inet6);

Inside the server we already have Item_handled_func, which supports overloading through its Item_handled_func::Handler, and which is used by some functions:

  • Bit operators | & ^ << >> ~
  • bit_expr + INTERVAL
  • BIT_COUNT()
  • ADDTIME()
  • STR_TO_DATE()
  • CAST(expr AS CHAR)

For example, ADDTIME() has the following overloads:

ADDTIME(DATE or DATETIME or TIMESTAMP, any scalar type)
ADDTIME(TIME, any scalar type)
ADDTIME(Any string type, any scalar type)

Let's expose this interface to function plugins, so a function plugin exports:

  • either a traditional style Create_func object (without overloading support)
  • or a handler for Item_handled_func (with overloading support)

Generated at Thu Feb 08 09:21:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.