Skip to content

Commit

Permalink
fix columns from fe don't has bitmap_index flag (apache#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lchangliang committed Jun 9, 2022
1 parent e9e5848 commit a287b6a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion be/src/olap/tablet_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void TabletMeta::init_column_from_tcolumn(uint32_t unique_id, const TColumn& tco
column->set_unique_id(unique_id);
column->set_col_unique_id(tcolumn.col_unique_id);
column->set_name(tcolumn.column_name);
column->set_has_bitmap_index(false);
column->set_has_bitmap_index(tcolumn.has_bitmap_index);
string data_type;
EnumToString(TPrimitiveType, tcolumn.column_type.type, data_type);
column->set_type(data_type);
Expand Down
12 changes: 12 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.doris.alter.SchemaChangeHandler;
import org.apache.doris.analysis.Expr;
import org.apache.doris.analysis.IndexDef;
import org.apache.doris.analysis.SlotRef;
import org.apache.doris.analysis.StringLiteral;
import org.apache.doris.common.AnalysisException;
Expand Down Expand Up @@ -701,4 +702,15 @@ public void setUniqueId(int colUniqueId) {
public int getUniqueId() {
return this.uniqueId;
}

public void setIndexFlag(TColumn tColumn, List<Index> indexes) {
for (Index index : indexes) {
if (index.getIndexType() == IndexDef.IndexType.BITMAP) {
List<String> columns = index.getColumns();
if (tColumn.getColumnName().equals(columns.get(0))) {
tColumn.setHasBitmapIndex(true);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,9 @@ protected void toThrift(TPlanNode msg) {
}

for (Column column : olapTable.getFullSchema()) {
columnsDesc.add(column.toThrift());
TColumn tColumn = column.toThrift();
column.setIndexFlag(tColumn, olapTable.getIndexes());
columnsDesc.add(tColumn);
}

msg.node_type = TPlanNodeType.OLAP_SCAN_NODE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.doris.common.UserException;
import org.apache.doris.system.Backend;
import org.apache.doris.system.SystemInfoService;
import org.apache.doris.thrift.TColumn;
import org.apache.doris.thrift.TDataSink;
import org.apache.doris.thrift.TDataSinkType;
import org.apache.doris.thrift.TExplainLevel;
Expand Down Expand Up @@ -193,7 +194,9 @@ private TOlapTableSchemaParam createSchema(long dbId, OlapTable table) {
}
// add columns
for (Column col : table.getFullSchema()) {
schemaParam.addToColumns(col.toThrift());
TColumn tColumn = col.toThrift();
col.setIndexFlag(tColumn, table.getIndexes());
schemaParam.addToColumns(tColumn);
}
return schemaParam;
}
Expand Down
1 change: 1 addition & 0 deletions gensrc/thrift/Descriptors.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct TColumn {
9: optional bool visible = true
10: optional list<TColumn> children_column
11: optional i32 col_unique_id = -1
12: optional bool has_bitmap_index = false
}

struct TSlotDescriptor {
Expand Down

0 comments on commit a287b6a

Please sign in to comment.