Fix: column_conv type inference set wrong collation_level

This commit is contained in:
yaojing624
2023-09-14 09:10:24 +00:00
committed by ob-robot
parent 94dc17a7f8
commit 8915b19f61
3 changed files with 20 additions and 3 deletions

View File

@ -6208,6 +6208,19 @@ bool ObRawExprUtils::is_same_column_ref(const ObRawExpr *column_ref1, const ObRa
return bret;
}
ObCollationLevel ObRawExprUtils::get_column_collation_level(const common::ObObjType &type)
{
if (ob_is_string_type(type)
|| ob_is_enumset_tc(type)
|| ob_is_json_tc(type)
|| ob_is_geometry_tc(type)) {
return CS_LEVEL_IMPLICIT;
} else {
return CS_LEVEL_NUMERIC;
}
}
int ObRawExprUtils::init_column_expr(const ObColumnSchemaV2 &column_schema, ObColumnRefRawExpr &column_expr)
{
int ret = OB_SUCCESS;
@ -6228,11 +6241,11 @@ int ObRawExprUtils::init_column_expr(const ObColumnSchemaV2 &column_schema, ObCo
|| ob_is_json_tc(column_schema.get_data_type())
|| ob_is_geometry_tc(column_schema.get_data_type())) {
column_expr.set_collation_type(column_schema.get_collation_type());
column_expr.set_collation_level(CS_LEVEL_IMPLICIT);
} else {
column_expr.set_collation_type(CS_TYPE_BINARY);
column_expr.set_collation_level(CS_LEVEL_NUMERIC);
}
// extract set collation level for reuse
column_expr.set_collation_level(get_column_collation_level(column_schema.get_data_type()));
if (OB_SUCC(ret)) {
column_expr.set_accuracy(accuracy);

View File

@ -798,6 +798,7 @@ public:
int64_t project_index,
ObAliasRefRawExpr *&alias_expr);
static int init_column_expr(const share::schema::ObColumnSchemaV2 &column_schema, ObColumnRefRawExpr &column_expr);
static ObCollationLevel get_column_collation_level(const common::ObObjType &type);
/* 计算基本列的flag */
static uint32_t calc_column_result_flag(const share::schema::ObColumnSchemaV2 &column_schema);
static int expr_is_order_consistent(const ObRawExpr *from, const ObRawExpr *to, bool &is_consistent);