mirror of https://github.com/citusdata/citus.git
refactor needed attr bitmaps to accommodate system columns
parent
b0ca823b4d
commit
32421449c1
|
@ -395,12 +395,15 @@ ColumnarAttrNeeded(ScanState *ss)
|
||||||
elog(DEBUG1, "Need attribute: all");
|
elog(DEBUG1, "Need attribute: all");
|
||||||
|
|
||||||
/* all attributes are required, we don't need to add more so break*/
|
/* all attributes are required, we don't need to add more so break*/
|
||||||
attr_needed = bms_add_range(attr_needed, 0, natts - 1);
|
attr_needed = bms_add_range(attr_needed,
|
||||||
|
1 - FirstLowInvalidHeapAttributeNumber,
|
||||||
|
natts - FirstLowInvalidHeapAttributeNumber);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
elog(DEBUG1, "Need attribute: %d", var->varattno);
|
elog(DEBUG1, "Need attribute: %d", var->varattno);
|
||||||
attr_needed = bms_add_member(attr_needed, var->varattno - 1);
|
attr_needed = bms_add_member(attr_needed,
|
||||||
|
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
return attr_needed;
|
return attr_needed;
|
||||||
|
|
|
@ -146,7 +146,8 @@ columnar_beginscan(Relation relation, Snapshot snapshot,
|
||||||
int natts = relation->rd_att->natts;
|
int natts = relation->rd_att->natts;
|
||||||
|
|
||||||
/* attr_needed represents 0-indexed attribute numbers */
|
/* attr_needed represents 0-indexed attribute numbers */
|
||||||
Bitmapset *attr_needed = bms_add_range(NULL, 0, natts - 1);
|
Bitmapset *attr_needed = bms_add_range(NULL, 1 - FirstLowInvalidHeapAttributeNumber,
|
||||||
|
natts - FirstLowInvalidHeapAttributeNumber);
|
||||||
|
|
||||||
/* the columnar access method does not use the flags, they are specific to heap */
|
/* the columnar access method does not use the flags, they are specific to heap */
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
@ -436,7 +437,10 @@ columnar_index_fetch_tuple(struct IndexFetchTableData *scan,
|
||||||
|
|
||||||
/* we need all columns */
|
/* we need all columns */
|
||||||
int natts = scan->rel->rd_att->natts;
|
int natts = scan->rel->rd_att->natts;
|
||||||
Bitmapset *attr_needed = bms_add_range(NULL, 0, natts - 1);
|
Bitmapset *attr_needed = bms_add_range(NULL, 1 - FirstLowInvalidHeapAttributeNumber,
|
||||||
|
natts - FirstLowInvalidHeapAttributeNumber);
|
||||||
|
|
||||||
|
|
||||||
TupleDesc relationTupleDesc = RelationGetDescr(scan->rel);
|
TupleDesc relationTupleDesc = RelationGetDescr(scan->rel);
|
||||||
List *relationColumnList = NeededColumnsList(relationTupleDesc, attr_needed);
|
List *relationColumnList = NeededColumnsList(relationTupleDesc, attr_needed);
|
||||||
uint64 rowNumber = tid_to_row_number(*tid);
|
uint64 rowNumber = tid_to_row_number(*tid);
|
||||||
|
@ -728,7 +732,8 @@ columnar_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
|
||||||
|
|
||||||
/* we need all columns */
|
/* we need all columns */
|
||||||
int natts = OldHeap->rd_att->natts;
|
int natts = OldHeap->rd_att->natts;
|
||||||
Bitmapset *attr_needed = bms_add_range(NULL, 0, natts - 1);
|
Bitmapset *attr_needed = bms_add_range(NULL, 1 - FirstLowInvalidHeapAttributeNumber,
|
||||||
|
natts - FirstLowInvalidHeapAttributeNumber);
|
||||||
List *projectedColumnList = NeededColumnsList(sourceDesc, attr_needed);
|
List *projectedColumnList = NeededColumnsList(sourceDesc, attr_needed);
|
||||||
ColumnarReadState *readState = ColumnarBeginRead(OldHeap, sourceDesc,
|
ColumnarReadState *readState = ColumnarBeginRead(OldHeap, sourceDesc,
|
||||||
projectedColumnList,
|
projectedColumnList,
|
||||||
|
@ -770,9 +775,9 @@ NeededColumnsList(TupleDesc tupdesc, Bitmapset *attr_needed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attr_needed is 0-indexed but columnList is 1-indexed */
|
/* attr_needed is 0-indexed but columnList is 1-indexed */
|
||||||
if (bms_is_member(i, attr_needed))
|
AttrNumber varattno = tupdesc->attrs[i].attnum;
|
||||||
|
if (bms_is_member(varattno - FirstLowInvalidHeapAttributeNumber, attr_needed))
|
||||||
{
|
{
|
||||||
AttrNumber varattno = i + 1;
|
|
||||||
columnList = lappend_int(columnList, varattno);
|
columnList = lappend_int(columnList, varattno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue