diff --git a/src/lib/parquet/src/Flow/Parquet/Data/Converter/BytesStringConverter.php b/src/lib/parquet/src/Flow/Parquet/Data/Converter/BytesStringConverter.php index 28bfb34f2..c46678c3f 100644 --- a/src/lib/parquet/src/Flow/Parquet/Data/Converter/BytesStringConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/Data/Converter/BytesStringConverter.php @@ -6,7 +6,7 @@ use Flow\Parquet\BinaryReader\Bytes; use Flow\Parquet\Data\Converter; -use Flow\Parquet\ParquetFile\Schema\{FlatColumn, PhysicalType}; +use Flow\Parquet\ParquetFile\Schema\{ConvertedType, FlatColumn, PhysicalType}; use Flow\Parquet\{Option, Options}; final class BytesStringConverter implements Converter diff --git a/src/lib/parquet/src/Flow/Parquet/Data/Converter/Int32DateConverter.php b/src/lib/parquet/src/Flow/Parquet/Data/Converter/Int32DateConverter.php index 6a1a4b8c3..a94eccfe6 100644 --- a/src/lib/parquet/src/Flow/Parquet/Data/Converter/Int32DateConverter.php +++ b/src/lib/parquet/src/Flow/Parquet/Data/Converter/Int32DateConverter.php @@ -6,7 +6,7 @@ use Flow\Parquet\Data\Converter; use Flow\Parquet\Options; -use Flow\Parquet\ParquetFile\Schema\{FlatColumn, LogicalType, PhysicalType}; +use Flow\Parquet\ParquetFile\Schema\{ConvertedType, FlatColumn, LogicalType, PhysicalType}; final class Int32DateConverter implements Converter { @@ -21,6 +21,10 @@ public function isFor(FlatColumn $column, Options $options) : bool return true; } + if ($column->type() === PhysicalType::INT32 && $column->convertedType() === ConvertedType::DATE) { + return true; + } + return false; } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/Converter/Int32DateConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/Converter/Int32DateConverterTest.php index a54e78942..66dbfcbc6 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/Converter/Int32DateConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/Converter/Int32DateConverterTest.php @@ -5,6 +5,8 @@ namespace Flow\Parquet\Tests\Unit\Data\Converter; use Flow\Parquet\Data\Converter\Int32DateConverter; +use Flow\Parquet\Options; +use Flow\Parquet\ParquetFile\Schema\{ConvertedType, FlatColumn, PhysicalType}; use PHPUnit\Framework\TestCase; final class Int32DateConverterTest extends TestCase @@ -20,4 +22,21 @@ public function test_converting_dates() : void $converter->fromParquetType($converter->toParquetType($date)) ); } + + public function test_converting_int32_with_deprecated_converted_type() : void + { + $converter = new Int32DateConverter(); + + self::assertTrue( + $converter->isFor( + new FlatColumn( + 'date', + PhysicalType::INT32, + ConvertedType::DATE, + null, + ), + Options::default() + ) + ); + } }