patch 4.0
This commit is contained in:
@ -14,10 +14,14 @@
|
||||
|
||||
#include "sql/engine/expr/ob_expr_shadow_uk_project.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
namespace sql {
|
||||
int ObExprShadowUKProject::cg_expr(ObExprCGCtx&, const ObRawExpr& raw_expr, ObExpr& rt_expr) const
|
||||
namespace sql
|
||||
{
|
||||
int ObExprShadowUKProject::cg_expr(ObExprCGCtx &,
|
||||
const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
UNUSED(raw_expr);
|
||||
@ -27,27 +31,27 @@ int ObExprShadowUKProject::cg_expr(ObExprCGCtx&, const ObRawExpr& raw_expr, ObEx
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprShadowUKProject::shadow_uk_project(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& datum)
|
||||
int ObExprShadowUKProject::shadow_uk_project(const ObExpr &expr,
|
||||
ObEvalCtx &ctx,
|
||||
ObDatum &datum)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool need_shadow_columns = false;
|
||||
if (OB_FAIL(expr.eval_param_value(ctx))) {
|
||||
LOG_WARN("evaluate parameters values failed", K(ret));
|
||||
} else if (lib::is_mysql_mode()) {
|
||||
// mysql compatible: as long as there is a null column in the unique index key,
|
||||
// the shadow column needs to be filled
|
||||
} else if (lib::is_mysql_mode()){
|
||||
// mysql兼容:只要unique index key中有null列,则需要填充shadow列
|
||||
bool rowkey_has_null = false;
|
||||
for (int64_t i = 0; !rowkey_has_null && i < expr.arg_cnt_ - 1; i++) {
|
||||
ObDatum& v = expr.locate_param_datum(ctx, i);
|
||||
ObDatum &v = expr.locate_param_datum(ctx, i);
|
||||
rowkey_has_null = v.is_null();
|
||||
}
|
||||
need_shadow_columns = rowkey_has_null;
|
||||
} else {
|
||||
// oracle compatible: only when the unique index key is all null columns,
|
||||
// the shadow column needs to be filled
|
||||
// oracle兼容:只有unique index key全为null列时,才需要填充shadow列
|
||||
bool is_rowkey_all_null = true;
|
||||
for (int64_t i = 0; is_rowkey_all_null && i < expr.arg_cnt_ - 1; i++) {
|
||||
ObDatum& v = expr.locate_param_datum(ctx, i);
|
||||
ObDatum &v = expr.locate_param_datum(ctx, i);
|
||||
is_rowkey_all_null = v.is_null();
|
||||
}
|
||||
need_shadow_columns = is_rowkey_all_null;
|
||||
@ -55,7 +59,7 @@ int ObExprShadowUKProject::shadow_uk_project(const ObExpr& expr, ObEvalCtx& ctx,
|
||||
if (!need_shadow_columns) {
|
||||
datum.set_null();
|
||||
} else {
|
||||
ObDatum& v = expr.locate_param_datum(ctx, expr.arg_cnt_ - 1);
|
||||
ObDatum &v = expr.locate_param_datum(ctx, expr.arg_cnt_ - 1);
|
||||
datum.set_datum(v);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user