diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Metadata.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Metadata.php index d33f6f7bb..1df9e65b0 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Metadata.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Metadata.php @@ -24,8 +24,8 @@ public static function fromThrift(FileMetaData $thrift, Options $options) : self return new self( Schema::fromThrift($thrift->schema), RowGroups::fromThrift($thrift->row_groups, $options), - $thrift->num_rows, - $thrift->version, + (int) $thrift->num_rows, + (int) $thrift->version, $thrift->created_by ); } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeader.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeader.php index 84e80e70f..fb9b294b0 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeader.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeader.php @@ -22,7 +22,7 @@ public static function fromThrift(\Flow\Parquet\ThriftModel\DataPageHeader $thri Encodings::from($thrift->encoding), Encodings::from($thrift->repetition_level_encoding), Encodings::from($thrift->definition_level_encoding), - $thrift->num_values + (int) $thrift->num_values ); } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeaderV2.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeaderV2.php index b58979472..2ed4449c5 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeaderV2.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DataPageHeaderV2.php @@ -25,12 +25,12 @@ public function __construct( public static function fromThrift(\Flow\Parquet\ThriftModel\DataPageHeaderV2 $thrift, Options $options) : self { return new self( - $thrift->num_values, - $thrift->num_nulls, - $thrift->num_rows, + (int) $thrift->num_values, + (int) $thrift->num_nulls, + (int) $thrift->num_rows, Encodings::from($thrift->encoding), - $thrift->definition_levels_byte_length, - $thrift->repetition_levels_byte_length, + (int) $thrift->definition_levels_byte_length, + (int) $thrift->repetition_levels_byte_length, /** @phpstan-ignore-next-line */ $thrift->is_compressed ?? null, $thrift->statistics ? Statistics::fromThrift($thrift->statistics) : null, diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DictionaryPageHeader.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DictionaryPageHeader.php index 74787d0f4..1149bd6d2 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DictionaryPageHeader.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/Header/DictionaryPageHeader.php @@ -18,7 +18,7 @@ public static function fromThrift(\Flow\Parquet\ThriftModel\DictionaryPageHeader { return new self( Encodings::from($thrift->encoding), - $thrift->num_values + (int) $thrift->num_values ); } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/PageHeader.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/PageHeader.php index c53cc2e65..271968b5b 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/PageHeader.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Page/PageHeader.php @@ -24,8 +24,8 @@ public static function fromThrift(\Flow\Parquet\ThriftModel\PageHeader $thrift, { return new self( Type::from($thrift->type), - $thrift->compressed_page_size, - $thrift->uncompressed_page_size, + (int) $thrift->compressed_page_size, + (int) $thrift->uncompressed_page_size, $thrift->data_page_header !== null ? DataPageHeader::fromThrift($thrift->data_page_header) : null, $thrift->data_page_header_v2 !== null ? DataPageHeaderV2::fromThrift($thrift->data_page_header_v2, $options) : null, $thrift->dictionary_page_header !== null ? DictionaryPageHeader::fromThrift($thrift->dictionary_page_header) : null diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup.php index d9cc451e4..42ca9c457 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup.php @@ -25,7 +25,7 @@ public static function fromThrift(\Flow\Parquet\ThriftModel\RowGroup $thrift, Op { return new self( \array_map(static fn (\Flow\Parquet\ThriftModel\ColumnChunk $columnChunk) => ColumnChunk::fromThrift($columnChunk, $options), $thrift->columns), - $thrift->num_rows + (int) $thrift->num_rows ); } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php index 3918ce941..876771976 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/RowGroup/ColumnChunk.php @@ -46,15 +46,15 @@ public static function fromThrift(\Flow\Parquet\ThriftModel\ColumnChunk $thrift, return new self( PhysicalType::from($thrift->meta_data->type), Compressions::from($thrift->meta_data->codec), - $thrift->meta_data->num_values, - $thrift->file_offset, + (int) $thrift->meta_data->num_values, + (int) $thrift->file_offset, $thrift->meta_data->path_in_schema, \array_map(static fn ($encoding) => Encodings::from($encoding), $thrift->meta_data->encodings), - $thrift->meta_data->total_compressed_size, - $thrift->meta_data->total_uncompressed_size, - $thrift->meta_data->dictionary_page_offset, - $thrift->meta_data->data_page_offset, - $thrift->meta_data->index_page_offset, + (int) $thrift->meta_data->total_compressed_size, + (int) $thrift->meta_data->total_uncompressed_size, + $thrift->meta_data->dictionary_page_offset !== null ? (int) $thrift->meta_data->dictionary_page_offset : null, + $thrift->meta_data->data_page_offset !== null ? (int) $thrift->meta_data->data_page_offset : null, + $thrift->meta_data->index_page_offset !== null ? (int) $thrift->meta_data->index_page_offset : null, $thrift->meta_data->statistics ? Statistics::fromThrift($thrift->meta_data->statistics) : null, $options ); diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php index be4f522d1..9981468be 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/FlatColumn.php @@ -95,9 +95,9 @@ public static function fromThrift(SchemaElement $thrift) : self $thrift->converted_type === null ? null : ConvertedType::from($thrift->converted_type), $thrift->logicalType === null ? null : LogicalType::fromThrift($thrift->logicalType), $thrift->repetition_type === null ? null : Repetition::from($thrift->repetition_type), - $thrift->precision, - $thrift->scale, - $thrift->type_length, + $thrift->precision !== null ? (int) $thrift->precision : null, + $thrift->scale !== null ? (int) $thrift->scale : null, + $thrift->type_length !== null ? (int) $thrift->type_length : null, ); } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/LogicalType/Decimal.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/LogicalType/Decimal.php index e497ba512..e52bfb362 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/LogicalType/Decimal.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/LogicalType/Decimal.php @@ -17,8 +17,8 @@ public function __construct( public static function fromThrift(DecimalType $thrift) : self { return new self( - $thrift->scale, - $thrift->precision + (int) $thrift->scale, + (int) $thrift->precision ); } diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Statistics.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Statistics.php index b7214b41e..d77deb61e 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Statistics.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Statistics.php @@ -24,8 +24,8 @@ public static function fromThrift(\Flow\Parquet\ThriftModel\Statistics $thrift) return new self( $thrift->max, $thrift->min, - $thrift->null_count, - $thrift->distinct_count, + $thrift->null_count !== null ? (int) $thrift->null_count : null, + $thrift->distinct_count !== null ? (int) $thrift->distinct_count : null, $thrift->max_value, $thrift->min_value, $thrift->is_max_value_exact,