[FTS][BUG.FIX] Inconsistent error when creating fts indexe on virtual columns or different character set columns

This commit is contained in:
obdev 2025-01-06 16:15:14 +00:00 committed by ob-robot
parent b2302b6544
commit 43306e5d3b
6 changed files with 18 additions and 6 deletions

View File

@ -453,7 +453,7 @@ int ObFtsIndexBuilderUtil::adjust_fts_args(
}
}
}
FLOG_INFO("adjust fts arg finished", K(index_arg));
FLOG_INFO("adjust fts arg finished", K(ret), K(index_arg));
return ret;
}
@ -1820,9 +1820,8 @@ int ObFtsIndexBuilderUtil::check_fulltext_index_allowed(
if (OB_ISNULL(index_arg) || !data_schema.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), KPC(index_arg), K(data_schema));
} else if (!share::schema::is_fts_index_aux(index_arg->index_type_)
&& !share::schema::is_fts_doc_word_aux(index_arg->index_type_)) {
} else {
} else if (static_cast<int64_t>(ObDDLResolver::INDEX_KEYNAME::FTS_KEY) == index_arg->index_key_) {
ObCollationType collation_type = CS_TYPE_INVALID;
for (int64_t i = 0; OB_SUCC(ret) && i < index_arg->index_columns_.count(); ++i) {
const ObString &column_name = index_arg->index_columns_.at(i).column_name_;
const ObColumnSchemaV2 *col_schema = nullptr;
@ -1836,6 +1835,11 @@ int ObFtsIndexBuilderUtil::check_fulltext_index_allowed(
} else if (OB_UNLIKELY(col_schema->is_virtual_generated_column())) {
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Fulltext index on virtual generated column is");
} else if (CS_TYPE_INVALID == collation_type) {
collation_type = col_schema->get_collation_type();
} else if (collation_type != col_schema->get_collation_type()) {
ret = OB_NOT_SUPPORTED;
LOG_USER_ERROR(OB_NOT_SUPPORTED, "create fulltext index on columns with different collation");
}
}
}

View File

@ -3491,7 +3491,8 @@ OB_SERIALIZE_MEMBER((ObCreateIndexArg, ObIndexArg),
vidx_refresh_info_,
is_rebuild_index_,
is_index_scope_specified_,
is_offline_rebuild_);
is_offline_rebuild_,
index_key_);
OB_SERIALIZE_MEMBER((ObIndexOfflineDdlArg, ObDDLArg),
arg_,

View File

@ -2802,7 +2802,8 @@ public:
vidx_refresh_info_(),
is_rebuild_index_(false),
is_index_scope_specified_(false),
is_offline_rebuild_(false)
is_offline_rebuild_(false),
index_key_(-1)
{
index_action_type_ = ADD_INDEX;
index_using_type_ = share::schema::USING_BTREE;
@ -2838,6 +2839,7 @@ public:
is_rebuild_index_ = false;
is_index_scope_specified_ = false;
is_offline_rebuild_ = false;
index_key_ = -1;
}
void set_index_action_type(const IndexActionType type) { index_action_type_ = type; }
bool is_valid() const;
@ -2879,6 +2881,7 @@ public:
is_rebuild_index_ = other.is_rebuild_index_;
is_index_scope_specified_ = other.is_index_scope_specified_;
is_offline_rebuild_ = other.is_offline_rebuild_;
index_key_ = other.index_key_;
}
return ret;
}
@ -2951,6 +2954,7 @@ public:
bool is_rebuild_index_;
bool is_index_scope_specified_;
bool is_offline_rebuild_;
int64_t index_key_;
};
struct ObIndexOfflineDdlArg : ObDDLArg

View File

@ -2030,6 +2030,7 @@ int ObAlterTableResolver::resolve_add_index(const ParseNode &node)
}
}
if (OB_SUCC(ret)) {
create_index_arg->index_key_ = static_cast<int64_t>(index_keyname_);
if (OB_FAIL(resolve_results.push_back(resolve_result))) {
LOG_WARN("fail to push back index_stmt_list", K(ret),
K(resolve_result));

View File

@ -883,6 +883,7 @@ int ObCreateIndexResolver::set_table_option_to_stmt(const uint64_t data_table_id
} else {
// set type to fts_index_aux first, append other fts arg later
index_arg.index_type_ = INDEX_TYPE_FTS_INDEX_LOCAL;
index_arg.index_key_ = static_cast<int64_t>(index_keyname_);
}
} else if (MULTI_KEY == index_keyname_ || MULTI_UNIQUE_KEY == index_keyname_) {
uint64_t tenant_data_version = 0;

View File

@ -3182,6 +3182,7 @@ int ObCreateTableResolver::resolve_index_node(const ParseNode *node)
ObCreateIndexArg &create_index_arg = create_index_stmt.get_create_index_arg();
ObSArray<ObPartitionResolveResult> &resolve_results = create_table_stmt->get_index_partition_resolve_results();
ObSArray<obrpc::ObCreateIndexArg> &index_arg_list = create_table_stmt->get_index_arg_list();
index_arg_.index_key_ = static_cast<int64_t>(index_keyname_);
if (OB_FAIL(create_index_arg.assign(index_arg_))) {
LOG_WARN("fail to assign create index arg", K(ret));
} else if (is_index_part_specified) {