Columnar: cleanup (#4814)

* Columnar: fix misnamed file.

* Columnar: make compression not dependent on columnar.h.

* Columnar: rename columnar_metadata_tables.c to columnar_metadata.c.

* Columnar: make customscan not depend on columnar.h.

Co-authored-by: Jeff Davis <jefdavi@microsoft.com>
pull/4808/head
jeff-davis 2021-03-15 11:34:39 -07:00 committed by GitHub
parent b2a7bafcc4
commit 3b12556401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 76 additions and 47 deletions

View File

@ -14,8 +14,10 @@
#include "postgres.h"
#include "citus_version.h"
#include "columnar/columnar.h"
#include "common/pg_lzcompress.h"
#include "lib/stringinfo.h"
#include "columnar/columnar_compression.h"
#if HAVE_LIBLZ4
#include <lz4.h>

View File

@ -25,8 +25,8 @@
#include "optimizer/restrictinfo.h"
#include "utils/relcache.h"
#include "columnar/columnar.h"
#include "columnar/columnar_customscan.h"
#include "columnar/columnar_metadata.h"
#include "columnar/columnar_tableam.h"
typedef struct ColumnarScanPath

View File

@ -4,9 +4,7 @@
*
* Type and function declarations for Columnar
*
* Copyright (c) 2016, Citus Data, Inc.
*
* $Id$
* Copyright (c) Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/
@ -24,6 +22,9 @@
#include "utils/relcache.h"
#include "utils/snapmgr.h"
#include "columnar/columnar_compression.h"
#include "columnar/columnar_metadata.h"
/* Defines for valid option names */
#define OPTION_NAME_COMPRESSION_TYPE "compression"
#define OPTION_NAME_STRIPE_ROW_COUNT "stripe_row_limit"
@ -47,19 +48,6 @@
#define COLUMNAR_POSTSCRIPT_SIZE_MAX 256
#define COLUMNAR_BYTES_PER_PAGE (BLCKSZ - SizeOfPageHeaderData)
/* Enumaration for columnar table's compression method */
typedef enum
{
COMPRESSION_TYPE_INVALID = -1,
COMPRESSION_NONE = 0,
COMPRESSION_PG_LZ = 1,
COMPRESSION_LZ4 = 2,
COMPRESSION_ZSTD = 3,
COMPRESSION_COUNT
} CompressionType;
/*
* ColumnarOptions holds the option values to be used when reading or writing
* a columnar table. To resolve these values, we first check foreign table's options,
@ -86,22 +74,6 @@ typedef struct ColumnarTableDDLContext
} ColumnarTableDDLContext;
/*
* StripeMetadata represents information about a stripe. This information is
* stored in the metadata table "columnar.stripe".
*/
typedef struct StripeMetadata
{
uint64 fileOffset;
uint64 dataLength;
uint32 columnCount;
uint32 chunkCount;
uint32 chunkGroupRowCount;
uint64 rowCount;
uint64 id;
} StripeMetadata;
/* ColumnChunkSkipNode contains statistics for a ColumnChunkData. */
typedef struct ColumnChunkSkipNode
{
@ -254,12 +226,6 @@ extern ChunkData * CreateEmptyChunkData(uint32 columnCount, bool *columnMask,
uint32 chunkGroupRowCount);
extern void FreeChunkData(ChunkData *chunkData);
extern uint64 ColumnarTableRowCount(Relation relation);
extern bool CompressBuffer(StringInfo inputBuffer,
StringInfo outputBuffer,
CompressionType compressionType,
int compressionLevel);
extern StringInfo DecompressBuffer(StringInfo buffer, CompressionType compressionType,
uint64 decompressedSize);
extern const char * CompressionTypeStr(CompressionType type);
/* columnar_metadata_tables.c */
@ -274,7 +240,6 @@ extern bool IsColumnarTableAmTable(Oid relationId);
/* columnar_metadata_tables.c */
extern void DeleteMetadataRows(RelFileNode relfilenode);
extern List * StripesForRelfilenode(RelFileNode relfilenode);
extern uint64 GetHighestUsedAddress(RelFileNode relfilenode);
extern StripeMetadata ReserveStripe(Relation rel, uint64 size,
uint64 rowCount, uint64 columnCount,

View File

@ -0,0 +1,34 @@
/*-------------------------------------------------------------------------
*
* columnar_compression.h
*
* Type and function declarations for compression methods.
*
* Copyright (c) Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/
#ifndef COLUMNAR_COMPRESSION_H
#define COLUMNAR_COMPRESSION_H
/* Enumaration for columnar table's compression method */
typedef enum
{
COMPRESSION_TYPE_INVALID = -1,
COMPRESSION_NONE = 0,
COMPRESSION_PG_LZ = 1,
COMPRESSION_LZ4 = 2,
COMPRESSION_ZSTD = 3,
COMPRESSION_COUNT
} CompressionType;
extern bool CompressBuffer(StringInfo inputBuffer,
StringInfo outputBuffer,
CompressionType compressionType,
int compressionLevel);
extern StringInfo DecompressBuffer(StringInfo buffer, CompressionType compressionType,
uint64 decompressedSize);
#endif /* COLUMNAR_COMPRESSION_H */

View File

@ -0,0 +1,32 @@
/*-------------------------------------------------------------------------
*
* columnar_metadata.h
*
* Type and function declarations for Columnar metadata.
*
* Copyright (c) Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/
#ifndef COLUMNAR_METADATA_H
#define COLUMNAR_METADATA_H
/*
* StripeMetadata represents information about a stripe. This information is
* stored in the metadata table "columnar.stripe".
*/
typedef struct StripeMetadata
{
uint64 fileOffset;
uint64 dataLength;
uint32 columnCount;
uint32 chunkCount;
uint32 chunkGroupRowCount;
uint64 rowCount;
uint64 id;
} StripeMetadata;
extern List * StripesForRelfilenode(RelFileNode relfilenode);
#endif /* COLUMNAR_METADATA_H */

View File

@ -4,9 +4,7 @@
*
* Compatibility macros for writing code agnostic to PostgreSQL versions
*
* Copyright (c) 2018, Citus Data, Inc.
*
* $Id$
* Copyright (c) Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/

View File

@ -4,9 +4,7 @@
*
* Type and function declarations for columnar
*
* Copyright (c) 2016, Citus Data, Inc.
*
* $Id$
* Copyright (c) Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/