Error expr: avg(ifnull( a const value, boolean value)). In removing avg and ifnull, we need add explicit cast.
This commit is contained in:
@ -1371,13 +1371,13 @@ int ObTransformSimplifyGroupby::transform_aggr_win_to_common_expr(ObSelectStmt *
|
|||||||
} else if (OB_ISNULL(param_expr)) {
|
} else if (OB_ISNULL(param_expr)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("get unexpected null", K(ret));
|
LOG_WARN("get unexpected null", K(ret));
|
||||||
} else if (OB_FAIL(ObRawExprUtils::try_add_cast_expr_above(ctx_->expr_factory_,
|
} else if (OB_FAIL(ObTransformUtils::add_cast_for_replace_if_need(*ctx_->expr_factory_,
|
||||||
ctx_->session_info_,
|
expr,
|
||||||
*param_expr,
|
param_expr,
|
||||||
expr->get_result_type(),
|
ctx_->session_info_))) {
|
||||||
new_expr))) {
|
|
||||||
LOG_WARN("try add cast expr above failed", K(ret));
|
LOG_WARN("try add cast expr above failed", K(ret));
|
||||||
}
|
}
|
||||||
|
new_expr = param_expr;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,8 +27,8 @@ Query Plan
|
|||||||
=================================================
|
=================================================
|
||||||
Outputs & filters:
|
Outputs & filters:
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
0 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=16
|
0 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, cast(1, BIGINT(20, 0)))]), filter(nil), rowset=16
|
||||||
1 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=16
|
1 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, cast(1, BIGINT(20, 0)))]), filter(nil), rowset=16
|
||||||
dop=3
|
dop=3
|
||||||
2 - output([t1.c1], [t2.c1]), filter(nil), rowset=16
|
2 - output([t1.c1], [t2.c1]), filter(nil), rowset=16
|
||||||
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
|
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
|
||||||
|
|||||||
@ -160,10 +160,12 @@ Query Plan
|
|||||||
=============================================================================
|
=============================================================================
|
||||||
Outputs & filters:
|
Outputs & filters:
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
0 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL_INT(20,
|
0 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*),
|
||||||
0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
|
DECIMAL_INT(20, 0)), DECIMAL_INT(75, 0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), BIGINT(20,
|
||||||
1 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*), DECIMAL_INT(20,
|
0)), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
|
||||||
0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
|
1 - output([INTERNAL_FUNCTION(VIEW2.teacher.name, VIEW2.teacher.subject, cast(cast(cast(cast(VIEW1.T_FUN_SUM(score.score) * cast(VIEW2.T_FUN_COUNT(*),
|
||||||
|
DECIMAL_INT(20, 0)), DECIMAL_INT(75, 0)), DECIMAL_INT(33, 0)), DECIMAL(33, 0)) / cast(cast(VIEW1.T_FUN_COUNT(score.score) * VIEW2.T_FUN_COUNT(*), BIGINT(20,
|
||||||
|
0)), DECIMAL(20, 0)), DECIMAL(15, 4)))]), filter(nil), rowset=256
|
||||||
dop=2
|
dop=2
|
||||||
2 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)], [VIEW2.teacher.name]), filter(nil), rowset=256
|
2 - output([VIEW2.T_FUN_COUNT(*)], [VIEW2.teacher.subject], [VIEW1.T_FUN_SUM(score.score)], [VIEW1.T_FUN_COUNT(score.score)], [VIEW2.teacher.name]), filter(nil), rowset=256
|
||||||
equal_conds([VIEW2.teacher.subject = VIEW1.score.subject]), other_conds(nil)
|
equal_conds([VIEW2.teacher.subject = VIEW1.score.subject]), other_conds(nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user