[fix](alter inverted index) Temporary deal with add or drop inverted index by directly schema change (#18378)
In the current implementation of the function of dynamically add and drop inverted index, there is a problem that the inverted index information of historical data is out of date after compaction on the base tablet. In the future, I will submit PRs to solve this problem. Now, temporarily add or drop inverted index by the directly schema change logic
This commit is contained in:
@ -1765,7 +1765,9 @@ Status SchemaChangeHandler::_parse_request(const SchemaChangeParams& sc_params,
|
||||
column_new.frac() != column_old.frac() ||
|
||||
column_new.length() != column_old.length() ||
|
||||
column_new.is_bf_column() != column_old.is_bf_column() ||
|
||||
column_new.has_bitmap_index() != column_old.has_bitmap_index()) {
|
||||
column_new.has_bitmap_index() != column_old.has_bitmap_index() ||
|
||||
new_tablet_schema->has_inverted_index(column_new.unique_id()) !=
|
||||
base_tablet_schema->has_inverted_index(column_old.unique_id())) {
|
||||
*sc_directly = true;
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
@ -27,7 +27,6 @@ import org.apache.doris.analysis.CreateIndexClause;
|
||||
import org.apache.doris.analysis.DropColumnClause;
|
||||
import org.apache.doris.analysis.DropIndexClause;
|
||||
import org.apache.doris.analysis.IndexDef;
|
||||
import org.apache.doris.analysis.IndexDef.IndexType;
|
||||
import org.apache.doris.analysis.ModifyColumnClause;
|
||||
import org.apache.doris.analysis.ModifyTablePropertiesClause;
|
||||
import org.apache.doris.analysis.ReorderColumnsClause;
|
||||
@ -1827,32 +1826,32 @@ public class SchemaChangeHandler extends AlterHandler {
|
||||
return;
|
||||
}
|
||||
lightSchemaChange = false;
|
||||
CreateIndexClause createIndexClause = (CreateIndexClause) alterClause;
|
||||
if (createIndexClause.getIndexDef().isInvertedIndex()) {
|
||||
alterInvertedIndexes.add(createIndexClause.getIndex());
|
||||
isDropInvertedIndex = false;
|
||||
lightSchemaChangeWithInvertedIndex = true;
|
||||
}
|
||||
// CreateIndexClause createIndexClause = (CreateIndexClause) alterClause;
|
||||
// if (createIndexClause.getIndexDef().isInvertedIndex()) {
|
||||
// alterInvertedIndexes.add(createIndexClause.getIndex());
|
||||
// isDropInvertedIndex = false;
|
||||
// lightSchemaChangeWithInvertedIndex = true;
|
||||
// }
|
||||
} else if (alterClause instanceof DropIndexClause) {
|
||||
if (processDropIndex((DropIndexClause) alterClause, olapTable, newIndexes)) {
|
||||
return;
|
||||
}
|
||||
lightSchemaChange = false;
|
||||
DropIndexClause dropIndexClause = (DropIndexClause) alterClause;
|
||||
List<Index> existedIndexes = olapTable.getIndexes();
|
||||
Index found = null;
|
||||
for (Index existedIdx : existedIndexes) {
|
||||
if (existedIdx.getIndexName().equalsIgnoreCase(dropIndexClause.getIndexName())) {
|
||||
found = existedIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
IndexDef.IndexType indexType = found.getIndexType();
|
||||
if (indexType == IndexType.INVERTED) {
|
||||
alterInvertedIndexes.add(found);
|
||||
isDropInvertedIndex = true;
|
||||
lightSchemaChangeWithInvertedIndex = true;
|
||||
}
|
||||
// DropIndexClause dropIndexClause = (DropIndexClause) alterClause;
|
||||
// List<Index> existedIndexes = olapTable.getIndexes();
|
||||
// Index found = null;
|
||||
// for (Index existedIdx : existedIndexes) {
|
||||
// if (existedIdx.getIndexName().equalsIgnoreCase(dropIndexClause.getIndexName())) {
|
||||
// found = existedIdx;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// IndexDef.IndexType indexType = found.getIndexType();
|
||||
// if (indexType == IndexType.INVERTED) {
|
||||
// alterInvertedIndexes.add(found);
|
||||
// isDropInvertedIndex = true;
|
||||
// lightSchemaChangeWithInvertedIndex = true;
|
||||
// }
|
||||
} else {
|
||||
Preconditions.checkState(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user