mirror of https://github.com/citusdata/citus.git
commit
8909769975
4
Makefile
4
Makefile
|
@ -25,7 +25,7 @@ else
|
|||
$(error version $(VER) is not supported)
|
||||
endif
|
||||
|
||||
PG_CFLAGS = -std=c11 -Wshadow
|
||||
PG_CFLAGS = -std=c11 -Wshadow -Werror
|
||||
OBJS = cstore.o cstore_writer.o cstore_reader.o \
|
||||
cstore_compression.o mod.o cstore_metadata_tables.o
|
||||
|
||||
|
@ -40,7 +40,7 @@ EXTRA_CLEAN = sql/fdw_block_filtering.sql sql/fdw_create.sql sql/fdw_data_types.
|
|||
sql/fdw_copyto.sql expected/fdw_block_filtering.out expected/fdw_create.out \
|
||||
expected/fdw_data_types.out expected/fdw_load.out expected/fdw_copyto.out \
|
||||
sql/am_block_filtering.sql sql/am_create.sql sql/am_data_types.sql sql/am_load.sql \
|
||||
sql/am_copyto.sql expected/am_block_filtering.out expected/am_create.out \
|
||||
sql/am_copyto.sql expected/am_block_filtering.out \
|
||||
expected/am_data_types.out expected/am_load.out expected/am_copyto.out
|
||||
|
||||
ifeq ($(USE_FDW),yes)
|
||||
|
|
|
@ -133,6 +133,8 @@ static void
|
|||
CStoreSetRelPathlistHook(PlannerInfo *root, RelOptInfo *rel, Index rti,
|
||||
RangeTblEntry *rte)
|
||||
{
|
||||
Relation relation;
|
||||
|
||||
/* call into previous hook if assigned */
|
||||
if (PreviousSetRelPathlistHook)
|
||||
{
|
||||
|
@ -156,13 +158,14 @@ CStoreSetRelPathlistHook(PlannerInfo *root, RelOptInfo *rel, Index rti,
|
|||
* If that is the case we want to insert an extra path that pushes down the projection
|
||||
* into the scan of the table to minimize the data read.
|
||||
*/
|
||||
Relation relation = RelationIdGetRelation(rte->relid);
|
||||
relation = RelationIdGetRelation(rte->relid);
|
||||
if (relation->rd_tableam == GetCstoreTableAmRoutine())
|
||||
{
|
||||
Path *customPath = CreateCStoreScanPath(rel, rte);
|
||||
|
||||
ereport(DEBUG1, (errmsg("pathlist hook for cstore table am")));
|
||||
|
||||
/* we propose a new path that will be the only path for scanning this relation */
|
||||
Path *customPath = CreateCStoreScanPath(rel, rte);
|
||||
clear_paths(rel);
|
||||
add_path(rel, customPath);
|
||||
}
|
||||
|
@ -175,17 +178,19 @@ CreateCStoreScanPath(RelOptInfo *rel, RangeTblEntry *rte)
|
|||
{
|
||||
CStoreScanPath *cspath = (CStoreScanPath *) newNode(sizeof(CStoreScanPath),
|
||||
T_CustomPath);
|
||||
CustomPath *cpath;
|
||||
Path *path;
|
||||
|
||||
/*
|
||||
* popuate custom path information
|
||||
*/
|
||||
CustomPath *cpath = &cspath->custom_path;
|
||||
cpath = &cspath->custom_path;
|
||||
cpath->methods = &CStoreScanPathMethods;
|
||||
|
||||
/*
|
||||
* populate generic path information
|
||||
*/
|
||||
Path *path = &cpath->path;
|
||||
path = &cpath->path;
|
||||
path->pathtype = T_CustomScan;
|
||||
path->parent = rel;
|
||||
path->pathtarget = rel->reltarget;
|
||||
|
@ -212,12 +217,13 @@ CStoreScanCost(RangeTblEntry *rte)
|
|||
{
|
||||
Relation rel = RelationIdGetRelation(rte->relid);
|
||||
DataFileMetadata *metadata = ReadDataFileMetadata(rel->rd_node.relNode, false);
|
||||
RelationClose(rel);
|
||||
rel = NULL;
|
||||
|
||||
uint32 maxColumnCount = 0;
|
||||
uint64 totalStripeSize = 0;
|
||||
ListCell *stripeMetadataCell = NULL;
|
||||
|
||||
RelationClose(rel);
|
||||
rel = NULL;
|
||||
|
||||
foreach(stripeMetadataCell, metadata->stripeMetadataList)
|
||||
{
|
||||
StripeMetadata *stripeMetadata = (StripeMetadata *) lfirst(stripeMetadataCell);
|
||||
|
@ -225,12 +231,13 @@ CStoreScanCost(RangeTblEntry *rte)
|
|||
maxColumnCount = Max(maxColumnCount, stripeMetadata->columnCount);
|
||||
}
|
||||
|
||||
Bitmapset *attr_needed = rte->selectedCols;
|
||||
double numberOfColumnsRead = bms_num_members(attr_needed);
|
||||
double selectionRatio = numberOfColumnsRead / (double) maxColumnCount;
|
||||
Cost scanCost = (double) totalStripeSize / BLCKSZ * selectionRatio;
|
||||
|
||||
return scanCost;
|
||||
{
|
||||
Bitmapset *attr_needed = rte->selectedCols;
|
||||
double numberOfColumnsRead = bms_num_members(attr_needed);
|
||||
double selectionRatio = numberOfColumnsRead / (double) maxColumnCount;
|
||||
Cost scanCost = (double) totalStripeSize / BLCKSZ * selectionRatio;
|
||||
return scanCost;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -244,6 +244,7 @@ cstore_beginscan_extended(Relation relation, Snapshot snapshot,
|
|||
List *columnList = NIL;
|
||||
List *neededColumnList = NIL;
|
||||
MemoryContext oldContext = MemoryContextSwitchTo(GetCStoreMemoryContext());
|
||||
ListCell *columnCell = NULL;
|
||||
|
||||
scan->cs_base.rs_rd = relation;
|
||||
scan->cs_base.rs_snapshot = snapshot;
|
||||
|
@ -255,7 +256,6 @@ cstore_beginscan_extended(Relation relation, Snapshot snapshot,
|
|||
columnList = RelationColumnList(relation);
|
||||
|
||||
/* only collect columns that we need for the scan */
|
||||
ListCell *columnCell = NULL;
|
||||
foreach(columnCell, columnList)
|
||||
{
|
||||
Var *var = castNode(Var, lfirst(columnCell));
|
||||
|
|
|
@ -336,6 +336,7 @@ WriteToSmgr(Relation rel, uint64 logicalOffset, char *data, uint32 dataLength)
|
|||
RelationOpenSmgr(rel);
|
||||
nblocks = smgrnblocks(rel->rd_smgr, MAIN_FORKNUM);
|
||||
Assert(addr.blockno < nblocks);
|
||||
(void) nblocks; /* keep compiler quiet */
|
||||
RelationCloseSmgr(rel);
|
||||
|
||||
buffer = ReadBuffer(rel, addr.blockno);
|
||||
|
|
Loading…
Reference in New Issue