diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroupBuilder/ColumnChunkStatistics.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroupBuilder/ColumnChunkStatistics.php index d3d57c2b1..5f71afab7 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroupBuilder/ColumnChunkStatistics.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroupBuilder/ColumnChunkStatistics.php @@ -63,16 +63,28 @@ public function add(string|int|float|null|array|bool|object $value) : void public function avgStringLength() : int { + if (0 === $this->notNullCount()) { + return 0; + } + return (int) \ceil($this->totalStringLength / $this->notNullCount()); } public function cardinalityRation() : float { + if (0 === $this->notNullCount()) { + return 0; + } + return \round($this->distinctCount() / $this->notNullCount(), 2); } public function distinctCount() : int { + if ([] === $this->values) { + return 0; + } + return \count(\array_unique($this->values)); }