mirror of https://github.com/citusdata/citus.git
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
parent
b2a7bafcc4
commit
3b12556401
|
@ -14,8 +14,10 @@
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "citus_version.h"
|
#include "citus_version.h"
|
||||||
#include "columnar/columnar.h"
|
|
||||||
#include "common/pg_lzcompress.h"
|
#include "common/pg_lzcompress.h"
|
||||||
|
#include "lib/stringinfo.h"
|
||||||
|
|
||||||
|
#include "columnar/columnar_compression.h"
|
||||||
|
|
||||||
#if HAVE_LIBLZ4
|
#if HAVE_LIBLZ4
|
||||||
#include <lz4.h>
|
#include <lz4.h>
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
#include "optimizer/restrictinfo.h"
|
#include "optimizer/restrictinfo.h"
|
||||||
#include "utils/relcache.h"
|
#include "utils/relcache.h"
|
||||||
|
|
||||||
#include "columnar/columnar.h"
|
|
||||||
#include "columnar/columnar_customscan.h"
|
#include "columnar/columnar_customscan.h"
|
||||||
|
#include "columnar/columnar_metadata.h"
|
||||||
#include "columnar/columnar_tableam.h"
|
#include "columnar/columnar_tableam.h"
|
||||||
|
|
||||||
typedef struct ColumnarScanPath
|
typedef struct ColumnarScanPath
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
*
|
*
|
||||||
* Type and function declarations for Columnar
|
* Type and function declarations for Columnar
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016, Citus Data, Inc.
|
* Copyright (c) Citus Data, Inc.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +22,9 @@
|
||||||
#include "utils/relcache.h"
|
#include "utils/relcache.h"
|
||||||
#include "utils/snapmgr.h"
|
#include "utils/snapmgr.h"
|
||||||
|
|
||||||
|
#include "columnar/columnar_compression.h"
|
||||||
|
#include "columnar/columnar_metadata.h"
|
||||||
|
|
||||||
/* Defines for valid option names */
|
/* Defines for valid option names */
|
||||||
#define OPTION_NAME_COMPRESSION_TYPE "compression"
|
#define OPTION_NAME_COMPRESSION_TYPE "compression"
|
||||||
#define OPTION_NAME_STRIPE_ROW_COUNT "stripe_row_limit"
|
#define OPTION_NAME_STRIPE_ROW_COUNT "stripe_row_limit"
|
||||||
|
@ -47,19 +48,6 @@
|
||||||
#define COLUMNAR_POSTSCRIPT_SIZE_MAX 256
|
#define COLUMNAR_POSTSCRIPT_SIZE_MAX 256
|
||||||
#define COLUMNAR_BYTES_PER_PAGE (BLCKSZ - SizeOfPageHeaderData)
|
#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
|
* 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,
|
* a columnar table. To resolve these values, we first check foreign table's options,
|
||||||
|
@ -86,22 +74,6 @@ typedef struct ColumnarTableDDLContext
|
||||||
} 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. */
|
/* ColumnChunkSkipNode contains statistics for a ColumnChunkData. */
|
||||||
typedef struct ColumnChunkSkipNode
|
typedef struct ColumnChunkSkipNode
|
||||||
{
|
{
|
||||||
|
@ -254,12 +226,6 @@ extern ChunkData * CreateEmptyChunkData(uint32 columnCount, bool *columnMask,
|
||||||
uint32 chunkGroupRowCount);
|
uint32 chunkGroupRowCount);
|
||||||
extern void FreeChunkData(ChunkData *chunkData);
|
extern void FreeChunkData(ChunkData *chunkData);
|
||||||
extern uint64 ColumnarTableRowCount(Relation relation);
|
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);
|
extern const char * CompressionTypeStr(CompressionType type);
|
||||||
|
|
||||||
/* columnar_metadata_tables.c */
|
/* columnar_metadata_tables.c */
|
||||||
|
@ -274,7 +240,6 @@ extern bool IsColumnarTableAmTable(Oid relationId);
|
||||||
|
|
||||||
/* columnar_metadata_tables.c */
|
/* columnar_metadata_tables.c */
|
||||||
extern void DeleteMetadataRows(RelFileNode relfilenode);
|
extern void DeleteMetadataRows(RelFileNode relfilenode);
|
||||||
extern List * StripesForRelfilenode(RelFileNode relfilenode);
|
|
||||||
extern uint64 GetHighestUsedAddress(RelFileNode relfilenode);
|
extern uint64 GetHighestUsedAddress(RelFileNode relfilenode);
|
||||||
extern StripeMetadata ReserveStripe(Relation rel, uint64 size,
|
extern StripeMetadata ReserveStripe(Relation rel, uint64 size,
|
||||||
uint64 rowCount, uint64 columnCount,
|
uint64 rowCount, uint64 columnCount,
|
||||||
|
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -4,9 +4,7 @@
|
||||||
*
|
*
|
||||||
* Compatibility macros for writing code agnostic to PostgreSQL versions
|
* Compatibility macros for writing code agnostic to PostgreSQL versions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018, Citus Data, Inc.
|
* Copyright (c) Citus Data, Inc.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
*
|
*
|
||||||
* Type and function declarations for columnar
|
* Type and function declarations for columnar
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016, Citus Data, Inc.
|
* Copyright (c) Citus Data, Inc.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue