[fix](inverted index) Fix inverted index for MOR unique table #31051 (#31354)

This commit is contained in:
Kang
2024-02-23 23:10:36 +08:00
committed by GitHub
parent 481517ac6a
commit db58104bc3
39 changed files with 291 additions and 59 deletions

View File

@ -224,12 +224,16 @@ public class IndexDef {
throw new AnalysisException(colType + " is not supported in " + indexType.toString() + " index. "
+ "invalid index: " + indexName);
}
if (!column.isKey()
&& ((keysType == KeysType.UNIQUE_KEYS && !enableUniqueKeyMergeOnWrite)
|| keysType == KeysType.AGG_KEYS)) {
throw new AnalysisException(indexType.toString()
+ " index only used in columns of DUP_KEYS/UNIQUE_KEYS MOW table or key columns of all table."
+ " invalid index: " + indexName);
if (!column.isKey()) {
if (keysType == KeysType.AGG_KEYS) {
throw new AnalysisException("index should only be used in columns of DUP_KEYS/UNIQUE_KEYS table"
+ " or key columns of AGG_KEYS table. invalid index: " + indexName);
} else if (keysType == KeysType.UNIQUE_KEYS && !enableUniqueKeyMergeOnWrite
&& indexType == IndexType.INVERTED && properties != null
&& properties.containsKey(InvertedIndexUtil.INVERTED_INDEX_PARSER_KEY)) {
throw new AnalysisException("INVERTED index with parser can NOT be used in value columns of"
+ " UNIQUE_KEYS table with merge_on_write disable. invalid index: " + indexName);
}
}
if (indexType == IndexType.INVERTED) {

View File

@ -525,8 +525,8 @@ public class PropertyAnalyzer {
found = true;
break;
} else {
throw new AnalysisException("Bloom filter index only used in columns of"
+ " UNIQUE_KEYS/DUP_KEYS table or key columns of AGG_KEYS table."
throw new AnalysisException("Bloom filter index should only be used in columns"
+ " of UNIQUE_KEYS/DUP_KEYS table or key columns of AGG_KEYS table."
+ " invalid column: " + bfColumn);
}
}

View File

@ -2537,10 +2537,6 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
Map<String, String> properties = visitPropertyItemList(ctx.properties);
String indexType = ctx.indexType != null ? ctx.indexType.getText().toUpperCase() : null;
String comment = ctx.comment != null ? ctx.comment.getText() : "";
// change BITMAP index to INVERTED index
if (indexType.equalsIgnoreCase("BITMAP")) {
indexType = "INVERTED";
}
return new IndexDefinition(indexName, indexCols, indexType, properties, comment);
}

View File

@ -110,12 +110,16 @@ public class IndexDefinition {
throw new AnalysisException(colType + " is not supported in " + indexType.toString()
+ " index. " + "invalid index: " + name);
}
if (!column.isKey()
&& ((keysType == KeysType.UNIQUE_KEYS && !enableUniqueKeyMergeOnWrite)
|| keysType == KeysType.AGG_KEYS)) {
throw new AnalysisException(indexType.toString()
+ " index only used in columns of DUP_KEYS/UNIQUE_KEYS MOW table or key columns of all table."
+ " invalid index: " + name);
if (!column.isKey()) {
if (keysType == KeysType.AGG_KEYS) {
throw new AnalysisException("index should only be used in columns of DUP_KEYS/UNIQUE_KEYS table"
+ " or key columns of AGG_KEYS table. invalid index: " + name);
} else if (keysType == KeysType.UNIQUE_KEYS && !enableUniqueKeyMergeOnWrite
&& indexType == IndexType.INVERTED && properties != null
&& properties.containsKey(InvertedIndexUtil.INVERTED_INDEX_PARSER_KEY)) {
throw new AnalysisException("INVERTED index with parser can NOT be used in value columns of"
+ " UNIQUE_KEYS table with merge_on_write disable. invalid index: " + name);
}
}
if (indexType == IndexType.INVERTED) {