Skip to content

Commit

Permalink
Rename column description struct used during decompression
Browse files Browse the repository at this point in the history
Rename DecompressChunkColumnDescription to
CompressionColumnDescription to reflect that this type is decoupled
from DecompressChunkState.
  • Loading branch information
erimatnor committed Dec 8, 2023
1 parent 1252b76 commit aacc6b5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
7 changes: 3 additions & 4 deletions tsl/src/nodes/decompress_chunk/compressed_batch.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "debug_assert.h"
#include "guc.h"
#include "nodes/decompress_chunk/compressed_batch.h"
#include "nodes/decompress_chunk/exec.h"
#include "nodes/decompress_chunk/vector_predicates.h"

/*
Expand Down Expand Up @@ -81,7 +80,7 @@ make_single_value_arrow(Oid pgtype, Datum datum, bool isnull)
static void
decompress_column(DecompressContext *dcontext, DecompressBatchState *batch_state, int i)
{
DecompressChunkColumnDescription *column_description = &dcontext->template_columns[i];
CompressionColumnDescription *column_description = &dcontext->template_columns[i];
CompressedColumnValues *column_values = &batch_state->compressed_columns[i];
column_values->iterator = NULL;
column_values->arrow = NULL;
Expand Down Expand Up @@ -230,7 +229,7 @@ compute_vector_quals(DecompressContext *dcontext, DecompressBatchState *batch_st
* Find the compressed column referred to by the Var.
*/
Var *var = castNode(Var, linitial(args));
DecompressChunkColumnDescription *column_description = NULL;
CompressionColumnDescription *column_description = NULL;
int column_index = 0;
for (; column_index < dcontext->num_total_columns; column_index++)
{
Expand Down Expand Up @@ -441,7 +440,7 @@ compressed_batch_set_compressed_tuple(DecompressContext *dcontext,

for (int i = 0; i < dcontext->num_total_columns; i++)
{
DecompressChunkColumnDescription *column_description = &dcontext->template_columns[i];
CompressionColumnDescription *column_description = &dcontext->template_columns[i];

switch (column_description->type)
{
Expand Down
2 changes: 1 addition & 1 deletion tsl/src/nodes/decompress_chunk/compressed_batch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

#include "compression/compression.h"
#include "nodes/decompress_chunk/exec.h"
#include "nodes/decompress_chunk/decompress_context.h"

typedef struct ArrowArray ArrowArray;

Expand Down
12 changes: 6 additions & 6 deletions tsl/src/nodes/decompress_chunk/decompress_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@

#include "batch_array.h"

typedef enum DecompressChunkColumnType
typedef enum CompressionColumnType
{
SEGMENTBY_COLUMN,
COMPRESSED_COLUMN,
COUNT_COLUMN,
SEQUENCE_NUM_COLUMN,
} DecompressChunkColumnType;
} CompressionColumnType;

typedef struct DecompressChunkColumnDescription
typedef struct CompressionColumnDescription
{
DecompressChunkColumnType type;
CompressionColumnType type;
Oid typid;
int value_bytes;

Expand All @@ -42,11 +42,11 @@ typedef struct DecompressChunkColumnDescription
AttrNumber compressed_scan_attno;

bool bulk_decompression_supported;
} DecompressChunkColumnDescription;
} CompressionColumnDescription;

typedef struct DecompressContext
{
DecompressChunkColumnDescription *template_columns;
CompressionColumnDescription *template_columns;
int num_total_columns;
int num_compressed_columns;
List *vectorized_quals_constified;
Expand Down
10 changes: 5 additions & 5 deletions tsl/src/nodes/decompress_chunk/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ decompress_chunk_begin(CustomScanState *node, EState *estate, int eflags)
Assert(num_compressed <= num_total);
dcontext->num_compressed_columns = num_compressed;
dcontext->num_total_columns = num_total;
dcontext->template_columns = palloc0(sizeof(DecompressChunkColumnDescription) * num_total);
dcontext->template_columns = palloc0(sizeof(CompressionColumnDescription) * num_total);
dcontext->decompressed_slot = node->ss.ss_ScanTupleSlot;
dcontext->ps = &node->ss.ps;

Expand All @@ -277,7 +277,7 @@ decompress_chunk_begin(CustomScanState *node, EState *estate, int eflags)
for (int compressed_index = 0; compressed_index < list_length(chunk_state->decompression_map);
compressed_index++)
{
DecompressChunkColumnDescription column = {
CompressionColumnDescription column = {
.compressed_scan_attno = AttrOffsetGetAttrNumber(compressed_index),
.output_attno = list_nth_int(chunk_state->decompression_map, compressed_index),
.bulk_decompression_supported =
Expand Down Expand Up @@ -360,7 +360,7 @@ decompress_chunk_begin(CustomScanState *node, EState *estate, int eflags)
{
for (int i = 0; i < num_total; i++)
{
DecompressChunkColumnDescription *column = &dcontext->template_columns[i];
CompressionColumnDescription *column = &dcontext->template_columns[i];
if (column->bulk_decompression_supported)
{
/* Values array, with 64 element padding (actually we have less). */
Expand Down Expand Up @@ -488,7 +488,7 @@ perform_vectorized_sum_int4(DecompressChunkState *chunk_state, Aggref *aggref)
/* Two columns are decompressed, the column that needs to be aggregated and the count column */
Assert(dcontext->num_total_columns == 2);

DecompressChunkColumnDescription *column_description = &dcontext->template_columns[0];
CompressionColumnDescription *column_description = &dcontext->template_columns[0];
Assert(dcontext->template_columns[1].type == COUNT_COLUMN);

/* Get a free batch slot */
Expand Down Expand Up @@ -529,7 +529,7 @@ perform_vectorized_sum_int4(DecompressChunkState *chunk_state, Aggref *aggref)
* To calculate the sum for a segment by value, we need to multiply the value of the segment
* by column with the number of compressed tuples in this batch.
*/
DecompressChunkColumnDescription *column_description_count = &dcontext->template_columns[1];
CompressionColumnDescription *column_description_count = &dcontext->template_columns[1];

while (true)
{
Expand Down

0 comments on commit aacc6b5

Please sign in to comment.