more fixes

merge-cstore-pykello
Jeff Davis 2020-09-15 17:30:19 -07:00
parent 18f6829621
commit 83f2d4aef2
3 changed files with 23 additions and 11 deletions

View File

@ -458,7 +458,21 @@ cstore_index_validate_scan(Relation heapRelation,
static uint64 static uint64
cstore_relation_size(Relation rel, ForkNumber forkNumber) cstore_relation_size(Relation rel, ForkNumber forkNumber)
{ {
elog(ERROR, "cstore_relation_size not implemented"); uint64 nblocks = 0;
/* Open it at the smgr level if not already done */
RelationOpenSmgr(rel);
/* InvalidForkNumber indicates returning the size for all forks */
if (forkNumber == InvalidForkNumber)
{
for (int i = 0; i < MAX_FORKNUM; i++)
nblocks += smgrnblocks(rel->rd_smgr, i);
}
else
nblocks = smgrnblocks(rel->rd_smgr, forkNumber);
return nblocks * BLCKSZ;
} }
static bool static bool

View File

@ -1,15 +1,14 @@
-- --
-- Test the CREATE statements related to cstore_fdw. -- Test the CREATE statements related to cstore.
-- --
-- Validator tests
-- Create uncompressed table -- Create uncompressed table
CREATE FOREIGN TABLE contestant (handle TEXT, birthdate DATE, rating INT, CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
percentile FLOAT, country CHAR(3), achievements TEXT[]) percentile FLOAT, country CHAR(3), achievements TEXT[])
USING cstore_tableam; USING cstore_tableam;
-- Create compressed table with automatically determined file path -- Create compressed table with automatically determined file path
CREATE FOREIGN TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT, CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
percentile FLOAT, country CHAR(3), achievements TEXT[]) percentile FLOAT, country CHAR(3), achievements TEXT[])
USING cstore_tableam USING cstore_tableam;
-- Test that querying an empty table works -- Test that querying an empty table works
ANALYZE contestant; ANALYZE contestant;
SELECT count(*) FROM contestant; SELECT count(*) FROM contestant;

View File

@ -1,15 +1,14 @@
-- --
-- Test the CREATE statements related to cstore_fdw. -- Test the CREATE statements related to cstore.
-- --
-- Validator tests
-- Create uncompressed table -- Create uncompressed table
CREATE FOREIGN TABLE contestant (handle TEXT, birthdate DATE, rating INT, CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
percentile FLOAT, country CHAR(3), achievements TEXT[]) percentile FLOAT, country CHAR(3), achievements TEXT[])
USING cstore_tableam; USING cstore_tableam;
-- Create compressed table with automatically determined file path -- Create compressed table with automatically determined file path
CREATE FOREIGN TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT, CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
percentile FLOAT, country CHAR(3), achievements TEXT[]) percentile FLOAT, country CHAR(3), achievements TEXT[])
USING cstore_tableam USING cstore_tableam;
-- Test that querying an empty table works -- Test that querying an empty table works
ANALYZE contestant; ANALYZE contestant;
SELECT count(*) FROM contestant; SELECT count(*) FROM contestant;