提交 1fdbd2a9 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Improve readability of ResultTempTable.createIndex()

上级 1fccc783
......@@ -90,36 +90,33 @@ public class ResultTempTable implements ResultExternal {
}
private void createIndex() {
IndexColumn[] indexCols = null;
IndexColumn[] indexCols;
if (sort != null) {
int[] colIndex = sort.getQueryColumnIndexes();
int len = colIndex.length;
int totalLen;
BitSet used;
if (distinct) {
totalLen = columnCount;
used = new BitSet();
} else {
totalLen = len;
used = null;
}
indexCols = new IndexColumn[totalLen];
BitSet used = new BitSet();
indexCols = new IndexColumn[columnCount];
for (int i = 0; i < len; i++) {
int idx = colIndex[i];
if (used != null) {
used.set(idx);
}
IndexColumn indexColumn = createIndexColumn(idx);
indexColumn.sortType = sort.getSortTypes()[i];
indexCols[i] = indexColumn;
}
if (used != null) {
int idx = 0;
for (int i = len; i < totalLen; i++) {
for (int i = len; i < columnCount; i++) {
idx = used.nextClearBit(idx);
indexCols[i] = createIndexColumn(idx);
idx++;
}
} else {
indexCols = new IndexColumn[len];
for (int i = 0; i < len; i++) {
IndexColumn indexColumn = createIndexColumn(colIndex[i]);
indexColumn.sortType = sort.getSortTypes()[i];
indexCols[i] = indexColumn;
}
}
} else {
indexCols = new IndexColumn[columnCount];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论