| 1 |
# This test serves as rough measurement of performance of old UDF creation to ne registration |
| 2 |
# of UDFs. The other test, being functional equivalent to this is "udf_reg_3 funcs". |
| 3 |
# Run both tests with "mtr --repeat=9 --suite=service_udf_registration udf udf_reg_3_func". |
| 4 |
# Then compare the run time. Register/unregister must not be slower in average than old style. |
| 5 |
# Functional equivalence: |
| 6 |
# - Create/register 3 UDFS |
| 7 |
# - Use them in exactly same way in both tests |
| 8 |
# - DROP/unregister 3 UDFs. |
| 9 |
# - Verify, that they are not more available. |
| 10 |
# - Create/register them again. |
| 11 |
# - Use myfunc_int and myfunc_double. |
| 12 |
# - Drop/unregister myfunc_int. |
| 13 |
# - Use myfunc_int and myfunc_double (int must fail). |
| 14 |
# - Drop/unregister UDFs. |
| 15 |
|
| 16 |
# Register 3 UDFS |
| 17 |
INSTALL COMPONENT "file://component_udf_reg_3_func"; |
| 18 |
|
| 19 |
# Use them in exactly same way in both tests |
| 20 |
--error ER_CANT_INITIALIZE_UDF |
| 21 |
SELECT myfunc_double(); |
| 22 |
SELECT myfunc_double(1); |
| 23 |
SELECT myfunc_double(78654); |
| 24 |
SELECT myfunc_int(); |
| 25 |
SELECT myfunc_int(5); |
| 26 |
SELECT myfunc_int('MySQL V8.0'); |
| 27 |
|
| 28 |
CREATE TABLE t1(a INT, b INT); |
| 29 |
INSERT INTO t1 values (1,1),(2,2); |
| 30 |
SELECT myfunc_int(a AS attr_name) FROM t1; |
| 31 |
DROP TABLE t1; |
| 32 |
|
| 33 |
CREATE TABLE t1(sum int, price float(24)); |
| 34 |
INSERT INTO t1 VALUES(100, 50.00), (100, 100.00); |
| 35 |
SELECT avgcost(sum, price) from t1; |
| 36 |
DELETE from t1; |
| 37 |
INSERT INTO t1 VALUES(100, 54.33), (200, 199.99); |
| 38 |
SELECT avgcost(sum, price) from t1; |
| 39 |
DROP TABLE t1; |
| 40 |
|
| 41 |
# Unregister 3 UDFs. |
| 42 |
UNINSTALL COMPONENT "file://component_udf_reg_3_func"; |
| 43 |
|
| 44 |
# Verify, that they are not more available. |
| 45 |
--error ER_SP_DOES_NOT_EXIST |
| 46 |
SELECT myfunc_double(1); |
| 47 |
--error ER_SP_DOES_NOT_EXIST |
| 48 |
SELECT myfunc_int(1); |
| 49 |
|
| 50 |
# Register them again. |
| 51 |
INSTALL COMPONENT "file://component_udf_reg_3_func"; |
| 52 |
|
| 53 |
# Use myfunc_int and myfunc_double. |
| 54 |
SELECT myfunc_double(78654); |
| 55 |
SELECT myfunc_int(5); |
| 56 |
|
| 57 |
# Unregister myfunc_int. |
| 58 |
INSTALL COMPONENT "file://component_udf_unreg_int_func"; |
| 59 |
UNINSTALL COMPONENT "file://component_udf_unreg_int_func"; |
| 60 |
|
| 61 |
# Use myfunc_int and myfunc_double (int must fail). |
| 62 |
SELECT myfunc_double(78654); |
| 63 |
--error ER_SP_DOES_NOT_EXIST |
| 64 |
SELECT myfunc_int(5); |
| 65 |
|
| 66 |
# Unregister UDFs. |
| 67 |
UNINSTALL COMPONENT "file://component_udf_reg_3_func"; |