From f281f6fdf89ff20b277d570e3118c1c5629c566f Mon Sep 17 00:00:00 2001 From: KyleSmith19091 Date: Wed, 30 Oct 2024 09:11:39 +0200 Subject: [PATCH] add parquet serialisation empty data optimisation --- etl/parquet/stage.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etl/parquet/stage.go b/etl/parquet/stage.go index 2c7692d..be63b74 100644 --- a/etl/parquet/stage.go +++ b/etl/parquet/stage.go @@ -105,6 +105,14 @@ func (s *ParquetSerialiser[T]) Serialise(ctx context.Context, p *pipeline.Pipeli inputStruct = append(inputStruct, inValue) } + // check if there is data to serialise + if len(inputStruct) == 0 { + outChannel := make(chan []byte, 1) + outChannel <- []byte{} + close(outChannel) + return outChannel, nil + } + // get the reflection value of the input slice timeType := reflect.TypeOf(time.Time{})