bugfix: lnnvl raw expr printer

This commit is contained in:
obdev 2023-09-01 04:44:17 +00:00 committed by ob-robot
parent 9a3e84dc86
commit 4c232da560
3 changed files with 37 additions and 1 deletions

View File

@ -2923,7 +2923,11 @@ int ObRawExprPrinter::print(ObSysFunRawExpr *expr)
break;
}
case T_FUN_SYS_LNNVL: {
DATA_PRINTF("(%.*s", LEN_AND_PTR(func_name));
if (lib::is_oracle_mode()) {
DATA_PRINTF("(%.*s", LEN_AND_PTR(func_name));
} else {
DATA_PRINTF("%.*s(", LEN_AND_PTR(func_name));
}
if (1 != expr->get_param_count()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("param count should be equal 1", K(ret), K(expr->get_param_count()));

View File

@ -35,3 +35,26 @@ select lnnvl('abc') from dual;
| 1 |
+--------------+
drop view if exists v1;
create view v1 as select lnnvl(1) from dual;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW `v1` AS select lnnvl(1) AS `lnnvl(1)` utf8mb4 utf8mb4_general_ci
explain select * from v1;
Query Plan
==========================================
|ID|OPERATOR |NAME|EST.ROWS|EST.TIME(us)|
------------------------------------------
|0 |EXPRESSION| |1 |1 |
==========================================
Outputs & filters:
-------------------------------------
0 - output([lnnvl(cast(1, TINYINT(-1, 0)))]), filter(nil)
values({lnnvl(cast(1, TINYINT(-1, 0)))})
select * from v1;
+----------+
| lnnvl(1) |
+----------+
| 0 |
+----------+
drop view v1;

View File

@ -19,5 +19,14 @@ select lnnvl(0) from dual;
select lnnvl(NULL) from dual;
select lnnvl('abc') from dual;
--disable_warnings
drop view if exists v1;
--enable_warnings
create view v1 as select lnnvl(1) from dual;
show create view v1;
explain select * from v1;
select * from v1;
drop view v1;
connection syscon;
--sleep 2