use of com.pingcap.tidb.tipb.IndexInfo in project tispark by pingcap.
the class TiIndexInfo method toProto.
public IndexInfo toProto(TiTableInfo tableInfo) {
IndexInfo.Builder builder = IndexInfo.newBuilder().setTableId(tableInfo.getId()).setIndexId(id).setUnique(isUnique);
List<TiColumnInfo> columns = tableInfo.getColumns();
for (TiIndexColumn indexColumn : getIndexColumns()) {
int offset = indexColumn.getOffset();
TiColumnInfo column = columns.get(offset);
builder.addColumns(column.toProto(tableInfo));
}
if (tableInfo.isPkHandle()) {
for (TiColumnInfo column : columns) {
if (!column.isPrimaryKey()) {
continue;
}
ColumnInfo pbColumn = column.toProto(tableInfo);
builder.addColumns(pbColumn);
}
}
return builder.build();
}
use of com.pingcap.tidb.tipb.IndexInfo in project client-java by tikv.
the class TiIndexInfo method toProto.
public IndexInfo toProto(TiTableInfo tableInfo) {
IndexInfo.Builder builder = IndexInfo.newBuilder().setTableId(tableInfo.getId()).setIndexId(id).setUnique(isUnique);
List<org.tikv.common.meta.TiColumnInfo> columns = tableInfo.getColumns();
for (TiIndexColumn indexColumn : getIndexColumns()) {
int offset = indexColumn.getOffset();
org.tikv.common.meta.TiColumnInfo column = columns.get(offset);
builder.addColumns(column.toProto(tableInfo));
}
if (tableInfo.isPkHandle()) {
for (org.tikv.common.meta.TiColumnInfo column : columns) {
if (!column.isPrimaryKey()) {
continue;
}
ColumnInfo pbColumn = column.toProto(tableInfo);
builder.addColumns(pbColumn);
}
}
return builder.build();
}
Aggregations